-
Notifications
You must be signed in to change notification settings - Fork 6
/
test_things.py
61 lines (48 loc) · 1.77 KB
/
test_things.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import tables
def test_no_soc_duplicates():
socs = []
for soc in tables.socs:
soc_name = f"{soc['vendor']}:{soc['name']}"
if soc_name in socs:
raise ValueError(f"Duplicated SoC: {soc_name}")
socs.append(soc_name)
def test_for_unknown_implementer():
for soc in tables.socs:
for core in soc["cores"]:
try:
if tables.cpu_cores[core["implementer"]]:
pass
except KeyError:
raise ValueError(
f"Missing {hex(core['implementer'])} core"
" implementer!",
)
def test_for_unknown_core():
for soc in tables.socs:
for core in soc["cores"]:
core_prv = f'{hex(core["part"])}-{core["revision"]}-' \
f'{core["variant"]}'
try:
if tables.cpu_cores[core["implementer"]]["cores"][
core_prv]:
pass
except KeyError:
try:
if tables.cpu_cores[core["implementer"]]["cores"][
hex(core["part"])]:
pass
except KeyError:
raise ValueError(
f"Missing data for {hex(core['part'])} core for "
f"{hex(core['implementer'])}!",
)
def test_for_unknown_feature():
for soc in tables.socs:
for feature in soc["features"]:
try:
if tables.cpu_features[feature]:
pass
except KeyError:
soc_name = f"{soc['vendor']}:{soc['name']}"
raise ValueError(f"Unknown cpu feature '{feature}' "
f"in {soc_name}")