ci / test (pull_request) Successful in 24s
ci / mcdc (pull_request) Successful in 17s
ci / badges (push) Skipped
ci / test (push) Successful in 9s
ci / qemu-tools (push) Successful in 1m27s
ci / bench (pull_request) Successful in 5s
ci / mcdc (push) Successful in 12s
ci / bench (push) Successful in 5s
ci / prune-artifacts (push) Skipped
ci / kernel-build (push) Skipped
ci / patches-apply (push) Successful in 43s
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / patches-apply (pull_request) Successful in 24s
ci / quality (pull_request) Successful in 2m35s
ci / kernel-symbols (pull_request) Successful in 5m7s
ci / quality (push) Successful in 1m28s
ci / qemu-tools (pull_request) Successful in 1m36s
ci / badges (pull_request) Skipped
ci / kernel-symbols (push) Successful in 5m2s
ui-drive.sh --init-chain boots with warden.initchain, where sbin/init starts the UI through the panel's S99lvgl and prints "init: chain started N script(s)"; the direct-start line "init: starting warden-ui" is never printed. ui-drive.sh still waited for that line, so the first flare-edge "QEMU UI shipped init chain" run (job 99350) gave "warden-ui never started" after 180 s on a chain that had booted cleanly. The wait moves to qemu/tests/ui-start.sh (sourced by ui-drive.sh and ui-shot.sh): wait_ui_started picks the marker by mode and, on a chain boot, fails at once on WARDEN-QEMU-INITCHAIN-EMPTY or a failed S99lvgl instead of at the deadline. Tests: new qemu/tests/ui-start-test.sh (27 checks, in CI): every marker is the one sbin/init or warden-lib.sh prints in that mode, the job 99350 console counts as started in chain mode, empty and failed chains fail fast, a dead VM and a silent console fail with their own messages, and both drivers wait through the helper. The old ui-drive.sh fails 4 checks. Fixes flare-edge#2295 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
62 lines
2.6 KiB
Bash
62 lines
2.6 KiB
Bash
# shellcheck shell=bash
|
|
# Sourced by ui-drive.sh and ui-shot.sh: wait for stage-2 init to report the
|
|
# UI started, from the VM console log.
|
|
#
|
|
# The console line depends on how the UI is started (rootfs/sbin/init):
|
|
# direct start (default) "init: starting warden-ui (fbdev)"
|
|
# shipped chain (warden.initchain, ui-drive.sh --init-chain)
|
|
# "init: chain started N script(s)", after
|
|
# the panel's S99lvgl ran; the direct start
|
|
# line is never printed (flare-edge#2295)
|
|
# A chain boot that cannot start the UI says so at once, so these fail fast
|
|
# instead of spending the whole deadline:
|
|
# "WARDEN-QEMU-INITCHAIN-EMPTY" no /etc/init.d/S* script at all
|
|
# "init: chain S99lvgl start FAILED rc=N" the UI's own script failed
|
|
# qemu/tests/ui-start-test.sh checks every marker here against sbin/init.
|
|
|
|
UI_START_DIRECT='init: starting warden-ui'
|
|
UI_START_CHAIN='init: chain started '
|
|
UI_FAIL_CHAIN_EMPTY='WARDEN-QEMU-INITCHAIN-EMPTY'
|
|
UI_FAIL_CHAIN_LVGL='init: chain S99lvgl start FAILED'
|
|
|
|
# ui_start_marker <initchain 0|1>: the console line that means "UI started".
|
|
ui_start_marker() {
|
|
if [ "${1:-0}" = 1 ]; then printf '%s' "$UI_START_CHAIN"; else printf '%s' "$UI_START_DIRECT"; fi
|
|
}
|
|
|
|
# wait_ui_started <console.log> <qemu pid> <seconds> <initchain 0|1>
|
|
# Returns 0 once the UI is reported started; prints a FATAL line and the
|
|
# console tail to stderr and returns 1 on a VM exit, a chain failure or the
|
|
# deadline.
|
|
wait_ui_started() {
|
|
local log="$1" pid="$2" secs="$3" chain="${4:-0}" marker deadline
|
|
marker="$(ui_start_marker "$chain")"
|
|
deadline=$((SECONDS + secs))
|
|
while :; do
|
|
grep -aqF "$marker" "$log" && return 0
|
|
if [ "$chain" = 1 ]; then
|
|
if grep -aqF "$UI_FAIL_CHAIN_EMPTY" "$log"; then
|
|
echo "FATAL: the init chain has no /etc/init.d/S* script, so warden-ui is not started" >&2
|
|
tail -25 "$log" >&2
|
|
return 1
|
|
fi
|
|
if grep -aqF "$UI_FAIL_CHAIN_LVGL" "$log"; then
|
|
echo "FATAL: S99lvgl failed in the shipped init chain: $(grep -aF "$UI_FAIL_CHAIN_LVGL" "$log" | head -1)" >&2
|
|
tail -25 "$log" >&2
|
|
return 1
|
|
fi
|
|
fi
|
|
kill -0 "$pid" 2>/dev/null || { echo "FATAL: VM exited early" >&2; tail -25 "$log" >&2; return 1; }
|
|
[ $SECONDS -lt $deadline ] || break
|
|
sleep "${UI_START_POLL:-2}"
|
|
done
|
|
grep -aqF "$marker" "$log" && return 0
|
|
if [ "$chain" = 1 ]; then
|
|
echo "FATAL: the shipped init chain never reported its start ('$marker' not on the console)" >&2
|
|
else
|
|
echo "FATAL: warden-ui never started (no fb0? wrong kernel?)" >&2
|
|
fi
|
|
tail -25 "$log" >&2
|
|
return 1
|
|
}
|