Skip to content

Commit

Permalink
Tests: fix the --fix option
Browse files Browse the repository at this point in the history
--fix was removing delimiters from real output, but there are required.
  • Loading branch information
TheTumultuousUnicornOfDarkness committed Aug 25, 2024
1 parent 3b8b7df commit 3950650
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/amd/zen2/epyc-rome-dual.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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])
Expand Down

0 comments on commit 3950650

Please sign in to comment.