diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2019-03-04 01:48:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-04 01:48:58 +0200 |
commit | 0de4f199b3aa30939436742cfcd706412ea498e9 (patch) | |
tree | 9e8e3bae6cee8ce439febfd18a8d26c71eb54380 /run_unittests.py | |
parent | 7f9fb6a08481c26698fb9c8ce4920c456e46bbbd (diff) | |
parent | 586ec5a28cc2ea854f726cb7a6075b0918595bf5 (diff) | |
download | meson-0de4f199b3aa30939436742cfcd706412ea498e9.zip meson-0de4f199b3aa30939436742cfcd706412ea498e9.tar.gz meson-0de4f199b3aa30939436742cfcd706412ea498e9.tar.bz2 |
Merge pull request #4949 from mensinda/introTargetNoBD
mintro: Introspect targets and deps without a build directory
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index b5cb53c..c1337a3 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -3511,6 +3511,70 @@ recommended as it is not supported on some platforms''') self.assertListEqual(res1, res2) + def test_introspect_targets_from_source(self): + testdir = os.path.join(self.unit_test_dir, '52 introspection') + testfile = os.path.join(testdir, 'meson.build') + introfile = os.path.join(self.builddir, 'meson-info', 'intro-targets.json') + self.init(testdir) + self.assertPathExists(introfile) + with open(introfile, 'r') as fp: + res_wb = json.load(fp) + + res_nb = self.introspect_directory(testfile, ['--targets'] + self.meson_args) + + # Account for differences in output + for i in res_wb: + i['filename'] = [os.path.relpath(x, self.builddir) for x in i['filename']] + if 'install_filename' in i: + del i['install_filename'] + + sources = [] + for j in i['target_sources']: + sources += j['sources'] + i['target_sources'] = [{ + 'language': 'unknown', + 'compiler': [], + 'parameters': [], + 'sources': sources, + 'generated_sources': [] + }] + + self.maxDiff = None + self.assertListEqual(res_nb, res_wb) + + def test_introspect_dependencies_from_source(self): + testdir = os.path.join(self.unit_test_dir, '52 introspection') + testfile = os.path.join(testdir, 'meson.build') + res_nb = self.introspect_directory(testfile, ['--scan-dependencies'] + self.meson_args) + expected = [ + { + 'name': 'threads', + 'required': True, + 'has_fallback': False, + 'conditional': False + }, + { + 'name': 'zlib', + 'required': False, + 'has_fallback': False, + 'conditional': False + }, + { + 'name': 'somethingthatdoesnotexist', + 'required': True, + 'has_fallback': False, + 'conditional': True + }, + { + 'name': 'look_i_have_a_fallback', + 'required': True, + 'has_fallback': True, + 'conditional': True + } + ] + self.maxDiff = None + self.assertListEqual(res_nb, expected) + class FailureTests(BasePlatformTests): ''' Tests that test failure conditions. Build files here should be dynamically |