From 66c66ff494ca651014e42dbb7d25ff13c6957f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6hm?= Date: Wed, 27 Sep 2023 10:57:12 +0200 Subject: [PATCH] Adds patch-config workload selection test --- tests/experiment/test_workload_util.py | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/experiment/test_workload_util.py b/tests/experiment/test_workload_util.py index b8de4db27..e98e56d00 100644 --- a/tests/experiment/test_workload_util.py +++ b/tests/experiment/test_workload_util.py @@ -6,8 +6,14 @@ from benchbuild.source.base import Revision, Variant import varats.experiment.workload_util as wu +from tests.helper_utils import run_in_test_environment, UnitTestFixtures +from varats.paper.paper_config import load_paper_config from varats.projects.c_projects.xz import Xz +from varats.projects.perf_tests.feature_perf_cs_collection import ( + SynthIPTemplate, +) from varats.utils.git_util import ShortCommitHash +from varats.utils.settings import vara_cfg TT = PathToken.make_token(RootRenderer()) @@ -66,6 +72,37 @@ def test_workload_commands_requires(self) -> None: ) self.assertEqual(len(commands), 1) + @run_in_test_environment(UnitTestFixtures.PAPER_CONFIGS) + def test_workload_commands_requires_patch(self) -> None: + vara_cfg()['paper_config']['current_config'] = "test_config_ids" + load_paper_config() + + revision = Revision( + SynthIPTemplate, Variant(SynthIPTemplate.SOURCE[0], "7930350628"), + Variant(SynthIPTemplate.SOURCE[1], "1") + ) + project = SynthIPTemplate(revision=revision) + binary = SynthIPTemplate.binaries_for_revision( + ShortCommitHash("7930350628") + )[0] + workloads = wu.workload_commands(project, binary, []) + self.assertEqual(len(workloads), 2) + + @run_in_test_environment(UnitTestFixtures.PAPER_CONFIGS) + def test_workload_commands_requires_patch2(self) -> None: + vara_cfg()['paper_config']['current_config'] = "test_config_ids" + load_paper_config() + + revision = Revision( + SynthIPTemplate, Variant(SynthIPTemplate.SOURCE[0], "7930350628"), + Variant(SynthIPTemplate.SOURCE[1], "0") + ) + project = SynthIPTemplate(revision=revision) + binary = SynthIPTemplate \ + .binaries_for_revision(ShortCommitHash("7930350628"))[0] + workloads = wu.workload_commands(project, binary, []) + self.assertEqual(len(workloads), 0) + class TestWorkloadFilenames(unittest.TestCase):