From 39506501d525481613b2d87d356986bcde1545c0 Mon Sep 17 00:00:00 2001 From: The Tumultuous Unicorn Of Darkness Date: Sun, 25 Aug 2024 21:05:36 +0200 Subject: [PATCH] Tests: fix the --fix option --fix was removing delimiters from real output, but there are required. --- tests/amd/zen2/epyc-rome-dual.test | 1 + tests/run_tests.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/amd/zen2/epyc-rome-dual.test b/tests/amd/zen2/epyc-rome-dual.test index 1a4c490..aef8bf0 100644 --- a/tests/amd/zen2/epyc-rome-dual.test +++ b/tests/amd/zen2/epyc-rome-dual.test @@ -15392,6 +15392,7 @@ general 256 (authoritative) EPYC (Rome) fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht pni pclmul monitor ssse3 cx16 sse4_1 sse4_2 syscall movbe popcnt aes xsave osxsave avx mmxext nx fxsr_opt rdtscp lm lahf_lm cmp_legacy svm abm misalignsse sse4a 3dnowprefetch osvw ibs skinit wdt ts ttp tm_amd hwpstate constant_tsc fma3 f16c rdrand x2apic cpb aperfmperf avx2 bmi1 bmi2 sha_ni rdseed adx +-------------------------------------------------------------------------------- x86 x86-64-v3 general diff --git a/tests/run_tests.py b/tests/run_tests.py index 818a0c8..8f9dde2 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -96,9 +96,11 @@ def do_test(inp, expected_out, binary, test_file_name, num_cpu_type): os.system(cmd) os.unlink(fninp) real_out = [] + real_out_delim = [] # when fixing the file, delimiters are required try: f = open(fnoutp, "rt") for s in f.readlines(): + real_out_delim.append(s.strip()) if delimiter not in s: real_out.append(s.strip()) f.close() @@ -107,7 +109,7 @@ def do_test(inp, expected_out, binary, test_file_name, num_cpu_type): return "Exception" if len(real_out) != len(expected_out) or len(real_out) != len(fields) * num_cpu_type: if fix: - fixFile(test_file_name, inp, real_out) + fixFile(test_file_name, inp, real_out_delim) return "Number of records, fixed." else: return "Unexpected number of records returned\n - expected length %d\n - real length %d\n - %d fields" % (len(expected_out), len(real_out), len(fields) * num_cpu_type) @@ -119,7 +121,7 @@ def do_test(inp, expected_out, binary, test_file_name, num_cpu_type): return "OK" else: if fix: - fixFile(test_file_name, inp, real_out) + fixFile(test_file_name, inp, real_out_delim) return "Mismatch, fixed." else: return "Mismatch in fields:\n%s" % "\n".join([fmt_error(err) for err in err_fields])