mirror of
https://github.com/anrieff/libcpuid
synced 2025-10-03 11:01:30 +00:00
Add cpu_feature_level_t enumerated values for x86 CPUs
I had to fix run_tests.py to update all test files properly. Fix #177
This commit is contained in:
parent
c5885699f0
commit
959edc34e7
229 changed files with 388 additions and 12 deletions
|
@ -5,14 +5,16 @@ import os, sys, re, random
|
|||
|
||||
|
||||
### Constants:
|
||||
fields_x86 = [ "architecture", "purpose", "family", "model", "stepping", "extfamily",
|
||||
"extmodel", "cores", "logical",
|
||||
delimiter = "-" * 80
|
||||
fields_x86 = [ "architecture", "feature-level", "purpose", "family", "model", "stepping",
|
||||
"extfamily", "extmodel", "cores", "logical",
|
||||
"l1d-cache", "l1i-cache", "l2-cache", "l3-cache", "l4-cache",
|
||||
"l1d-assoc", "l1i-assoc", "l2-assoc", "l3-assoc", "l4-assoc",
|
||||
"l1d-cacheline", "l1i-cacheline", "l2-cacheline", "l3-cacheline", "l4-cacheline",
|
||||
"l1d-instances", "l1i-instances", "l2-instances", "l3-instances", "l4-instances",
|
||||
"sse-size", "codename", "flags" ]
|
||||
fields_arm = [ "architecture", "purpose", "implementer", "variant", "part-num", "revision",
|
||||
fields_arm = [ "architecture", "feature-level", "purpose",
|
||||
"implementer", "variant", "part-num", "revision",
|
||||
"cores", "logical",
|
||||
"codename", "flags" ]
|
||||
|
||||
|
@ -72,7 +74,6 @@ def fmt_error(err):
|
|||
def fixFile(filename, input_lines, output_lines):
|
||||
f = open(filename, "wt")
|
||||
f.writelines([s + "\n" for s in input_lines])
|
||||
f.write("--------------------------------------------------------------------------------\n")
|
||||
f.writelines([s + "\n" for s in output_lines])
|
||||
f.close()
|
||||
|
||||
|
@ -96,14 +97,18 @@ def do_test(inp, expected_out, binary, test_file_name, num_cpu_type):
|
|||
try:
|
||||
f = open(fnoutp, "rt")
|
||||
for s in f.readlines():
|
||||
if "-----" not in s:
|
||||
if delimiter not in s:
|
||||
real_out.append(s.strip())
|
||||
f.close()
|
||||
os.unlink(fnoutp)
|
||||
except IOError:
|
||||
return "Exception"
|
||||
if len(real_out) != len(expected_out) or len(real_out) != len(fields) * num_cpu_type:
|
||||
return "Unexpected number of records returned"
|
||||
if fix:
|
||||
fixFile(test_file_name, inp, real_out)
|
||||
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)
|
||||
err_fields = []
|
||||
for i in range(len(real_out)):
|
||||
if real_out[i] != expected_out[i]:
|
||||
|
@ -118,7 +123,6 @@ def do_test(inp, expected_out, binary, test_file_name, num_cpu_type):
|
|||
return "Mismatch in fields:\n%s" % "\n".join([fmt_error(err) for err in err_fields])
|
||||
|
||||
errors = False
|
||||
delimiter = "-" * 80
|
||||
print("Testing...")
|
||||
for test_file_name in filelist:
|
||||
num_cpu_type = 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue