diff options
| author | Jussi Pakkanen <jpakkane@gmail.com> | 2024-07-10 21:32:35 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-10 21:32:35 +0300 |
| commit | 47fd13aefcb3f1b9494b0b248073ed6e388b1dac (patch) | |
| tree | 21059fca1ea12993a8aa373f836e9dd6525140cf /run_project_tests.py | |
| parent | 9a60deff0a4178e9b608fa76ff0bc06617d89540 (diff) | |
| download | meson-47fd13aefcb3f1b9494b0b248073ed6e388b1dac.tar.gz | |
tests: Clean up leftover files from source dirs.
Diffstat (limited to 'run_project_tests.py')
| -rwxr-xr-x | run_project_tests.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/run_project_tests.py b/run_project_tests.py index 974273fc7..a1feecdfc 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -278,6 +278,7 @@ class TestDef: self.stdout: T.List[T.Dict[str, str]] = [] self.skip_category = skip_category self.skip_expected = False + self.cleanup: T.List[str] = [] # Always print a stack trace for Meson exceptions self.env['MESON_FORCE_BACKTRACE'] = '1' @@ -844,6 +845,8 @@ def load_test_json(t: TestDef, stdout_mandatory: bool, skip_category: bool = Fal (t.skip, t.skip_expected) = _skip_keys(test_def) + cleanup = test_def.get('cleanup', []) + # Skip tests if the tool requirements are not met if 'tools' in test_def: assert isinstance(test_def['tools'], dict) @@ -859,6 +862,7 @@ def load_test_json(t: TestDef, stdout_mandatory: bool, skip_category: bool = Fal t.installed_files = installed t.do_not_set_opts = do_not_set_opts t.stdout = stdout + t.cleanup = cleanup return [t] new_opt_list: T.List[T.List[T.Tuple[str, str, bool, bool]]] @@ -928,6 +932,8 @@ def load_test_json(t: TestDef, stdout_mandatory: bool, skip_category: bool = Fal test.do_not_set_opts = do_not_set_opts test.stdout = stdout test.skip_expected = skip_expected or t.skip_expected + test.cleanup = cleanup + all_tests.append(test) return all_tests @@ -1393,6 +1399,13 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]], else: f.update_log(TestStatus.OK) passing_tests += 1 + for cleanup_path in t.cleanup: + assert not os.path.isabs(cleanup_path) + abspath = t.path / cleanup_path + if abspath.is_file(): + mesonlib.windows_proof_rm(abspath) + else: + mesonlib.windows_proof_rmtree(abspath) conf_time += result.conftime build_time += result.buildtime test_time += result.testtime @@ -1550,7 +1563,7 @@ def print_tool_versions() -> None: print() tmpdir = list(Path('.').glob('test cases/**/*install functions and follow symlinks')) -assert(len(tmpdir) == 1) +assert len(tmpdir) == 1 symlink_test_dir = tmpdir[0] symlink_file1 = symlink_test_dir / 'foo/link1' symlink_file2 = symlink_test_dir / 'foo/link2.h' |
