diff options
author | Jason Francis <zxzax@protonmail.com> | 2021-03-22 08:50:10 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-04-26 17:08:26 +0100 |
commit | 39c751b94c5e12bb7a48a64941ccf225d93359ff (patch) | |
tree | 85564bb750d0b9b99007e964ea54d6c8d18f9022 /run_unittests.py | |
parent | bb12587e0ba83ed6cde0f395c0a31cee9a3ace26 (diff) | |
download | meson-39c751b94c5e12bb7a48a64941ccf225d93359ff.zip meson-39c751b94c5e12bb7a48a64941ccf225d93359ff.tar.gz meson-39c751b94c5e12bb7a48a64941ccf225d93359ff.tar.bz2 |
introspection: export all sources for custom targets
Also adds some test cases for source files in target_sources.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/run_unittests.py b/run_unittests.py index 8674426..a0eb670 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -4678,10 +4678,12 @@ class AllPlatformTests(BasePlatformTests): # Match target ids to input and output files for ease of reference src_to_id = {} out_to_id = {} + name_to_out = {} 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']}) + name_to_out.update({i['name']: i['filename']}) for group in i['target_sources']: src_to_id.update({os.path.relpath(src, testdir): i['id'] for src in group['sources']}) @@ -4690,7 +4692,7 @@ class AllPlatformTests(BasePlatformTests): 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']]} + 'benchmark 1': [out_to_id['file2'], out_to_id['file3'], out_to_id['file4'], src_to_id['t3.cpp']]} for i in res['benchmarks'] + res['tests']: assertKeyTypes(test_keylist, i) if i['name'] in tests_to_find: @@ -4737,11 +4739,22 @@ class AllPlatformTests(BasePlatformTests): # Check targets targets_to_find = { - 'sharedTestLib': ('shared library', True, False, 'sharedlib/meson.build'), - 'staticTestLib': ('static library', True, False, 'staticlib/meson.build'), - 'test1': ('executable', True, True, 'meson.build'), - 'test2': ('executable', True, False, 'meson.build'), - 'test3': ('executable', True, False, 'meson.build'), + 'sharedTestLib': ('shared library', True, False, 'sharedlib/meson.build', + [os.path.join(testdir, 'sharedlib', 'shared.cpp')]), + 'staticTestLib': ('static library', True, False, 'staticlib/meson.build', + [os.path.join(testdir, 'staticlib', 'static.c')]), + 'custom target test 1': ('custom', False, False, 'meson.build', + [os.path.join(testdir, 'cp.py')]), + 'custom target test 2': ('custom', False, False, 'meson.build', + name_to_out['custom target test 1']), + 'test1': ('executable', True, True, 'meson.build', + [os.path.join(testdir, 't1.cpp')]), + 'test2': ('executable', True, False, 'meson.build', + [os.path.join(testdir, 't2.cpp')]), + 'test3': ('executable', True, False, 'meson.build', + [os.path.join(testdir, 't3.cpp')]), + 'custom target test 3': ('custom', False, False, 'meson.build', + name_to_out['test3']), } for i in res['targets']: assertKeyTypes(targets_typelist, i) @@ -4754,6 +4767,7 @@ class AllPlatformTests(BasePlatformTests): targets_to_find.pop(i['name'], None) for j in i['target_sources']: assertKeyTypes(targets_sources_typelist, j) + self.assertEqual(j['sources'], [os.path.normpath(f) for f in tgt[4]]) self.assertDictEqual(targets_to_find, {}) def test_introspect_file_dump_equals_all(self): |