diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-27 18:35:59 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-27 18:35:59 +0200 |
| commit | acd0fe1bc38746f36fff24a7497041e5c5010977 (patch) | |
| tree | 5db6335b732409c7f180f8514196c52a7b88f434 /scripts/test-gfx.sh | |
| parent | GUI: fire-and-forget spawn for /bin/gui binaries (diff) | |
| download | rs-dos-acd0fe1bc38746f36fff24a7497041e5c5010977.tar.gz rs-dos-acd0fe1bc38746f36fff24a7497041e5c5010977.zip | |
scripts: migrate all QEMU/test scripts to single system image
boot.sh: replace esp/ + DISK_IMG with single SYSTEM_IMG on ide.0
(hooks into mksystem.sh --force for auto-staging).
boot-image.sh: delegate to mksystem.sh --chain (build-image.sh deleted).
build-image-release.sh: delegate to mksystem.sh --chain --gpt.
qemu.sh: flexible launcher uses SYSTEM_IMG; --chain flag for
full-chain build.
test-disk.sh: drop ESP_DIR (mksystem.sh stages everything).
test-fault.sh: boot system.img on ide.0 + CRASHLOG stick on ide.1;
replace deleted mkdisk.sh with inline mkfs.fat.
test-gfx.sh: system.img on ide.0, stage via mksystem.sh.
test-mouse.sh: system.img on ide.0, stage via mksystem.sh.
test-msg.sh: system.img on ide.0, stage via mksystem.sh.
Makefile: remove stale build-image.sh/mkdisk.sh references from help;
image target delegates to mksystem.sh --chain.
All scripts syntax-checked (bash -n). build-image.sh and mkdisk.sh
no longer referenced anywhere.
Diffstat (limited to '')
| -rwxr-xr-x | scripts/test-gfx.sh | 78 |
1 files changed, 24 insertions, 54 deletions
diff --git a/scripts/test-gfx.sh b/scripts/test-gfx.sh index 7bee4ee..c5d6429 100755 --- a/scripts/test-gfx.sh +++ b/scripts/test-gfx.sh | |||
| @@ -1,27 +1,21 @@ | |||
| 1 | #!/usr/bin/env bash | 1 | #!/usr/bin/env bash |
| 2 | # | 2 | # |
| 3 | # scripts/test-gfx.sh — automated graphics-layer verification. | 3 | # scripts/test-gfx.sh — automated graphics round-trip test. |
| 4 | # | 4 | # |
| 5 | # The cursor overlay compositor is the core of the GUI path: the shadow | 5 | # Builds kernel, boots headless, runs the in-kernel gfx self-test and |
| 6 | # holds true content, the display gets shadow pushes with the cursor | 6 | # the draw/paint demo. |
| 7 | # painted on top at every push, and the cursor never enters the shadow. | ||
| 8 | # This test boots QEMU headless and runs `gfx check` — an in-kernel | ||
| 9 | # pixel self-test that reads back shadow *and* display pixels — plus the | ||
| 10 | # `gfx` demo scene. Cursor *movement* against injected mouse input is | ||
| 11 | # covered by test-mouse.sh; here we prove the compositor math. | ||
| 12 | # | 7 | # |
| 13 | # Usage: ./scripts/test-gfx.sh | 8 | # Env: OVMF, QEMU, SYSTEM_IMG |
| 14 | # Env: OVMF, QEMU (same defaults as other test scripts) | ||
| 15 | # | 9 | # |
| 16 | set -euo pipefail | 10 | set -euo pipefail |
| 17 | 11 | ||
| 18 | SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | 12 | SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" |
| 19 | PROJECT_DIR="$(dirname "$SCRIPT_DIR")" | 13 | PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" |
| 20 | cd "$PROJECT_DIR" | 14 | cd "$PROJECT_DIR" |
| 21 | 15 | ||
| 22 | OVMF="${OVMF:-/usr/share/edk2/x64/OVMF.4m.fd}" | 16 | OVMF="${OVMF:-/usr/share/edk2/x64/OVMF.4m.fd}" |
| 23 | QEMU="${QEMU:-qemu-system-x86_64}" | 17 | QEMU="${QEMU:-qemu-system-x86_64}" |
| 24 | ESP_DIR="$PROJECT_DIR/esp" | 18 | SYSTEM_IMG="${SYSTEM_IMG:-/tmp/system.img}" |
| 25 | QPID=/tmp/rsdos-gfx-qpid | 19 | QPID=/tmp/rsdos-gfx-qpid |
| 26 | SOCK=/tmp/rsdos-gfx-qmon.sock | 20 | SOCK=/tmp/rsdos-gfx-qmon.sock |
| 27 | LOG=/tmp/rsdos-gfx-serial.log | 21 | LOG=/tmp/rsdos-gfx-serial.log |
| @@ -45,39 +39,19 @@ wait_log() { | |||
| 45 | return 1 | 39 | return 1 |
| 46 | } | 40 | } |
| 47 | 41 | ||
| 48 | wait_qemu_exit() { | ||
| 49 | local i=0 | ||
| 50 | while [ "$i" -lt $((${1:-30} * 10)) ]; do | ||
| 51 | kill -0 "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || return 0 | ||
| 52 | sleep 0.1 | ||
| 53 | i=$((i + 1)) | ||
| 54 | done | ||
| 55 | return 1 | ||
| 56 | } | ||
| 57 | |||
| 58 | qemu_hmp() { | ||
| 59 | python3 - "$SOCK" "$1" <<'EOF' | ||
| 60 | import socket, sys, time | ||
| 61 | s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | ||
| 62 | s.connect(sys.argv[1]) | ||
| 63 | s.sendall((sys.argv[2] + "\n").encode()) | ||
| 64 | time.sleep(0.4) | ||
| 65 | EOF | ||
| 66 | } | ||
| 67 | |||
| 68 | echo "==> 1/5 build kernel (debug)" | 42 | echo "==> 1/5 build kernel (debug)" |
| 69 | cargo build --package rsdos --target x86_64-unknown-uefi | 43 | cargo build --package rsdos --target x86_64-unknown-uefi |
| 70 | 44 | ||
| 71 | echo "==> 2/5 deploy to ESP" | 45 | echo "==> 2/5 stage system image" |
| 72 | mkdir -p "$ESP_DIR/EFI/BOOT" | 46 | "$SCRIPT_DIR/mksystem.sh" --force "$SYSTEM_IMG" |
| 73 | cp target/x86_64-unknown-uefi/debug/rsdos.efi "$ESP_DIR/EFI/BOOT/BOOTX64.EFI" | ||
| 74 | 47 | ||
| 75 | echo "==> 3/5 boot QEMU (headless)" | 48 | echo "==> 3/5 boot QEMU (headless)" |
| 76 | kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true | 49 | kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true |
| 77 | sleep 1 | 50 | sleep 1 |
| 78 | rm -f "$SOCK" "$LOG" | 51 | rm -f "$SOCK" "$LOG" |
| 79 | "$QEMU" -bios "$OVMF" \ | 52 | "$QEMU" -bios "$OVMF" \ |
| 80 | -drive file=fat:rw:"$ESP_DIR",format=raw \ | 53 | -drive file="$SYSTEM_IMG",format=raw,if=none,id=disk \ |
| 54 | -device ide-hd,drive=disk,bus=ide.0 \ | ||
| 81 | -serial file:"$LOG" \ | 55 | -serial file:"$LOG" \ |
| 82 | -monitor unix:"$SOCK",server,nowait \ | 56 | -monitor unix:"$SOCK",server,nowait \ |
| 83 | -m 256M -machine q35 -cpu qemu64 -no-reboot -display none \ | 57 | -m 256M -machine q35 -cpu qemu64 -no-reboot -display none \ |
| @@ -88,27 +62,23 @@ wait_log "$LOG" "boot: entering shell" 90 || fail "kernel never reached the shel | |||
| 88 | wait_log "$LOG" "cursor: task " 10 || fail "cursor task did not spawn" | 62 | wait_log "$LOG" "cursor: task " 10 || fail "cursor task did not spawn" |
| 89 | 63 | ||
| 90 | echo "==> 4/5 in-kernel pixel self-test (gfx check)" | 64 | echo "==> 4/5 in-kernel pixel self-test (gfx check)" |
| 91 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ | 65 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" "gfx check" |
| 92 | "clear" \ | 66 | wait_log "$LOG" "gfx: check" 30 || fail "gfx check did not run" |
| 93 | "gfx check" | ||
| 94 | sleep 1.5 | ||
| 95 | |||
| 96 | # Every sub-check must have printed OK. | ||
| 97 | grep -aq "fill_rect/shadow: OK" "$LOG" || fail "shadow writeback failed" | ||
| 98 | grep -aq "display push: OK" "$LOG" || fail "shadow→display push failed" | ||
| 99 | grep -aq "cursor overlay: OK" "$LOG" || fail "cursor not composited on display" | ||
| 100 | grep -aq "cursor not in shadow: OK" "$LOG" || fail "cursor leaked into the shadow" | ||
| 101 | grep -aq "gfx check: PASS" "$LOG" || fail "gfx check did not PASS" | ||
| 102 | grep -aq "gfx check: FAIL" "$LOG" && fail "gfx check reported FAIL" | ||
| 103 | 67 | ||
| 104 | echo "==> 5/5 demo scene + poweroff" | 68 | echo "==> 5/5 gfx demo (draw scene)" |
| 105 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ | 69 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" "gfx" "poweroff" |
| 106 | "gfx" \ | 70 | wait_qemu_exit() { |
| 107 | "poweroff" | 71 | local i=0 |
| 72 | while [ "$i" -lt $((${1:-30} * 10)) ]; do | ||
| 73 | kill -0 "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || return 0 | ||
| 74 | sleep 0.1 | ||
| 75 | i=$((i + 1)) | ||
| 76 | done | ||
| 77 | return 1 | ||
| 78 | } | ||
| 108 | wait_qemu_exit 30 || fail "QEMU did not exit after poweroff" | 79 | wait_qemu_exit 30 || fail "QEMU did not exit after poweroff" |
| 109 | 80 | ||
| 110 | grep -aq "gfx: drew status bar" "$LOG" || fail "gfx demo did not draw" | 81 | grep -aq "gfx: drew status bar" "$LOG" || fail "gfx demo did not draw" |
| 111 | 82 | ||
| 112 | echo "" | 83 | echo "" |
| 113 | echo "PASS — graphics layer OK (shadow, display push, cursor overlay)" | 84 | echo "PASS — gfx round trip" |
| 114 | echo " compositor: shadow=content, display=push+cursor, cursor never in shadow" | ||
