diff options
Diffstat (limited to 'tests/performance/api/config.py')
-rw-r--r-- | tests/performance/api/config.py | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/tests/performance/api/config.py b/tests/performance/api/config.py index d3a79eede14..b5e2b390aa3 100644 --- a/tests/performance/api/config.py +++ b/tests/performance/api/config.py @@ -25,6 +25,7 @@ class TestEntry: category: str = '' revision: str = '' git_hash: str = '' + environment: Dict = field(default_factory=dict) executable: str = '' date: int = 0 device_type: str = 'CPU' @@ -160,7 +161,13 @@ class TestConfig: 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()] + executables = [] + + for executable in builds.values(): + executable, _ = TestConfig._split_environment_variables(executable) + executables.append(pathlib.Path(executable)) + + return executables @staticmethod def _read_config_module(base_dir: pathlib.Path) -> None: @@ -191,9 +198,10 @@ class TestConfig: # Get entries for specified commits, tags and branches. for revision_name, revision_commit in self.revisions.items(): + revision_commit, environment = self._split_environment_variables(revision_commit) git_hash = env.resolve_git_hash(revision_commit) date = env.git_hash_date(git_hash) - entries += self._get_entries(revision_name, git_hash, '', date) + entries += self._get_entries(revision_name, git_hash, '', environment, date) # Optimization to avoid rebuilds. revisions_to_build = set() @@ -204,6 +212,7 @@ class TestConfig: # Get entries for revisions based on existing builds. for revision_name, executable in self.builds.items(): + executable, environment = self._split_environment_variables(executable) executable_path = env._blender_executable_from_path(pathlib.Path(executable)) if not executable_path: sys.stderr.write(f'Error: build {executable} not found\n') @@ -214,7 +223,7 @@ class TestConfig: env.set_default_blender_executable() mtime = executable_path.stat().st_mtime - entries += self._get_entries(revision_name, git_hash, executable, mtime) + entries += self._get_entries(revision_name, git_hash, executable, environment, mtime) # Detect number of categories for more compact printing. categories = set() @@ -229,6 +238,7 @@ class TestConfig: revision_name: str, git_hash: str, executable: pathlib.Path, + environment: str, date: int) -> None: entries = [] for test in self.tests.tests: @@ -241,10 +251,12 @@ class TestConfig: # Test if revision hash or executable changed. if entry.git_hash != git_hash or \ entry.executable != executable or \ + entry.environment != environment or \ entry.benchmark_type != self.benchmark_type or \ entry.date != date: # Update existing entry. entry.git_hash = git_hash + entry.environment = environment entry.executable = executable entry.benchmark_type = self.benchmark_type entry.date = date @@ -256,6 +268,7 @@ class TestConfig: revision=revision_name, git_hash=git_hash, executable=executable, + environment=environment, date=date, test=test_name, category=test_category, @@ -266,3 +279,10 @@ class TestConfig: entries.append(entry) return entries + + @staticmethod + def _split_environment_variables(revision): + if isinstance(revision, str): + return revision, {} + else: + return revision[0], revision[1] |