summaryrefslogtreecommitdiffstats
path: root/scripts/test-fault.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/test-fault.sh')
-rwxr-xr-xscripts/test-fault.sh28
1 files changed, 23 insertions, 5 deletions
diff --git a/scripts/test-fault.sh b/scripts/test-fault.sh
index 49ba791..59f741f 100755
--- a/scripts/test-fault.sh
+++ b/scripts/test-fault.sh
@@ -52,12 +52,18 @@ echo "==> 2/5 deploy to ESP"
52mkdir -p "$ESP_DIR/EFI/BOOT" 52mkdir -p "$ESP_DIR/EFI/BOOT"
53cp target/x86_64-unknown-uefi/debug/rsdos.efi "$ESP_DIR/EFI/BOOT/BOOTX64.EFI" 53cp target/x86_64-unknown-uefi/debug/rsdos.efi "$ESP_DIR/EFI/BOOT/BOOTX64.EFI"
54 54
55echo "==> 3/5 boot QEMU (headless)" 55echo "==> 3/6 boot QEMU (headless, + dedicated CRASHLOG stick)"
56kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true 56kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true
57sleep 1 57sleep 1
58rm -f "$SOCK" "$LOG" 58rm -f "$SOCK" "$LOG"
59# A second FAT32 stick labeled CRASHLOG: crash reports must land here
60# (label-selected by the kernel), not on the boot device.
61CRASH_IMG=/tmp/rsdos-crash.img
62"$SCRIPT_DIR/mkdisk.sh" --fresh --label CRASHLOG --no-seed "$CRASH_IMG" >/dev/null
59"$QEMU" -bios "$OVMF" \ 63"$QEMU" -bios "$OVMF" \
60 -drive file=fat:rw:"$ESP_DIR",format=raw \ 64 -drive file=fat:rw:"$ESP_DIR",format=raw \
65 -drive file="$CRASH_IMG",format=raw,if=none,id=crash \
66 -device ide-hd,drive=crash,bus=ide.2 \
61 -serial file:"$LOG" \ 67 -serial file:"$LOG" \
62 -monitor unix:"$SOCK",server,nowait \ 68 -monitor unix:"$SOCK",server,nowait \
63 -m 256M -machine q35 -cpu qemu64 -no-reboot -display none \ 69 -m 256M -machine q35 -cpu qemu64 -no-reboot -display none \
@@ -66,11 +72,12 @@ echo $! >"$QPID"
66 72
67wait_log "$LOG" "boot: entering shell" 90 || fail "kernel never reached the shell" 73wait_log "$LOG" "boot: entering shell" 90 || fail "kernel never reached the shell"
68 74
69echo "==> 4/5 boot diagnostics present" 75echo "==> 4/6 boot diagnostics present"
70grep -aq "gop: fb base=" "$LOG" || fail "fb geometry diagnostic missing" 76grep -aq "gop: fb base=" "$LOG" || fail "fb geometry diagnostic missing"
71grep -aq "gop: mode .* selected" "$LOG" || fail "mode-selection diagnostic missing" 77grep -aq "gop: mode .* selected" "$LOG" || fail "mode-selection diagnostic missing"
78grep -aq "CRASHLOG" "$LOG" || fail "CRASHLOG stick not mounted"
72 79
73echo "==> 5/5 inject a page fault (fault command)" 80echo "==> 5/6 inject a page fault (fault command)"
74python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ 81python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \
75 "clear" \ 82 "clear" \
76 "fault" 83 "fault"
@@ -83,8 +90,19 @@ grep -aq "cr2=0x400000000000" "$LOG" || fail "CR2 not reported (faulting address
83grep -aq "task=0 \"shell\"" "$LOG" || fail "faulting task not identified" 90grep -aq "task=0 \"shell\"" "$LOG" || fail "faulting task not identified"
84grep -aq "!!! halting" "$LOG" || fail "no halt message" 91grep -aq "!!! halting" "$LOG" || fail "no halt message"
85 92
93echo "==> 6/6 crash.log persisted on the CRASHLOG stick"
94grep -aq "crashlog: vol .* (CRASHLOG)" "$LOG" || fail "crashlog did not target the CRASHLOG stick"
95grep -aq "crashlog: wrote" "$LOG" || fail "crashlog write did not complete"
96mdir -i "$CRASH_IMG" "::" 2>/dev/null | grep -aqi "crash" \
97 || fail "crash.log missing on the CRASHLOG stick"
98# The boot ESP must NOT receive the crash log.
99if [ -f "$ESP_DIR/crash.log" ]; then
100 fail "crash.log landed on the boot ESP instead of the CRASHLOG stick"
101fi
102
86# The screen dump itself is exercised in-kernel (dump_lines); the serial 103# The screen dump itself is exercised in-kernel (dump_lines); the serial
87# path sharing the same format line is verified above. 104# path sharing the same format line is verified above.
88echo "" 105echo ""
89echo "PASS — fault dump works (vec, err, rip, cr2, task → screen + serial)" 106echo "PASS — fault dump + crash.log on the CRASHLOG stick"
90echo " every CPU exception now halts with a diagnosable dump, not a freeze" 107echo " every CPU exception halts with a diagnosable dump; the report"
108echo " survives reboot on the dedicated CRASHLOG volume"