Tests and docs
This commit is contained in:
parent
64372d5cfc
commit
e5099357c2
|
@ -70,6 +70,15 @@ The possible values for `section` are:
|
|||
|
||||
To set the options, use the `meson configure` command.
|
||||
|
||||
It is also possible to get the default buildoptions without a build directory by providing the root `meson.build` instead of a build directory to `meson introspect --buildoptions`.
|
||||
|
||||
Running `--buildoptions` without a build directory produces the same output as running
|
||||
it with a freshly configured build directory.
|
||||
|
||||
However, this behavior is not guaranteed if subprojects are present. Due to internal
|
||||
limitations all subprojects are processed even if they are never used in a real meson run.
|
||||
Because of this options for the subprojects can differ.
|
||||
|
||||
## Tests
|
||||
|
||||
Compilation and unit tests are done as usual by running the `ninja` and `ninja test` commands. A JSON formatted result log can be found in `workspace/project/builddir/meson-logs/testlog.json`.
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
## `introspect --buildoptions` can now be used without configured build directory
|
||||
|
||||
It is now possible to run `meson introspect --buildoptions /path/to/meson.build`
|
||||
without a configured build directory.
|
||||
|
||||
Running `--buildoptions` without a build directory produces the same output as running
|
||||
it with a freshly configured build directory.
|
||||
|
||||
However, this behavior is not guaranteed if subprojects are present. Due to internal
|
||||
limitations all subprojects are processed even if they are never used in a real meson run.
|
||||
Because of this options for the subprojects can differ.
|
|
@ -1199,7 +1199,12 @@ class BasePlatformTests(unittest.TestCase):
|
|||
args = [args]
|
||||
out = subprocess.check_output(self.mintro_command + args + [directory],
|
||||
universal_newlines=True)
|
||||
return json.loads(out)
|
||||
try:
|
||||
obj = json.loads(out)
|
||||
except Exception as e:
|
||||
print(out)
|
||||
raise e
|
||||
return obj
|
||||
|
||||
def assertPathEqual(self, path1, path2):
|
||||
'''
|
||||
|
@ -3089,6 +3094,16 @@ recommended as it is not supported on some platforms''')
|
|||
self.assertEqual(Path(testfile).read_text(),
|
||||
Path(goodfile).read_text())
|
||||
|
||||
def test_introspect_buildoptions_without_configured_build(self):
|
||||
testdir = os.path.join(self.unit_test_dir, '51 introspect buildoptions')
|
||||
testfile = os.path.join(testdir, 'meson.build')
|
||||
res_nb = self.introspect_directory(testfile, ['--buildoptions'] + self.meson_args)
|
||||
self.init(testdir, default_args=False)
|
||||
res_wb = self.introspect('--buildoptions')
|
||||
self.maxDiff = None
|
||||
self.assertListEqual(res_nb, res_wb)
|
||||
|
||||
|
||||
class FailureTests(BasePlatformTests):
|
||||
'''
|
||||
Tests that test failure conditions. Build files here should be dynamically
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
print('c')
|
|
@ -0,0 +1,11 @@
|
|||
project('introspect buildargs', ['c'], default_options: ['c_std=c11', 'cpp_std=c++14', 'buildtype=release'])
|
||||
|
||||
subA = subproject('projectA')
|
||||
|
||||
r = run_command(find_program('c_compiler.py'))
|
||||
if r.returncode() != 0
|
||||
error('FAILED')
|
||||
endif
|
||||
|
||||
add_languages(r.stdout().strip(), required: true)
|
||||
add_languages('afgggergearvearghergervergreaergaergasv', required: false)
|
|
@ -0,0 +1,2 @@
|
|||
option('max_register_count', type: 'integer', min: 0, value: 125)
|
||||
option('use_external_fmt', type: 'boolean', value: false)
|
|
@ -0,0 +1,3 @@
|
|||
project('introspect subproject A', 'c', default_options: ['cpp_std=c++11', 'buildtype=debug'])
|
||||
|
||||
add_languages('cpp')
|
|
@ -0,0 +1 @@
|
|||
option('subproj_var', type: 'boolean', value: false)
|
|
@ -0,0 +1,9 @@
|
|||
pfggggaergaeg(sdgrgjgn)aga
|
||||
|
||||
rgqeh
|
||||
th
|
||||
thtr
|
||||
e
|
||||
tb
|
||||
tbqebt
|
||||
tbqebttrtt
|
|
@ -0,0 +1 @@
|
|||
option('should_not_appear', type: 'integer', min: 0, value: 125)
|
Loading…
Reference in New Issue