Refactoring: extract common benchexec arguments in tests
@@ -95,9 +95,16 @@ class BenchExecIntegrationTests(unittest.TestCase):
shutil.rmtree(self.tmp)
def run_cmd(self, *args):
+ standard_args = [
+ benchexec,
+ "--outputpath",
+ self.output_dir,
+ "--startTime",
+ "2015-01-01 00:00",
+ ]
try:
output = subprocess.check_output(
- args=args, stderr=subprocess.STDOUT
+ args=standard_args + list(args), stderr=subprocess.STDOUT
).decode()
except subprocess.CalledProcessError as e:
print(e.output.decode())
@@ -118,16 +125,7 @@ class BenchExecIntegrationTests(unittest.TestCase):
if not test_file: # Assign default test file
test_file = self.benchmark_test_file
self.run_cmd(
- *[
- benchexec,
- test_file,
- "--outputpath",
- self.output_dir,
- "--startTime",
- "2015-01-01 00:00",
- ]
- + ([] if compress else ["--no-compress-results"])
- + list(args)
+ *[test_file] + ([] if compress else ["--no-compress-results"]) + list(args)
)
generated_files = set(os.listdir(self.output_dir))
@@ -336,15 +334,7 @@ class BenchExecIntegrationTests(unittest.TestCase):
self.run_benchexec_and_compare_expected_files(compress=True)
def test_validate_result_xml(self):
- self.run_cmd(
- benchexec,
- self.benchmark_test_file,
- "--outputpath",
- self.output_dir,
- "--startTime",
- "2015-01-01 00:00",
- "--no-compress-results",
- )
+ self.run_cmd(self.benchmark_test_file, "--no-compress-results")
basename = "benchmark-example-rand.2015-01-01_0000."
xml_files = ["results.xml"] + [
"results." + files + ".xml" for files in benchmark_test_tasks
@@ -375,15 +365,7 @@ class BenchExecIntegrationTests(unittest.TestCase):
)
benchmark_xml = os.path.join(self.benchmarks_dir, "benchmark-example-true.xml")
self.run_cmd(
- benchexec,
- benchmark_xml,
- "--outputpath",
- self.output_dir,
- "--startTime",
- "2015-01-01 00:00",
- "--no-compress-results",
- "--rundefinition",
- "no options",
+ benchmark_xml, "--no-compress-results", "--rundefinition", "no options"
)
actual_xml = os.path.join(
self.output_dir,
