rust-kernel
Rustbelt: a hobby x86_64 kernel written in Rust
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #!/usr/bin/env bash
# Boot the normal (non-headless) kernel with no window, "type" some keys into
# it through the QEMU monitor's `sendkey` command, then dump the VGA screen to
# a PNG. Doubles as an automated keyboard + user-mode test: the default types
# a line (with a typo fixed by Backspace) and presses Enter; the `echo` user
# program reads it with read(0) and prints it back, all visible on serial.
#
# Usage: ./scripts/screenshot.sh [out.png] [text-to-type] [expected-result]
# In text-to-type, "<" means Backspace and "|" means Enter.
# Exits 1 if the expected text doesn't show up on serial.
# Force bootimage to repack the disk image (see scripts/runner.sh for why).
IMG=target/x86_64-rust_kernel/debug/bootimage-rust_kernel.bin
OUT=""
TEXT=""
EXPECT=""
SOCK=
SERIAL_LOG=
&
QPID=
# Talk to the QEMU monitor over its UNIX socket (python avoids needing socat).
||
; # cat -v shows Backspace as ^H
# Replay the serial output like a terminal would ("\b \b" = erase one
# character) and check the expected text is there.
if
then
else
fi
|