Tests and docs

pull/4564/head
Daniel Mensinger 6 years ago
parent 64372d5cfc
commit e5099357c2
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
  1. 9
      docs/markdown/IDE-integration.md
  2. 11
      docs/markdown/snippets/introspect_buildoptions_no_bd.md
  3. 17
      run_unittests.py
  4. 3
      test cases/unit/51 introspect buildoptions/c_compiler.py
  5. 11
      test cases/unit/51 introspect buildoptions/meson.build
  6. 2
      test cases/unit/51 introspect buildoptions/meson_options.txt
  7. 0
      test cases/unit/51 introspect buildoptions/subprojects/evilFile.txt
  8. 3
      test cases/unit/51 introspect buildoptions/subprojects/projectA/meson.build
  9. 1
      test cases/unit/51 introspect buildoptions/subprojects/projectA/meson_options.txt
  10. 9
      test cases/unit/51 introspect buildoptions/subprojects/projectBad/meson.build
  11. 1
      test cases/unit/51 introspect buildoptions/subprojects/projectBad/meson_options.txt

@ -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…
Cancel
Save