diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-01 19:52:05 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-01 19:52:05 +0200 |
| commit | 819778f292ee4e1294603b98662e083e49e23463 (patch) | |
| tree | 8df31b678432d2a89cac8e0d50f271a75a3882b5 /scripts | |
| parent | rsnix v0.4.0: GUI input foundation — PS/2 mouse + scheduler message queues (diff) | |
| download | rs-dos-819778f292ee4e1294603b98662e083e49e23463.tar.gz rs-dos-819778f292ee4e1294603b98662e083e49e23463.zip | |
rsnix v0.5.0: graphics layer + cursor compositor
The first visible GUI surface: real rect primitives, a single
shadow→display push path, and an on-screen mouse cursor that can
never race the text surface.
gop:
- fill_rect + push_rect(x,y,w,h): every raster op rasterises into the
RAM shadow, then push_rect copies the rect to the display (write-only,
still never read) and composites the cursor on top. blit_glyph and
scroll shifts now route through it.
- cursor overlay: 12x16 pointer (const-fn built from column lists) drawn
white with a black offset outline; position in one AtomicU64 (x:high
32, y:low 32) — unpack masks the low word (a bare 'as usize' cast is
a no-op on 64-bit). The cursor never enters the shadow, so erasing is
just a shadow push of the old rect.
- cursor_redraw after scroll shifts and once at spawn (the vt diff never
re-blits idle cells).
cursor task (task 2, spawned at boot when a mouse is present):
- owns the PS/2 ring; polls every 10 ms, moves the cursor (clamped),
tracks buttons, and forwards every event to a task's queue when
'mouse <id>' armed it (the window-manager input path).
- /dev/mouse is now a position device (x/y/buttons snapshot); 'mouse'
watches the cursor live (prints on change); 'cursor' prints one-shot
state; 'gfx' draws a status-bar demo; 'gfx check' is an in-kernel
pixel self-test (shadow readback, display readback, cursor overlay
purity) — PASS/FAIL per stage.
Tests (headless QEMU + monitor injection):
- make test-gfx (new): all four compositor checks PASS.
- make test-mouse (rewritten): cursor tracks mouse_move deltas, buttons
ride along, /dev/mouse snapshot, live watch, real-event queue routing.
- make test-msg: task numbering shifted (cursor is task 2; msgrecv is
task 3) — updated, still PASS.
- make test-disk regression re-passes. 0 build warnings.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/test-gfx.sh | 114 | ||||
| -rwxr-xr-x | scripts/test-mouse.sh | 125 | ||||
| -rwxr-xr-x | scripts/test-msg.sh | 37 |
3 files changed, 214 insertions, 62 deletions
diff --git a/scripts/test-gfx.sh b/scripts/test-gfx.sh new file mode 100755 index 0000000..a6e4016 --- /dev/null +++ b/scripts/test-gfx.sh | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | # | ||
| 3 | # scripts/test-gfx.sh — automated graphics-layer verification. | ||
| 4 | # | ||
| 5 | # The cursor overlay compositor is the core of the GUI path: the shadow | ||
| 6 | # holds true content, the display gets shadow pushes with the cursor | ||
| 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 | # | ||
| 13 | # Usage: ./scripts/test-gfx.sh | ||
| 14 | # Env: OVMF, QEMU (same defaults as other test scripts) | ||
| 15 | # | ||
| 16 | set -euo pipefail | ||
| 17 | |||
| 18 | SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| 19 | PROJECT_DIR="$(dirname "$SCRIPT_DIR")" | ||
| 20 | cd "$PROJECT_DIR" | ||
| 21 | |||
| 22 | OVMF="${OVMF:-/usr/share/edk2/x64/OVMF.4m.fd}" | ||
| 23 | QEMU="${QEMU:-qemu-system-x86_64}" | ||
| 24 | ESP_DIR="$PROJECT_DIR/esp" | ||
| 25 | QPID=/tmp/rsdos-gfx-qpid | ||
| 26 | SOCK=/tmp/rsdos-gfx-qmon.sock | ||
| 27 | LOG=/tmp/rsdos-gfx-serial.log | ||
| 28 | QLOG=/tmp/rsdos-gfx-qemu.log | ||
| 29 | |||
| 30 | trap 'kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true' EXIT | ||
| 31 | |||
| 32 | fail() { | ||
| 33 | echo "FAIL: $1" | ||
| 34 | [ -f "$LOG" ] && tail -40 "$LOG" | ||
| 35 | exit 1 | ||
| 36 | } | ||
| 37 | |||
| 38 | wait_log() { | ||
| 39 | local i=0 | ||
| 40 | while [ "$i" -lt $((${3:-60} * 10)) ]; do | ||
| 41 | grep -q "$2" "$1" 2>/dev/null && return 0 | ||
| 42 | sleep 0.1 | ||
| 43 | i=$((i + 1)) | ||
| 44 | done | ||
| 45 | return 1 | ||
| 46 | } | ||
| 47 | |||
| 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)" | ||
| 69 | cargo build --package rsdos --target x86_64-unknown-uefi | ||
| 70 | |||
| 71 | echo "==> 2/5 deploy to ESP" | ||
| 72 | mkdir -p "$ESP_DIR/EFI/BOOT" | ||
| 73 | cp target/x86_64-unknown-uefi/debug/rsdos.efi "$ESP_DIR/EFI/BOOT/BOOTX64.EFI" | ||
| 74 | |||
| 75 | echo "==> 3/5 boot QEMU (headless)" | ||
| 76 | kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true | ||
| 77 | sleep 1 | ||
| 78 | rm -f "$SOCK" "$LOG" | ||
| 79 | "$QEMU" -bios "$OVMF" \ | ||
| 80 | -drive file=fat:rw:"$ESP_DIR",format=raw \ | ||
| 81 | -serial file:"$LOG" \ | ||
| 82 | -monitor unix:"$SOCK",server,nowait \ | ||
| 83 | -m 256M -machine q35 -cpu qemu64 -no-reboot -display none \ | ||
| 84 | >"$QLOG" 2>&1 & | ||
| 85 | echo $! >"$QPID" | ||
| 86 | |||
| 87 | wait_log "$LOG" "boot: entering shell" 90 || fail "kernel never reached the shell" | ||
| 88 | grep -aq "cursor: task " "$LOG" || fail "cursor task did not spawn" | ||
| 89 | |||
| 90 | echo "==> 4/5 in-kernel pixel self-test (gfx check)" | ||
| 91 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ | ||
| 92 | "clear" \ | ||
| 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 | |||
| 104 | echo "==> 5/5 demo scene + poweroff" | ||
| 105 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ | ||
| 106 | "gfx" \ | ||
| 107 | "poweroff" | ||
| 108 | wait_qemu_exit 30 || fail "QEMU did not exit after poweroff" | ||
| 109 | |||
| 110 | grep -aq "gfx: drew status bar" "$LOG" || fail "gfx demo did not draw" | ||
| 111 | |||
| 112 | echo "" | ||
| 113 | echo "PASS — graphics layer OK (shadow, display push, cursor overlay)" | ||
| 114 | echo " compositor: shadow=content, display=push+cursor, cursor never in shadow" | ||
diff --git a/scripts/test-mouse.sh b/scripts/test-mouse.sh index ed4df44..e58d474 100755 --- a/scripts/test-mouse.sh +++ b/scripts/test-mouse.sh | |||
| @@ -1,20 +1,19 @@ | |||
| 1 | #!/usr/bin/env bash | 1 | #!/usr/bin/env bash |
| 2 | # | 2 | # |
| 3 | # scripts/test-mouse.sh — automated PS/2 mouse round trip. | 3 | # scripts/test-mouse.sh — automated mouse round trip (cursor model). |
| 4 | # | 4 | # |
| 5 | # Builds the kernel, boots QEMU headless, injects mouse movement and | 5 | # Since v0.5.0 the cursor task owns the PS/2 ring: mouse input shows up |
| 6 | # button presses through the monitor's `mouse_move` / `mouse_button` | 6 | # as *cursor position + buttons* on the screen, not as an event drain. |
| 7 | # commands, and verifies the guest decoded them via IRQ12 → ring → | 7 | # This script boots QEMU headless, injects movement/buttons via the |
| 8 | # packet decoder. Covers both surfaces: | 8 | # monitor, and verifies: |
| 9 | # - `cat /dev/mouse` (VFS snapshot of pending events) | 9 | # - the `cursor` command reports a position that moves with `mouse_move` |
| 10 | # - `mouse` (live streaming command, stopped by ^C) | 10 | # - button presses ride along (L while held) |
| 11 | # - `/dev/mouse` is a position device (one snapshot line) | ||
| 12 | # - the `mouse` watch command prints live changes and stops on ^C | ||
| 13 | # - a `mouse <id>` forward routes real events to a task's queue | ||
| 11 | # | 14 | # |
| 12 | # Usage: | 15 | # Usage: ./scripts/test-mouse.sh |
| 13 | # ./scripts/test-mouse.sh | 16 | # Env: OVMF, QEMU (same defaults as other test scripts) |
| 14 | # | ||
| 15 | # Environment: | ||
| 16 | # OVMF firmware (default: /usr/share/edk2/x64/OVMF.4m.fd) | ||
| 17 | # QEMU qemu binary (default: qemu-system-x86_64) | ||
| 18 | # | 17 | # |
| 19 | set -euo pipefail | 18 | set -euo pipefail |
| 20 | 19 | ||
| @@ -30,16 +29,14 @@ SOCK=/tmp/rsdos-mouse-qmon.sock | |||
| 30 | LOG=/tmp/rsdos-mouse-serial.log | 29 | LOG=/tmp/rsdos-mouse-serial.log |
| 31 | QLOG=/tmp/rsdos-mouse-qemu.log | 30 | QLOG=/tmp/rsdos-mouse-qemu.log |
| 32 | 31 | ||
| 33 | # Never leave a QEMU behind. | ||
| 34 | trap 'kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true' EXIT | 32 | trap 'kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true' EXIT |
| 35 | 33 | ||
| 36 | fail() { | 34 | fail() { |
| 37 | echo "FAIL: $1" | 35 | echo "FAIL: $1" |
| 38 | [ -f "$LOG" ] && tail -20 "$LOG" | 36 | [ -f "$LOG" ] && tail -30 "$LOG" |
| 39 | exit 1 | 37 | exit 1 |
| 40 | } | 38 | } |
| 41 | 39 | ||
| 42 | # wait_log FILE PATTERN TIMEOUT-SECONDS | ||
| 43 | wait_log() { | 40 | wait_log() { |
| 44 | local i=0 | 41 | local i=0 |
| 45 | while [ "$i" -lt $((${3:-60} * 10)) ]; do | 42 | while [ "$i" -lt $((${3:-60} * 10)) ]; do |
| @@ -50,7 +47,6 @@ wait_log() { | |||
| 50 | return 1 | 47 | return 1 |
| 51 | } | 48 | } |
| 52 | 49 | ||
| 53 | # wait_qemu_exit TIMEOUT-SECONDS | ||
| 54 | wait_qemu_exit() { | 50 | wait_qemu_exit() { |
| 55 | local i=0 | 51 | local i=0 |
| 56 | while [ "$i" -lt $((${1:-30} * 10)) ]; do | 52 | while [ "$i" -lt $((${1:-30} * 10)) ]; do |
| @@ -61,7 +57,6 @@ wait_qemu_exit() { | |||
| 61 | return 1 | 57 | return 1 |
| 62 | } | 58 | } |
| 63 | 59 | ||
| 64 | # qemu_hmp — send one raw HMP command to the monitor socket. | ||
| 65 | qemu_hmp() { | 60 | qemu_hmp() { |
| 66 | python3 - "$SOCK" "$1" <<'EOF' | 61 | python3 - "$SOCK" "$1" <<'EOF' |
| 67 | import socket, sys, time | 62 | import socket, sys, time |
| @@ -72,14 +67,21 @@ time.sleep(0.4) | |||
| 72 | EOF | 67 | EOF |
| 73 | } | 68 | } |
| 74 | 69 | ||
| 75 | echo "==> 1/5 build kernel (debug)" | 70 | # cursor_state — run `cursor`, return "x y buttons" of the LAST occurrence. |
| 71 | cursor_state() { | ||
| 72 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" "cursor" | ||
| 73 | sleep 0.5 | ||
| 74 | sed -n 's/.*cursor: x=\([0-9]*\) y=\([0-9]*\) buttons=\([A-Za-z-]*\).*/\1 \2 \3/p' "$LOG" | tail -1 | ||
| 75 | } | ||
| 76 | |||
| 77 | echo "==> 1/6 build kernel (debug)" | ||
| 76 | cargo build --package rsdos --target x86_64-unknown-uefi | 78 | cargo build --package rsdos --target x86_64-unknown-uefi |
| 77 | 79 | ||
| 78 | echo "==> 2/5 deploy to ESP" | 80 | echo "==> 2/6 deploy to ESP" |
| 79 | mkdir -p "$ESP_DIR/EFI/BOOT" | 81 | mkdir -p "$ESP_DIR/EFI/BOOT" |
| 80 | cp target/x86_64-unknown-uefi/debug/rsdos.efi "$ESP_DIR/EFI/BOOT/BOOTX64.EFI" | 82 | cp target/x86_64-unknown-uefi/debug/rsdos.efi "$ESP_DIR/EFI/BOOT/BOOTX64.EFI" |
| 81 | 83 | ||
| 82 | echo "==> 3/5 boot QEMU (headless)" | 84 | echo "==> 3/6 boot QEMU (headless)" |
| 83 | kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true | 85 | kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true |
| 84 | sleep 1 | 86 | sleep 1 |
| 85 | rm -f "$SOCK" "$LOG" | 87 | rm -f "$SOCK" "$LOG" |
| @@ -93,38 +95,73 @@ echo $! >"$QPID" | |||
| 93 | 95 | ||
| 94 | wait_log "$LOG" "boot: entering shell" 90 || fail "kernel never reached the shell" | 96 | wait_log "$LOG" "boot: entering shell" 90 || fail "kernel never reached the shell" |
| 95 | grep -aq "ps2: mouse ready" "$LOG" || fail "mouse driver did not come up at boot" | 97 | grep -aq "ps2: mouse ready" "$LOG" || fail "mouse driver did not come up at boot" |
| 98 | grep -aq "cursor: task " "$LOG" || fail "cursor task did not spawn" | ||
| 96 | 99 | ||
| 97 | # Seed a move *before* any consumer runs, so `cat /dev/mouse` has a | 100 | echo "==> 4/6 cursor position tracks injected movement" |
| 98 | # queued event to drain (exercises the VFS snapshot path). | 101 | INIT=$(cursor_state) |
| 99 | qemu_hmp "mouse_move 8 4" | 102 | [ -n "$INIT" ] || fail "no initial cursor position" |
| 100 | 103 | IX=$(echo "$INIT" | awk '{print $1}') | |
| 101 | echo "==> 4/5 drive the shell (cat /dev/mouse, mouse stream, poweroff)" | 104 | IY=$(echo "$INIT" | awk '{print $2}') |
| 102 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ | 105 | IB=$(echo "$INIT" | awk '{print $3}') |
| 103 | "cat /dev/mouse" \ | 106 | echo " initial: x=$IX y=$IY buttons=$IB" |
| 104 | "mouse" | 107 | [ "$IB" = "---" ] || fail "expected no buttons at boot, got $IB" |
| 105 | 108 | ||
| 106 | # While the `mouse` stream is live: a move, a left-press, a move with the | ||
| 107 | # button held, then release — the button state must ride along on the | ||
| 108 | # movement packet. | ||
| 109 | qemu_hmp "mouse_move 20 7" | 109 | qemu_hmp "mouse_move 20 7" |
| 110 | S1=$(cursor_state) | ||
| 111 | X1=$(echo "$S1" | awk '{print $1}') | ||
| 112 | Y1=$(echo "$S1" | awk '{print $2}') | ||
| 113 | [ "$X1" -eq $((IX + 20)) ] || fail "x did not move +20 (was $IX, now $X1)" | ||
| 114 | [ "$Y1" -eq $((IY + 7)) ] || fail "y did not move +7 (was $IY, now $Y1)" | ||
| 115 | |||
| 116 | echo "==> 5/6 buttons ride along; /dev/mouse is a position device" | ||
| 110 | qemu_hmp "mouse_button 1" | 117 | qemu_hmp "mouse_button 1" |
| 118 | S2=$(cursor_state) | ||
| 119 | B2=$(echo "$S2" | awk '{print $3}') | ||
| 120 | [ "$B2" = "L--" ] || fail "left press not seen (got $B2)" | ||
| 121 | |||
| 111 | qemu_hmp "mouse_move -5 -3" | 122 | qemu_hmp "mouse_move -5 -3" |
| 123 | S3=$(cursor_state) | ||
| 124 | X3=$(echo "$S3" | awk '{print $1}') | ||
| 125 | Y3=$(echo "$S3" | awk '{print $2}') | ||
| 126 | B3=$(echo "$S3" | awk '{print $3}') | ||
| 127 | [ "$X3" -eq $((X1 - 5)) ] || fail "held move x wrong ($X1 -5 = $((X1 - 5)), got $X3)" | ||
| 128 | [ "$Y3" -eq $((Y1 - 3)) ] || fail "held move y wrong ($Y1 -3 = $((Y1 - 3)), got $Y3)" | ||
| 129 | [ "$B3" = "L--" ] || fail "button state dropped during held move (got $B3)" | ||
| 130 | |||
| 112 | qemu_hmp "mouse_button 0" | 131 | qemu_hmp "mouse_button 0" |
| 113 | qemu_hmp "sendkey ctrl-c" | 132 | S4=$(cursor_state) |
| 133 | B4=$(echo "$S4" | awk '{print $3}') | ||
| 134 | [ "$B4" = "---" ] || fail "release not seen (got $B4)" | ||
| 135 | |||
| 136 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" "cat /dev/mouse" | ||
| 137 | sleep 0.5 | ||
| 138 | grep -aq "x=$X3 y=$Y3 buttons=---" "$LOG" || fail "/dev/mouse does not report position snapshot (x=$X3 y=$Y3)" | ||
| 139 | grep -aq "mouse: no events" "$LOG" && fail "/dev/mouse is still an event drain" | ||
| 114 | 140 | ||
| 141 | echo "==> 6/6 live watch + forwarding + poweroff" | ||
| 115 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ | 142 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ |
| 116 | "poweroff" | 143 | "msgrecv" \ |
| 144 | "mouse 3" | ||
| 117 | 145 | ||
| 118 | echo "==> 5/5 wait for shutdown + verify" | 146 | # Live watch running: a move must appear as a changed line. |
| 119 | wait_qemu_exit 30 || fail "QEMU did not exit after poweroff" | 147 | qemu_hmp "mouse_move 3 2" |
| 148 | # Forwarding live: the same move must reach the msgrecv task (spawned as | ||
| 149 | # task 3; task 2 is the cursor task itself). | ||
| 150 | sleep 1 | ||
| 151 | qemu_hmp "sendkey ctrl-c" | ||
| 152 | |||
| 153 | grep -aq "mouse: routing events to task 3" "$LOG" || fail "mouse 3 did not arm routing" | ||
| 154 | grep -aq "msgrecv\[3\]: Mouse(+" "$LOG" || fail "task 3 queue did not receive the routed Mouse event" | ||
| 155 | # Watch line: x/y/buttons format (any occurrence after watching started). | ||
| 156 | grep -aq "mouse: x=$((X3 + 3)) y=$((Y3 + 2)) buttons=---" "$LOG" || fail "watch did not print the moved cursor (x=$((X3+3)) y=$((Y3+2)))" | ||
| 157 | grep -aq "mouse: stopped" "$LOG" || fail "^C did not stop the mouse watch" | ||
| 120 | 158 | ||
| 121 | grep -aq "ps2: mouse ready (IRQ12, stream mode)" "$LOG" || fail "no mouse-ready boot line" | 159 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" "poweroff" |
| 122 | grep -aq "dx=+8 dy=+4 buttons=---" "$LOG" || fail "/dev/mouse did not drain the queued move (dx=+8 dy=+4)" | 160 | |
| 123 | grep -aq "dx=+20 dy=+7 buttons=---" "$LOG" || fail "mouse stream missed mouse_move 20 7" | 161 | echo "==> done: wait for shutdown + verify" |
| 124 | grep -aq "dx=+0 dy=+0 buttons=L--" "$LOG" || fail "left-button press did not decode" | 162 | wait_qemu_exit 30 || fail "QEMU did not exit after poweroff" |
| 125 | grep -aq "dx=-5 dy=-3 buttons=L--" "$LOG" || fail "held-button movement wrong (dx=-5 dy=-3 L)" | ||
| 126 | grep -aq "mouse: stopped" "$LOG" || fail "^C did not stop the mouse stream" | ||
| 127 | 163 | ||
| 128 | echo "" | 164 | echo "" |
| 129 | echo "PASS — PS/2 mouse round trip OK (IRQ12, /dev/mouse, live stream, buttons)" | 165 | echo "PASS — mouse round trip OK (cursor task, /dev/mouse, watch, forward)" |
| 130 | echo " events: 8,4 · 20,7 · L-press · -5,-3 held · release" | 166 | echo " moves: +20,+7 · -5,-3 held · +3,+2 watch" |
| 167 | echo " path: IRQ12 → ring → cursor task → overlay + queue" | ||
diff --git a/scripts/test-msg.sh b/scripts/test-msg.sh index 0bd1c81..d81d8d7 100755 --- a/scripts/test-msg.sh +++ b/scripts/test-msg.sh | |||
| @@ -93,20 +93,21 @@ echo $! >"$QPID" | |||
| 93 | wait_log "$LOG" "boot: entering shell" 90 || fail "kernel never reached the shell" | 93 | wait_log "$LOG" "boot: entering shell" 90 || fail "kernel never reached the shell" |
| 94 | 94 | ||
| 95 | echo "==> 4/5 drive the shell (msgrecv / send / mouse routing / queue-full)" | 95 | echo "==> 4/5 drive the shell (msgrecv / send / mouse routing / queue-full)" |
| 96 | # msgrecv spawns as task 3 (task 2 is the cursor task). | ||
| 96 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ | 97 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ |
| 97 | "msgrecv" \ | 98 | "msgrecv" \ |
| 98 | "send 2 user 42" \ | 99 | "send 3 user 42" \ |
| 99 | "send 2 timer" \ | 100 | "send 3 timer" \ |
| 100 | "send 2 key enter" \ | 101 | "send 3 key enter" \ |
| 101 | "send 2 key ctrl-c" \ | 102 | "send 3 key ctrl-c" \ |
| 102 | "send 2 key f3" \ | 103 | "send 3 key f3" \ |
| 103 | "send 2 mouse 5 -3 3" \ | 104 | "send 3 mouse 5 -3 3" \ |
| 104 | "sleep 800" \ | 105 | "sleep 800" \ |
| 105 | "jobs" | 106 | "jobs" |
| 106 | 107 | ||
| 107 | # Real IRQ12 events through the queue: start routing to task 2, inject | 108 | # Real IRQ12 events through the queue: start routing to task 3, inject |
| 108 | # moves + a left press, stop. | 109 | # moves + a left press, stop. |
| 109 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" "mouse 2" | 110 | python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" "mouse 3" |
| 110 | qemu_hmp "mouse_move 20 7" | 111 | qemu_hmp "mouse_move 20 7" |
| 111 | qemu_hmp "mouse_button 1" | 112 | qemu_hmp "mouse_button 1" |
| 112 | qemu_hmp "mouse_move -5 -3" | 113 | qemu_hmp "mouse_move -5 -3" |
| @@ -140,20 +141,20 @@ python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ | |||
| 140 | echo "==> 5/5 wait for shutdown + verify" | 141 | echo "==> 5/5 wait for shutdown + verify" |
| 141 | wait_qemu_exit 30 || fail "QEMU did not exit after poweroff" | 142 | wait_qemu_exit 30 || fail "QEMU did not exit after poweroff" |
| 142 | 143 | ||
| 143 | grep -aq "msgrecv: task 2 listening" "$LOG" || fail "msgrecv did not spawn" | 144 | grep -aq "msgrecv: task 3 listening" "$LOG" || fail "msgrecv did not spawn" |
| 144 | grep -aq "msgrecv\[2\]: User(42)" "$LOG" || fail "user message missing" | 145 | grep -aq "msgrecv\[3\]: User(42)" "$LOG" || fail "user message missing" |
| 145 | grep -aq "msgrecv\[2\]: Timer" "$LOG" || fail "timer message missing" | 146 | grep -aq "msgrecv\[3\]: Timer" "$LOG" || fail "timer message missing" |
| 146 | grep -aq "msgrecv\[2\]: Key(Enter)" "$LOG" || fail "key enter missing" | 147 | grep -aq "msgrecv\[3\]: Key(Enter)" "$LOG" || fail "key enter missing" |
| 147 | grep -aq "msgrecv\[2\]: Key(Ctrl-c)" "$LOG" || fail "key ctrl-c missing" | 148 | grep -aq "msgrecv\[3\]: Key(Ctrl-c)" "$LOG" || fail "key ctrl-c missing" |
| 148 | grep -aq "msgrecv\[2\]: Key(F3)" "$LOG" || fail "key f3 missing" | 149 | grep -aq "msgrecv\[3\]: Key(F3)" "$LOG" || fail "key f3 missing" |
| 149 | grep -aq "msgrecv\[2\]: Mouse(+5,-3 L R)" "$LOG" || fail "synthesized mouse message missing" | 150 | grep -aq "msgrecv\[3\]: Mouse(+5,-3 L R)" "$LOG" || fail "synthesized mouse message missing" |
| 150 | # Real IRQ12 events routed through the queue (button held across the move). | 151 | # Real IRQ12 events routed through the queue (button held across the move). |
| 151 | grep -aq "msgrecv\[2\]: Mouse(+20,+7" "$LOG" || fail "real mouse move 20,7 not routed to queue" | 152 | grep -aq "msgrecv\[3\]: Mouse(+20,+7" "$LOG" || fail "real mouse move 20,7 not routed to queue" |
| 152 | grep -aq "msgrecv\[2\]: Mouse(-5,-3 L" "$LOG" || fail "held-button routed move missing" | 153 | grep -aq "msgrecv\[3\]: Mouse(-5,-3 L" "$LOG" || fail "held-button routed move missing" |
| 153 | grep -aq "queue full" "$LOG" || fail "17th send did not report queue full" | 154 | grep -aq "queue full" "$LOG" || fail "17th send did not report queue full" |
| 154 | grep -aq "send: unknown type" "$LOG" && fail "a bad send slipped through (expected none)" | 155 | grep -aq "send: unknown type" "$LOG" && fail "a bad send slipped through (expected none)" |
| 155 | 156 | ||
| 156 | echo "" | 157 | echo "" |
| 157 | echo "PASS — message queues OK (all types, ordering, real-input routing, queue-full)" | 158 | echo "PASS — message queues OK (all types, ordering, real-input routing, queue-full)" |
| 158 | echo " sent: user · timer · key(enter,ctrl-c,f3) · mouse · 16+1 queue-full" | 159 | echo " sent: user · timer · key(enter,ctrl-c,f3) · mouse · 16+1 queue-full" |
| 159 | echo " routed: mouse_move 20,7 → queue → msgrecv[2]" | 160 | echo " routed: mouse_move 20,7 → queue → msgrecv[3]" |
