6dab9b2953
Convert the remaining expect-based test scripts (phase1-6 runtime, usb,
wifi, bluetooth, dbus, greeter, live-iso, posix) to the stdlib python
harness, completing the migration started in 9ec00d4c81. Each script now
prefers booting the live ISO when present (falling back to harddrive.img
with snapshot=on), and retries up to 5 times when QEMU exits early or is
killed (rc 3 / 137) — the host-contention failure mode recorded in the
2026-07-20 runtime-proof status.
qemu-login-expect.py: treat an incomplete step sequence as a failure even
when a pass marker was seen partway through — partial sequences must not
count as a pass.
191 lines
7.1 KiB
Bash
191 lines
7.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Launch the Phase 4 Wayland validation path in QEMU using the repo's Wayland profile.
|
|
# This script validates the current bounded software-path Wayland runtime slice.
|
|
# It is a bounded validation harness, not the production desktop path.
|
|
# It does NOT currently prove a hardware-accelerated desktop path in QEMU.
|
|
|
|
set -euo pipefail
|
|
|
|
find_uefi_firmware() {
|
|
local candidates=(
|
|
"/usr/share/ovmf/x64/OVMF.4m.fd"
|
|
"/usr/share/OVMF/x64/OVMF.4m.fd"
|
|
"/usr/share/ovmf/x64/OVMF_CODE.4m.fd"
|
|
"/usr/share/OVMF/x64/OVMF_CODE.4m.fd"
|
|
"/usr/share/ovmf/OVMF.fd"
|
|
"/usr/share/OVMF/OVMF_CODE.fd"
|
|
"/usr/share/qemu/edk2-x86_64-code.fd"
|
|
)
|
|
local path
|
|
for path in "${candidates[@]}"; do
|
|
if [[ -f "$path" ]]; then
|
|
printf '%s\n' "$path"
|
|
return 0
|
|
fi
|
|
done
|
|
return 1
|
|
}
|
|
|
|
usage() {
|
|
cat <<'USAGE'
|
|
Usage: test-phase4-wayland-qemu.sh [--check] [extra qemu args...]
|
|
|
|
Boot the repo's full desktop target in QEMU with a VirtIO NIC using UEFI firmware.
|
|
|
|
Examples:
|
|
./local/scripts/test-phase4-wayland-qemu.sh
|
|
./local/scripts/test-phase4-wayland-qemu.sh --check
|
|
./local/scripts/test-phase4-wayland-qemu.sh -m 4G
|
|
|
|
Expected validation path:
|
|
display session -> validation launcher -> compositor -> wayland-session
|
|
|
|
Important:
|
|
the current harness uses QEMU virtio-gpu for the bounded software-path desktop slice.
|
|
Treat this as a Phase 4 software-path/runtime smoke check and regression harness.
|
|
Hardware-accelerated desktop proof is a separate bare-metal/runtime-driver milestone.
|
|
USAGE
|
|
}
|
|
|
|
check_mode=0
|
|
filtered_args=()
|
|
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--help|-h|help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
--check)
|
|
check_mode=1
|
|
;;
|
|
*)
|
|
filtered_args+=("$arg")
|
|
;;
|
|
esac
|
|
done
|
|
|
|
firmware="$(find_uefi_firmware)" || {
|
|
echo "ERROR: no usable x86_64 UEFI firmware found" >&2
|
|
exit 1
|
|
}
|
|
|
|
extra_qemu_args="${filtered_args[*]:-}"
|
|
if [[ -n "${QEMUFLAGS:-}" ]]; then
|
|
QEMUFLAGS="${QEMUFLAGS} ${extra_qemu_args}"
|
|
else
|
|
QEMUFLAGS="${extra_qemu_args}"
|
|
fi
|
|
|
|
arch="${ARCH:-$(uname -m)}"
|
|
image="build/$arch/redbear-full/harddrive.img"
|
|
iso="build/$arch/redbear-full.iso"
|
|
extra="build/$arch/redbear-full/extra.img"
|
|
|
|
boot_media=""
|
|
if [[ -f "$iso" ]]; then
|
|
boot_media="iso"
|
|
elif [[ -f "$image" ]]; then
|
|
boot_media="harddrive"
|
|
else
|
|
echo "ERROR: no bootable image found ($iso or $image)" >&2
|
|
echo "Build it first with: ./local/scripts/build-redbear.sh redbear-full" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "$boot_media" == "iso" ]]; then
|
|
boot_args=(-cdrom "$iso")
|
|
else
|
|
boot_args=(-drive file="$image",format=raw,if=none,id=drv0,snapshot=on -device nvme,drive=drv0,serial=NVME_SERIAL)
|
|
fi
|
|
|
|
if [[ ! -f "$extra" ]]; then
|
|
truncate -s 1g "$extra"
|
|
fi
|
|
|
|
echo "=== Red Bear OS Phase 4 Wayland QEMU Launch ==="
|
|
echo "Config: redbear-full"
|
|
echo "Image: $image"
|
|
echo "UEFI: $firmware"
|
|
echo
|
|
echo "Suggested in-guest checks:"
|
|
echo " redbear-info --json"
|
|
echo " netctl status"
|
|
echo " redbear-phase4-wayland-check"
|
|
echo " the validation compositor should own the bounded runtime path"
|
|
echo " qt6-wayland-smoke should leave a success marker via wayland-session"
|
|
echo " active desktop direction is redbear-full -> kwin_wayland"
|
|
echo
|
|
|
|
if [[ "$check_mode" -eq 1 ]]; then
|
|
log="build/$arch/redbear-full/phase4-wayland-check.log"
|
|
attempt=1
|
|
while true; do
|
|
rc=0
|
|
python3 local/scripts/qemu-login-expect.py \
|
|
--timeout 240 \
|
|
--log "$log" \
|
|
--step "expect:login:" \
|
|
--step "send:root" \
|
|
--step "expect:assword:" \
|
|
--step "send:password" \
|
|
--step "expect:Type 'help' for available commands." \
|
|
--step "send:rm -f /home/root/.wayland-session.started /home/root/.qt6-wayland-smoke.ok /home/root/.qt6-wayland-smoke.err /home/root/.qt6-plugin-minimal.ok /home/root/.qt6-plugin-minimal.err /home/root/.qt6-plugin-minimal.log /home/root/.qt6-bootstrap-minimal.ok /home/root/.qt6-bootstrap-minimal.err /home/root/.qt6-bootstrap-minimal.log /home/root/.qt6-wayland-smoke-minimal.ok /home/root/.qt6-wayland-smoke-offscreen.ok /home/root/.qt6-wayland-smoke-wayland.ok /home/root/.qt6-wayland-smoke.log /home/root/.qt6-wayland-smoke-minimal.log /home/root/.qt6-wayland-smoke-offscreen.log /home/root/.qt6-wayland-smoke-wayland.log /tmp/redbear-phase4-session.log" \
|
|
--step "expect:#" \
|
|
--step "send:redbear-validation-session >/tmp/redbear-phase4-session.log ^>/tmp/redbear-phase4-session.log &" \
|
|
--step "expect:#" \
|
|
--step "send:sleep 10" \
|
|
--step "expect:#" \
|
|
--step "send:redbear-phase4-wayland-check" \
|
|
--step "expect:Red Bear OS Phase 4 Wayland Runtime Check" \
|
|
--step "expect:redbear-validation-session" \
|
|
--step "expect:wayland-session" \
|
|
--step "expect:/home/root/.qt6-bootstrap-minimal.ok" \
|
|
--step "expect:/home/root/.qt6-plugin-minimal.ok" \
|
|
--step "expect:/home/root/.qt6-wayland-smoke-minimal.ok" \
|
|
--step "expect:/home/root/.qt6-wayland-smoke-offscreen.ok" \
|
|
--step "expect:/home/root/.qt6-wayland-smoke-wayland.ok" \
|
|
--step "expect:/home/root/.qt6-wayland-smoke.ok" \
|
|
--step "expect:qt6-wayland-smoke" \
|
|
--step "expect:virtio_net_present" \
|
|
--step "send:shutdown" \
|
|
--pass_marker "virtio_net_present" \
|
|
-- \
|
|
qemu-system-x86_64 -name "Red Bear OS x86_64" -device qemu-xhci -smp 4 -m 2048 -bios "$firmware" -chardev stdio,id=debug,signal=off,mux=on -serial chardev:debug -mon chardev:debug -machine q35 -device ich9-intel-hda -device hda-output -device virtio-net,netdev=net0 -netdev user,id=net0 -object filter-dump,id=f1,netdev=net0,file="build/$arch/redbear-full/network.pcap" -vga none -device virtio-vga-gl -display egl-headless "${boot_args[@]}" -drive file="$extra",format=raw,if=none,id=drv1 -device nvme,drive=drv1,serial=NVME_EXTRA -enable-kvm -cpu host $QEMUFLAGS || rc=$?
|
|
if [[ $rc -eq 0 ]]; then
|
|
break
|
|
fi
|
|
if [[ ( $rc -eq 3 || $rc -eq 137 ) && $attempt -lt 5 ]]; then
|
|
attempt=$((attempt + 1))
|
|
echo "QEMU exited before completing the check; retrying (attempt $attempt/5)"
|
|
sleep 2
|
|
continue
|
|
fi
|
|
exit "$rc"
|
|
done
|
|
exit 0
|
|
fi
|
|
|
|
exec qemu-system-x86_64 \
|
|
-name "Red Bear OS x86_64" \
|
|
-device qemu-xhci \
|
|
-smp 4 \
|
|
-m 2048 \
|
|
-bios "$firmware" \
|
|
-chardev stdio,id=debug,signal=off,mux=on \
|
|
-serial chardev:debug \
|
|
-mon chardev=debug \
|
|
-machine q35 \
|
|
-device ich9-intel-hda -device hda-output \
|
|
-device virtio-net,netdev=net0 \
|
|
-netdev user,id=net0 \
|
|
-object filter-dump,id=f1,netdev=net0,file="build/$arch/redbear-full/network.pcap" \
|
|
-vga none \
|
|
-device virtio-vga-gl -display egl-headless \
|
|
-drive file="$image",format=raw,if=none,id=drv0 \
|
|
-device nvme,drive=drv0,serial=NVME_SERIAL \
|
|
-drive file="$extra",format=raw,if=none,id=drv1 \
|
|
-device nvme,drive=drv1,serial=NVME_EXTRA \
|
|
-enable-kvm -cpu host \
|
|
$QEMUFLAGS
|