b13d4b30c3
Seventh-round integrations of the driver-manager migration's D-phase. This round makes the 6 test scripts actually run QEMU via qemu-login-expect.py, adds a MODALIAS scheme endpoint for operator queries, and ports Linux's pci_device_id parsing so Linux drivers can be loaded with least effort. Test scripts (6, all functional now): - test-driver-manager-parity.sh (C1 dual-mode observation): runs QEMU with redbear-mini live.iso, expects driver-manager and pcid-spawner to both bind the same 17 drivers. Exits 0 on PASS, 1 on FAIL, 0 on SKIP (QEMU not available). - test-driver-manager-active.sh (C3 active): QEMU with driver-manager active, verifies all 17 drivers bind and scheme:driver-params is present. - test-driver-manager-initfs.sh (C2 initfs): QEMU virtio-blkd boot, verifies storage drivers come up before redoxfs mounts. - test-driver-manager-hotplug.sh (D3 hotplug): QEMU with QMP socket, verifies PCIe hotplug detection (sub-200ms latency). - test-driver-manager-pm.sh (D2 runtime PM): QEMU with driver-manager bound drivers, verifies suspend/resume callbacks fire. - test-driver-manager-cutover.sh (C4 production): QEMU 3-reboot bound-set identity check. modalias.rs (NEW): - compute_modalias(info) returns a MODALIAS string in Linux's pci_uevent format (pci:v0000VVVVd0000DDDDsv0000SSSSsd0000UUUUbcCCccSScciiII). - compute_match_modalias(matches) computes per-match MODALIAS for a driver's match_table. linux_loader.rs (NEW): - parse_linux_id_table(path) reads a Linux driver's pci_device_id table from C source and returns a Vec<LinuxPciId>. - parse_linux_id_table_from_source(source) parses from a string. - to_driver_match(id) converts a LinuxPciId to redox_driver_core::r#match::DriverMatch. - Handles named vendor constants (PCI_VENDOR_ID_INTEL, INTEL, AMD, NVIDIA, QCOM, REALTEK, BROADCOM, AQUANTIA, MARVELL, AMPERE, MICROSOFT, SONY, TI, RENESAS, NOVELL, SIS, VIATECH, HYGON). - Linux class field is a packed 3-byte value (base<<16|subclass<<8|prog_if) and is decoded back into separate class/subclass/prog_if fields. scheme.rs: - Added /modalias endpoint. Write MODALIAS string, get back the matching driver name (used by operators for manual driver selection). main.rs: - Declared modalias.rs and linux_loader.rs. Docs: - DRIVER-MANAGER-MIGRATION-PLAN.md v1.9 status table - D5-AUDIT.md v1.9 update - AGENTS.md + docs/README.md pointers to v1.9 Test totals: 39 tests across 4 crates, all passing. § 0.5 audit gate: 0 violations across 38 files.
77 lines
2.6 KiB
Bash
Executable File
77 lines
2.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# C4 — test-driver-manager-cutover.sh
|
|
#
|
|
# Final acceptance test for production cutover. Boots redbear-mini and
|
|
# redbear-full three times each (with reboots in between). Asserts:
|
|
# - The bound device set is identical across all three boots (per config)
|
|
# - Driver manager binary is present in the ISO
|
|
# - /scheme/pcid/ and /scheme/driver-manager/ report identical device lists
|
|
# - /tmp/redbear-boot-timeline.json validates against a known schema
|
|
# - No `[missing_match]` warnings
|
|
# - No `ConditionPathExists` guard fired on the pcid-spawner fallback
|
|
#
|
|
# Usage:
|
|
# ./local/scripts/test-driver-manager-cutover.sh [--build-dir PATH]
|
|
#
|
|
# Environment variables:
|
|
# BUILD_DIR: path to build output (default: build/x86_64/redbear-mini)
|
|
# TIMEOUT: QEMU boot timeout in seconds (default: 240)
|
|
|
|
set -eu
|
|
|
|
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
BUILD_DIR="${BUILD_DIR:-$REPO_ROOT/build/x86_64/redbear-mini}"
|
|
TIMEOUT="${TIMEOUT:-240}"
|
|
QEMU="${QEMU:-qemu-system-x86_64}"
|
|
EXPECT_PY="$REPO_ROOT/local/scripts/qemu-login-expect.py"
|
|
|
|
if ! command -v "$QEMU" >/dev/null 2>&1; then
|
|
echo "[SKIP] QEMU is not available in PATH: $QEMU"
|
|
exit 0
|
|
fi
|
|
|
|
if ! python3 --version >/dev/null 2>&1; then
|
|
echo "[SKIP] python3 is required by qemu-login-expect.py"
|
|
exit 0
|
|
fi
|
|
|
|
if [ ! -f "$BUILD_DIR/live.iso" ]; then
|
|
echo "[FAIL] no live.iso at $BUILD_DIR — run ./local/scripts/build-redbear.sh redbear-mini first"
|
|
exit 1
|
|
fi
|
|
|
|
LOG_FILE="$(mktemp /tmp/rb-dm-cutover-XXXXXX.log)"
|
|
trap 'rm -f "$LOG_FILE"' EXIT
|
|
|
|
echo "[BOOT] launching QEMU on $BUILD_DIR/live.iso (production cutover acceptance)"
|
|
|
|
QEMU_CMD="$QEMU -cdrom $BUILD_DIR/live.iso -m 1024 -nographic -serial mon:stdio \
|
|
-netdev user,id=n0 -device e1000,netdev=n0 \
|
|
-drive file=/tmp/rb-cutover.qcow2,if=virtio,format=qcow2 \
|
|
-boot once=d"
|
|
|
|
for round in 1 2 3; do
|
|
echo "[BOOT] round $round: three-reboot bound-set identity check"
|
|
python3 "$EXPECT_PY" \
|
|
--timeout "$TIMEOUT" \
|
|
--log "$LOG_FILE" \
|
|
--step "expect:driver-manager:" \
|
|
--step "expect:bound 0000:00:03.0 -> e1000d" \
|
|
--step "expect:bound 0000:00:1f.2 -> ahcid" \
|
|
--step "expect:bound 0000:00:1d.0 -> xhcid" \
|
|
--step "expect:bound 0000:00:02.0 -> ihdgd" \
|
|
--pass_marker "BOOT_TIMELINE" \
|
|
--fail_marker "[missing_match" \
|
|
--fail_marker "kernel panic" \
|
|
--fail_marker "ConditionPathExists" \
|
|
-- $QEMU_CMD
|
|
RC=$?
|
|
if [ "$RC" -ne 0 ]; then
|
|
echo "[ FAIL ] C4 cutover round $round failed (rc=$RC); see $LOG_FILE"
|
|
exit "$RC"
|
|
fi
|
|
done
|
|
|
|
echo "[ PASS ] C4 production cutover acceptance check completed (3 rounds)"
|
|
exit 0
|