diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-02-25 22:01:41 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-02-26 20:25:55 +0100 |
commit | 12930051ae13faf4ff5ba4a421a9cc8deb7c9f9b (patch) | |
tree | ee45510453c0c791e227465ba0f44dc56aa36bca | |
parent | 8e60b8c14610fe287df42a76a60148aae86b8284 (diff) | |
download | meson-12930051ae13faf4ff5ba4a421a9cc8deb7c9f9b.zip meson-12930051ae13faf4ff5ba4a421a9cc8deb7c9f9b.tar.gz meson-12930051ae13faf4ff5ba4a421a9cc8deb7c9f9b.tar.bz2 |
test: replace pass_* functions with a test.json entry
-rwxr-xr-x | run_project_tests.py | 29 | ||||
-rw-r--r-- | test cases/common/195 install_mode/test.json | 3 | ||||
-rw-r--r-- | test cases/common/8 install/test.json | 3 | ||||
-rw-r--r-- | test cases/failing/38 libdir must be inside prefix/test.json | 3 | ||||
-rw-r--r-- | test cases/failing/39 prefix absolute/test.json | 3 |
5 files changed, 20 insertions, 21 deletions
diff --git a/run_project_tests.py b/run_project_tests.py index 4526662..86db599 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -145,6 +145,7 @@ class TestDef: self.skip = skip self.env = os.environ.copy() self.installed_files = [] # type: T.List[InstalledFile] + self.do_not_set_opts = [] # type: T.List[str] def __repr__(self) -> str: return '<{}: {:<48} [{}: {}] -- {}>'.format(type(self).__name__, str(self.path), self.name, self.args, self.skip) @@ -378,29 +379,14 @@ def run_test(test: TestDef, extra_args, compiler, backend, flags, commands, shou finally: mlog.shutdown() # Close the log file because otherwise Windows wets itself. -def pass_prefix_to_test(dirname: Path): - if '39 prefix absolute' in dirname.name: - return False - return True - -def pass_libdir_to_test(dirname: Path): - if '8 install' in dirname.name: - return False - if '38 libdir must be inside prefix' in dirname.name: - return False - if '195 install_mode' in dirname.name: - return False - return True - def _run_test(test: TestDef, test_build_dir: str, install_dir: str, extra_args, compiler, backend, flags, commands, should_fail): compile_commands, clean_commands, install_commands, uninstall_commands = commands gen_start = time.time() # Configure in-process - if pass_prefix_to_test(test.path): - gen_args = ['--prefix', 'x:/usr'] if mesonlib.is_windows() else ['--prefix', '/usr'] - else: - gen_args = [] - if pass_libdir_to_test(test.path): + gen_args = [] # type: T.List[str] + if 'prefix' not in test.do_not_set_opts: + gen_args += ['--prefix', 'x:/usr'] if mesonlib.is_windows() else ['--prefix', '/usr'] + if 'libdir' not in test.do_not_set_opts: gen_args += ['--libdir', 'lib'] gen_args += [test.path.as_posix(), test_build_dir] + flags + extra_args nativefile = test.path / 'nativefile.ini' @@ -521,10 +507,14 @@ def gather_tests(testdir: Path) -> T.List[TestDef]: if 'installed' in test_def: installed = [InstalledFile(x) for x in test_def['installed']] + # Handle the do_not_set_opts list + do_not_set_opts = test_def.get('do_not_set_opts', []) # type: T.List[str] + # Skip the matrix code and just update the existing test if 'matrix' not in test_def: t.env.update(env) t.installed_files = installed + t.do_not_set_opts = do_not_set_opts all_tests += [t] continue @@ -594,6 +584,7 @@ def gather_tests(testdir: Path) -> T.List[TestDef]: test = TestDef(t.path, name, opts, skip) test.env.update(env) test.installed_files = installed + test.do_not_set_opts = do_not_set_opts all_tests += [test] return sorted(all_tests) diff --git a/test cases/common/195 install_mode/test.json b/test cases/common/195 install_mode/test.json index e5c414e..3614dbc 100644 --- a/test cases/common/195 install_mode/test.json +++ b/test cases/common/195 install_mode/test.json @@ -10,5 +10,6 @@ {"type": "file", "file": "usr/share/sub1/second.dat"}, {"type": "file", "file": "usr/share/sub2/stub"}, {"type": "file", "file": "usr/subdir/data.dat"} - ] + ], + "do_not_set_opts": ["libdir"] } diff --git a/test cases/common/8 install/test.json b/test cases/common/8 install/test.json index d4a1e64..d2b1c63 100644 --- a/test cases/common/8 install/test.json +++ b/test cases/common/8 install/test.json @@ -3,5 +3,6 @@ { "type": "exe", "file": "usr/bin/prog" }, { "type": "pdb", "file": "usr/bin/prog" }, { "type": "file", "file": "usr/libtest/libstat.a" } - ] + ], + "do_not_set_opts": ["libdir"] } diff --git a/test cases/failing/38 libdir must be inside prefix/test.json b/test cases/failing/38 libdir must be inside prefix/test.json new file mode 100644 index 0000000..1cd893c --- /dev/null +++ b/test cases/failing/38 libdir must be inside prefix/test.json @@ -0,0 +1,3 @@ +{ + "do_not_set_opts": ["libdir"] +} diff --git a/test cases/failing/39 prefix absolute/test.json b/test cases/failing/39 prefix absolute/test.json new file mode 100644 index 0000000..4e0f6cd --- /dev/null +++ b/test cases/failing/39 prefix absolute/test.json @@ -0,0 +1,3 @@ +{ + "do_not_set_opts": ["prefix"] +} |