Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 8 additions & 23 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ jobs:

git clone --depth 1 https://github.com/rust-lang/rustc_codegen_gcc

# Since we use rustc_codegen_gcc from the master branch of the repo, but don't use y.sh in make to build using rustc_codegen_gcc,
# we need to override the rust version.
rust_version=$(grep channel rustc_codegen_gcc/rust-toolchain | cut -f3 -d' ' | sed 's/"//g')
rustup override set $rust_version
rustup component add clippy rustfmt

echo "MAKE_KRUSTFLAGS=KRUSTFLAGS=-Zcodegen-backend=$(pwd)/rustc_codegen_gcc/target/release/librustc_codegen_gcc.so" >> $GITHUB_ENV


Expand Down Expand Up @@ -225,30 +231,9 @@ jobs:
grep '] rust_print: Info message (level 6) with args$' qemu-stdout
grep '] rust_print: A line that is continued with args$' qemu-stdout

- run: grep '] ok 1 rust_doctests_kernel$' qemu-stdout
- run: grep '] ok 2 rust_doctests_kernel$' qemu-stdout

- run: |
grep -i '\bpanic\b' qemu-stdout && exit 1
grep -i '\boops\b' qemu-stdout && exit 1
grep -i '\btaint\b' qemu-stdout && exit 1
grep -i '\bfault\b' qemu-stdout && exit 1
grep -i '\btrace\b' qemu-stdout && exit 1
grep -i '\bcorrupted\b' qemu-stdout && exit 1

grep -i '\bbug\b' qemu-stdout |
grep -Fv '" and report a bug' &&
exit 1

grep -i '\berror\b' qemu-stdout |
grep -Fv 'message (level 3)' |
grep -Fv 'regulatory.db' &&
exit 1

grep -i '\bwarning\b' qemu-stdout |
grep -Fv 'message (level 4)' &&
exit 1

exit 0
- run: python ci/check_panics.py qemu-stdout

# Re-build with Clippy.
- run: make -C linux ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_KRUSTFLAGS }} ${{ env.JOBS }} CLIPPY=1
Expand Down
63 changes: 63 additions & 0 deletions check_panics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,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()
3 changes: 0 additions & 3 deletions rfl-debug.config
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
CONFIG_RUST_DEBUG_ASSERTIONS=y

CONFIG_KUNIT=y
CONFIG_RUST_KERNEL_DOCTESTS=y
3 changes: 3 additions & 0 deletions rfl-rust.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ CONFIG_SAMPLE_RUST_HOSTPROGS=y
RUST_PHYLIB_ABSTRACTIONS=y
AX88796B_PHY=y
AX88796B_RUST_PHY=y

CONFIG_KUNIT=y
CONFIG_RUST_KERNEL_DOCTESTS=y