aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-09-04 04:50:15 -0400
committerDaniel Mensinger <daniel@mensinger-ka.de>2020-09-04 14:45:20 +0200
commitfa5c2363eb1dd94058aac1a4045d2ab546eed7b9 (patch)
treeeb28e49113496ac423b5cee05e8c603d6e111e49 /run_unittests.py
parent0b0873c7438471732e5237b1c667e5a3b3fe3c82 (diff)
downloadmeson-fa5c2363eb1dd94058aac1a4045d2ab546eed7b9.zip
meson-fa5c2363eb1dd94058aac1a4045d2ab546eed7b9.tar.gz
meson-fa5c2363eb1dd94058aac1a4045d2ab546eed7b9.tar.bz2
introspect: add test dependencies info to test/benchmark JSON
Add the ids of any target that needs to be rebuilt before running the tests as computed by the backend, to the introspection data for tests and benchmarks. This also includes anything that appears on the test's command line. Without this information, IDEs must update the entire build before running any test. They can now instead selectively build the test executable itself and anything that is needed to run it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 8c03693..2ff2af5 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -4281,6 +4281,7 @@ recommended as it is not supported on some platforms''')
('suite', list),
('is_parallel', bool),
('protocol', str),
+ ('depends', list),
]
buildoptions_keylist = [
@@ -4338,12 +4339,28 @@ recommended as it is not supported on some platforms''')
assertKeyTypes(root_keylist, res)
+ # Match target ids to input and output files for ease of reference
+ src_to_id = {}
+ out_to_id = {}
+ for i in res['targets']:
+ print(json.dump(i, sys.stdout))
+ out_to_id.update({os.path.relpath(out, self.builddir): i['id']
+ for out in i['filename']})
+ for group in i['target_sources']:
+ src_to_id.update({os.path.relpath(src, testdir): i['id']
+ for src in group['sources']})
+
# Check Tests and benchmarks
tests_to_find = ['test case 1', 'test case 2', 'benchmark 1']
+ deps_to_find = {'test case 1': [src_to_id['t1.cpp']],
+ 'test case 2': [src_to_id['t2.cpp'], src_to_id['t3.cpp']],
+ 'benchmark 1': [out_to_id['file2'], src_to_id['t3.cpp']]}
for i in res['benchmarks'] + res['tests']:
assertKeyTypes(test_keylist, i)
if i['name'] in tests_to_find:
tests_to_find.remove(i['name'])
+ self.assertEqual(sorted(i['depends']),
+ sorted(deps_to_find[i['name']]))
self.assertListEqual(tests_to_find, [])
# Check buildoptions
@@ -4484,6 +4501,7 @@ recommended as it is not supported on some platforms''')
res_nb = self.introspect_directory(testfile, ['--targets'] + self.meson_args)
# Account for differences in output
+ res_wb = [i for i in res_wb if i['type'] != 'custom']
for i in res_wb:
i['filename'] = [os.path.relpath(x, self.builddir) for x in i['filename']]
if 'install_filename' in i: