mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 19:52:22 +00:00
feat(hack): add scripts to drive the dev environment headless
Start QEMU in the background with a QMP socket and console logs, take screenshots, press keys and wait for serial output, so the graphical boot menu can be driven without a terminal or a window. boot.sh gets opt-in knobs for this and behaves as before otherwise.
This commit is contained in:
1 parent
4e10d57143
commit
c6524b7bed
12 files changed
+342
-2
No files matched your search
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
# Waits for a regex to show up on the firmware or Linux console. Exits 1 on timeout or if QEMU exits.
|
||||
# Usage: wait-serial.sh <regex> [timeout-seconds]
|
||||
set -e
|
||||
|
||||
cd "$(dirname "${0}")/../../.." || exit 1
|
||||
|
||||
. "hack/dev/run/lib.sh"
|
||||
|
||||
[ -n "${1}" ] || die "usage: wait-serial.sh <regex> [timeout-seconds]"
|
||||
|
||||
DEADLINE=$(($(date +%s) + ${2:-60}))
|
||||
while :; do
|
||||
if cat "${SERIAL_LOG}" "${CONSOLE_LOG}" 2>/dev/null | grep -aEq -- "${1}"; then
|
||||
exit 0
|
||||
fi
|
||||
if ! is_running; then
|
||||
echo "QEMU exited while waiting for: ${1}" >/dev/stderr
|
||||
break
|
||||
fi
|
||||
if [ "$(date +%s)" -ge "${DEADLINE}" ]; then
|
||||
echo "timed out waiting for: ${1}" >/dev/stderr
|
||||
break
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
tail -n 15 "${SERIAL_LOG}" "${CONSOLE_LOG}" 2>/dev/null >/dev/stderr || true
|
||||
exit 1
|
||||
Reference in new issue
Block a user