Skip to content

Commit 7933214

Browse files
committed
Re-add the test that check panics
1 parent 157405b commit 7933214

File tree

2 files changed

+64
-22
lines changed

2 files changed

+64
-22
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -233,28 +233,7 @@ jobs:
233233
234234
- run: grep '] ok 2 rust_doctests_kernel$' qemu-stdout
235235

236-
# - run: |
237-
# grep -i '\bpanic\b' qemu-stdout && exit 1
238-
# grep -i '\boops\b' qemu-stdout && exit 1
239-
# grep -i '\btaint\b' qemu-stdout && exit 1
240-
# grep -i '\bfault\b' qemu-stdout && exit 1
241-
# grep -i '\btrace\b' qemu-stdout && exit 1
242-
# grep -i '\bcorrupted\b' qemu-stdout && exit 1
243-
244-
# grep -i '\bbug\b' qemu-stdout |
245-
# grep -Fv '" and report a bug' &&
246-
# exit 1
247-
248-
# grep -i '\berror\b' qemu-stdout |
249-
# grep -Fv 'message (level 3)' |
250-
# grep -Fv 'regulatory.db' &&
251-
# exit 1
252-
253-
# grep -i '\bwarning\b' qemu-stdout |
254-
# grep -Fv 'message (level 4)' &&
255-
# exit 1
256-
257-
# exit 0
236+
- run: python check_panics.py qemu-stdout
258237

259238
# Re-build with Clippy.
260239
- run: make -C linux ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_KRUSTFLAGS }} ${{ env.JOBS }} CLIPPY=1

check_panics.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env python3
2+
3+
import re
4+
import sys
5+
6+
PATTERNS = {
7+
b"No such file or directory": [],
8+
rb"\bpanic\b": [],
9+
rb"\bpanics\b": [],
10+
rb"\boops\b": [],
11+
rb"\boopses\b": [],
12+
rb"\btaint\b": [],
13+
rb"\btaints\b": [
14+
b"rust_out_of_tree: loading out-of-tree module taints kernel."
15+
],
16+
rb"\bfault\b": [],
17+
rb"\bfaults\b": [],
18+
rb"\bcorrupted\b": [],
19+
rb"\btrace\b": [
20+
b"] RCU Tasks Trace:",
21+
b"] trace event string verifier disabled",
22+
b".pcie: probe with driver pci-host-generic failed with error -16"
23+
],
24+
rb"\btraces\b": [],
25+
rb"\bbug\b": [
26+
b" and report a bug"
27+
],
28+
rb"\bbugs\b": [],
29+
rb"\berror\b": [
30+
b"message (level 3)",
31+
b"regulatory.db",
32+
b".pcie: probe with driver pci-host-generic failed with error -16",
33+
b"rust/kernel/error.rs",
34+
],
35+
rb"\berrors\b": [],
36+
rb"\bwarning\b": [
37+
b"message (level 4)"
38+
],
39+
rb"\bwarnings\b": [],
40+
}
41+
42+
def main():
43+
ok = True
44+
with open(sys.argv[1], "rb") as file:
45+
for line in file:
46+
for pattern in PATTERNS:
47+
if re.search(pattern, line):
48+
for allowed_string in PATTERNS[pattern]:
49+
if allowed_string in line:
50+
break
51+
else:
52+
ok = False
53+
print("Bad line found in log:")
54+
print(f" Line: {line}")
55+
print(f" Pattern: {pattern}")
56+
print(f" Allowed: {PATTERNS[pattern]}")
57+
print()
58+
59+
if not ok:
60+
raise SystemExit(1)
61+
62+
if __name__ == '__main__':
63+
main()

0 commit comments

Comments
 (0)