diff options
Diffstat (limited to 'tests/performance/api/config.py')
-rw-r--r-- | tests/performance/api/config.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/performance/api/config.py b/tests/performance/api/config.py index 68f4df8d487..283d1ff16ec 100644 --- a/tests/performance/api/config.py +++ b/tests/performance/api/config.py @@ -112,7 +112,7 @@ class TestConfig: self.base_dir = env.base_dir / name self.logs_dir = self.base_dir / 'logs' - config = self._read_config_module() + config = TestConfig._read_config_module(self.base_dir) self.tests = TestCollection(env, getattr(config, 'tests', ['*']), getattr(config, 'categories', ['*'])) @@ -154,10 +154,17 @@ class TestConfig: with open(config_file, 'w') as f: f.write(default_config) - def _read_config_module(self) -> None: + @staticmethod + def read_blender_executables(env, name) -> List: + config = TestConfig._read_config_module(env.base_dir / name) + builds = getattr(config, 'builds', {}) + return [pathlib.Path(build) for build in builds.values()] + + @staticmethod + def _read_config_module(base_dir: pathlib.Path) -> None: # Import config.py as a module. import importlib.util - spec = importlib.util.spec_from_file_location("testconfig", self.base_dir / 'config.py') + spec = importlib.util.spec_from_file_location("testconfig", base_dir / 'config.py') mod = importlib.util.module_from_spec(spec) spec.loader.exec_module(mod) return mod @@ -195,14 +202,14 @@ class TestConfig: # Get entries for revisions based on existing builds. for revision_name, executable in self.builds.items(): - executable_path = pathlib.Path(executable) - if not executable_path.exists(): + executable_path = env._blender_executable_from_path(pathlib.Path(executable)) + if not executable_path: sys.stderr.write(f'Error: build {executable} not found\n') sys.exit(1) env.set_blender_executable(executable_path) git_hash, _ = env.run_in_blender(get_build_hash, {}) - env.unset_blender_executable() + env.set_default_blender_executable() mtime = executable_path.stat().st_mtime entries += self._get_entries(revision_name, git_hash, executable, mtime) |