Skip to content

Commit

Permalink
Adds synthetic case sudies with different implementation patterns. (#840
Browse files Browse the repository at this point in the history
)
  • Loading branch information
boehmseb authored Sep 27, 2023
1 parent abf1d92 commit db6a69b
Show file tree
Hide file tree
Showing 4 changed files with 389 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
DocType: CaseStudy
Version: 1
...
---
project_name: SynthIPTemplate
stages:
- revisions:
- commit_hash: 793035062810ea3a2d9a10f831cd199fbbb82090
commit_id: 64
config_ids:
- 0
- 1
- 2
- 3
- 4
version: 0
...
---
config_type: PatchConfiguration
0: '["Decompress"]'
1: '["Compress"]'
2: '["Compress", "fastmode", "no_smallmode"]'
3: '["Compress", "no_fastmode", "smallmode"]'
4: '["Compress", "fastmode", "smallmode"]'
37 changes: 37 additions & 0 deletions tests/experiment/test_workload_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down Expand Up @@ -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):

Expand Down
20 changes: 20 additions & 0 deletions tests/utils/test_experiment_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
from varats.project.project_util import BinaryType, ProjectBinaryWrapper
from varats.project.varats_project import VProject
from varats.projects.c_projects.xz import Xz
from varats.projects.perf_tests.feature_perf_cs_collection import (
SynthIPTemplate,
)
from varats.report.gnu_time_report import TimeReport
from varats.report.report import FileStatusExtension, ReportSpecification
from varats.utils.git_util import ShortCommitHash
Expand Down Expand Up @@ -419,3 +422,20 @@ def test_get_extra_config_options(self) -> None:
)
project = Xz(revision=revision)
self.assertEqual(EU.get_extra_config_options(project), ["--foo"])

@run_in_test_environment(UnitTestFixtures.PAPER_CONFIGS)
def test_get_config_patches(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], "4")
)
project = SynthIPTemplate(revision=revision)
patches = EU.get_config_patches(project)
self.assertEqual(len(patches), 1)
self.assertEqual(
list(patches)[0].feature_tags,
["Compress", "fastmode", "smallmode"]
)
Loading

0 comments on commit db6a69b

Please sign in to comment.