1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-11-20 23:01:51 +00:00

Tests: fix the --fix option

--fix was removing delimiters from real output, but there are required.
This commit is contained in:
The Tumultuous Unicorn Of Darkness 2024-08-25 21:05:36 +02:00
parent 3b8b7dfaf8
commit 39506501d5
No known key found for this signature in database
GPG key ID: 1E55EE2EFF18BC1A
2 changed files with 5 additions and 2 deletions

View file

@ -15392,6 +15392,7 @@ general
256 (authoritative) 256 (authoritative)
EPYC (Rome) 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 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
x86-64-v3 x86-64-v3
general general

View file

@ -96,9 +96,11 @@ def do_test(inp, expected_out, binary, test_file_name, num_cpu_type):
os.system(cmd) os.system(cmd)
os.unlink(fninp) os.unlink(fninp)
real_out = [] real_out = []
real_out_delim = [] # when fixing the file, delimiters are required
try: try:
f = open(fnoutp, "rt") f = open(fnoutp, "rt")
for s in f.readlines(): for s in f.readlines():
real_out_delim.append(s.strip())
if delimiter not in s: if delimiter not in s:
real_out.append(s.strip()) real_out.append(s.strip())
f.close() f.close()
@ -107,7 +109,7 @@ def do_test(inp, expected_out, binary, test_file_name, num_cpu_type):
return "Exception" return "Exception"
if len(real_out) != len(expected_out) or len(real_out) != len(fields) * num_cpu_type: if len(real_out) != len(expected_out) or len(real_out) != len(fields) * num_cpu_type:
if fix: if fix:
fixFile(test_file_name, inp, real_out) fixFile(test_file_name, inp, real_out_delim)
return "Number of records, fixed." return "Number of records, fixed."
else: 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) 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" return "OK"
else: else:
if fix: if fix:
fixFile(test_file_name, inp, real_out) fixFile(test_file_name, inp, real_out_delim)
return "Mismatch, fixed." return "Mismatch, fixed."
else: else:
return "Mismatch in fields:\n%s" % "\n".join([fmt_error(err) for err in err_fields]) return "Mismatch in fields:\n%s" % "\n".join([fmt_error(err) for err in err_fields])