-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck_panics.py
More file actions
63 lines (58 loc) · 1.67 KB
/
check_panics.py
File metadata and controls
63 lines (58 loc) · 1.67 KB
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
62
63
#!/usr/bin/env python3
import re
import sys
PATTERNS = {
b"No such file or directory": [],
rb"\bpanic\b": [],
rb"\bpanics\b": [],
rb"\boops\b": [],
rb"\boopses\b": [],
rb"\btaint\b": [],
rb"\btaints\b": [
b"rust_out_of_tree: loading out-of-tree module taints kernel."
],
rb"\bfault\b": [],
rb"\bfaults\b": [],
rb"\bcorrupted\b": [],
rb"\btrace\b": [
b"] RCU Tasks Trace:",
b"] trace event string verifier disabled",
b".pcie: probe with driver pci-host-generic failed with error -16"
],
rb"\btraces\b": [],
rb"\bbug\b": [
b" and report a bug"
],
rb"\bbugs\b": [],
rb"\berror\b": [
b"message (level 3)",
b"regulatory.db",
b".pcie: probe with driver pci-host-generic failed with error -16",
b"rust/kernel/error.rs",
],
rb"\berrors\b": [],
rb"\bwarning\b": [
b"message (level 4)"
],
rb"\bwarnings\b": [],
}
def main():
ok = True
with open(sys.argv[1], "rb") as file:
for line in file:
for pattern in PATTERNS:
if re.search(pattern, line):
for allowed_string in PATTERNS[pattern]:
if allowed_string in line:
break
else:
ok = False
print("Bad line found in log:")
print(f" Line: {line}")
print(f" Pattern: {pattern}")
print(f" Allowed: {PATTERNS[pattern]}")
print()
if not ok:
raise SystemExit(1)
if __name__ == '__main__':
main()