Skip to content

Commit 348963a

Browse files
committed
save generated inputs during tests in separate directories
1 parent cf92b99 commit 348963a

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

tests/symqemu/test.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,22 @@
99

1010

1111
class SymQemuTests(unittest.TestCase):
12-
SYMQEMU_OUTPUT_DIR = pathlib.Path(__file__).parent / "symqemu_output"
13-
14-
def setUp(self):
15-
self.SYMQEMU_OUTPUT_DIR.mkdir()
16-
17-
def tearDown(self):
18-
shutil.rmtree(self.SYMQEMU_OUTPUT_DIR)
19-
2012
def run_symqemu_and_assert_correct_result(self, binary_name):
2113
symqemu_ref_output_dir = util.BINARIES_DIR / binary_name / 'expected_outputs'
14+
symqemu_gen_output_dir = util.BINARIES_DIR / binary_name / 'generated_outputs'
15+
16+
symqemu_gen_output_dir.mkdir()
2217

23-
util.run_symqemu_on_test_binary(binary_name=binary_name, generated_test_cases_output_dir=self.SYMQEMU_OUTPUT_DIR)
18+
util.run_symqemu_on_test_binary(binary_name=binary_name, generated_test_cases_output_dir=symqemu_gen_output_dir)
2419

2520
# `filecmp.dircmp` does a "shallow" comparison, but this is not a problem here because
2621
# the timestamps should always be different, so the actual content of the files will be compared.
2722
# See https://docs.python.org/3/library/filecmp.html#filecmp.dircmp
28-
expected_vs_actual_output_comparison = filecmp.dircmp(self.SYMQEMU_OUTPUT_DIR, symqemu_ref_output_dir)
23+
expected_vs_actual_output_comparison = filecmp.dircmp(symqemu_gen_output_dir, symqemu_ref_output_dir)
2924

3025
for diff_file in expected_vs_actual_output_comparison.diff_files:
3126
ref_file = symqemu_ref_output_dir / diff_file
32-
gen_file = self.SYMQEMU_OUTPUT_DIR / diff_file
27+
gen_file = symqemu_gen_output_dir / diff_file
3328

3429
tmp_ref = tempfile.NamedTemporaryFile("w+")
3530
subprocess.run(["xxd", f"{ref_file}"], stdout=tmp_ref, check=True)

0 commit comments

Comments
 (0)