speccpu: support build_type for SPEC commands

This commit is contained in:
2025-04-23 21:20:36 +08:00
parent 1885fedfb2
commit 41e569bfd8
3 changed files with 37 additions and 0 deletions

View File

@@ -80,6 +80,33 @@ class TestSPEC:
assert "--output_root" in cmd
assert str(output_dir) in cmd
def test_mkcmd_runcpu_build_type_default(self):
"""Test that mkcmd_runcpu doesn't add build flags with default build type."""
spec = SPEC(Path("/path/to/spec"))
cmd = spec.mkcmd_runcpu(
"myconfig", ["benchmark1"], build_type=SPEC.BuildType.Default
)
assert "--nobuild" not in cmd
assert "--rebuild" not in cmd
def test_mkcmd_runcpu_build_type_nobuild(self):
"""Test that mkcmd_runcpu adds --nobuild flag with Nobuild build type."""
spec = SPEC(Path("/path/to/spec"))
cmd = spec.mkcmd_runcpu(
"myconfig", ["benchmark1"], build_type=SPEC.BuildType.Nobuild
)
assert "--nobuild" in cmd
assert "--rebuild" not in cmd
def test_mkcmd_runcpu_build_type_rebuild(self):
"""Test that mkcmd_runcpu adds --rebuild flag with Rebuild build type."""
spec = SPEC(Path("/path/to/spec"))
cmd = spec.mkcmd_runcpu(
"myconfig", ["benchmark1"], build_type=SPEC.BuildType.Rebuild
)
assert "--rebuild" in cmd
assert "--nobuild" not in cmd
class TestCheckBenchDir:
def test_valid_bench_dir(self, tmpdir):