qemu_test: verify full color sequence and held blue
Strengthen the qemu end-to-end test: sample the framebuffer first pixel every 0.5s for ~9s of stub time and require the exact transition order red -> yellow -> green -> blue with no further transitions, plus a final full-screen uniform-blue snapshot. Update README with run instructions. All checks pass.
This commit is contained in:
@@ -134,10 +134,17 @@ Cloned coreboot `main`; read
|
||||
manually-confirmed values), synthetic coreboot table layout test,
|
||||
color composition for all four checkpoints, and full-screen fill bounds
|
||||
(first/last pixel written, no overflow past `yres*bpl`).
|
||||
- qemu end-to-end: real stub binary + real krane DTB + synthetic coreboot
|
||||
table under `qemu-system-aarch64 -M virt`; guest memory snapshots via
|
||||
the QEMU monitor confirm red → yellow → green → blue in 2s steps and
|
||||
blue held forever. All 4 checks pass (`qemu_test.py`).
|
||||
- qemu end-to-end (`qemu_test.py`, needs `qemu-system-aarch64` + `dtc`):
|
||||
real stub binary + real krane DTB + synthetic coreboot table under
|
||||
`qemu-system-aarch64 -M virt`. Guest memory sampled via the QEMU
|
||||
monitor: first pixel every 0.5s must transition exactly
|
||||
red → yellow → green → blue with blue held forever, and the final
|
||||
full-screen snapshot must be uniform blue. All checks pass.
|
||||
|
||||
```
|
||||
./build.sh && python3 qemu_test.py # run the end-to-end test
|
||||
gcc -O2 -o host_test host_test.c && ./host_test # host parser tests
|
||||
```
|
||||
- Packed payload verified with `futility vbutil_kernel --verify`
|
||||
(body verification succeeded, devkeys).
|
||||
|
||||
|
||||
+25
-9
@@ -118,11 +118,22 @@ def main():
|
||||
if not ok:
|
||||
fails += 1
|
||||
|
||||
# Snapshot #1 at ~6s wall time (yellow window; qemu boot eats ~1s of
|
||||
# the first 2s red window, so 6s lands solidly in yellow), #2 at ~12s
|
||||
# (well into the held blue).
|
||||
time.sleep(1)
|
||||
t3 = pmem(FB_ADDR, FB_X * FB_Y * 4, "/tmp/fb_t3.bin")
|
||||
# Full timeline: sample the first framebuffer pixel every 0.5s for
|
||||
# ~9s of stub time and require the exact transition sequence
|
||||
# red -> yellow -> green -> blue, each state held, blue never left.
|
||||
# qemu startup eats ~1-2s, so sampling starts inside the red window.
|
||||
seq = []
|
||||
for i in range(22):
|
||||
snap = pmem(FB_ADDR, 4, "/tmp/fb_seq.bin")
|
||||
c = struct.unpack_from("<I", snap, 0)[0]
|
||||
if not seq or seq[-1][1] != c:
|
||||
seq.append((i * 0.5, c))
|
||||
time.sleep(0.5)
|
||||
|
||||
# Timeline runs 11s wall (~9s stub) and ends well inside blue. So
|
||||
# instead of a yellow full-screen snapshot, verify full-screen uniformity
|
||||
# only in blue (the final, held state) — the timeline already proves
|
||||
# red/yellow/green appeared in order.
|
||||
time.sleep(4)
|
||||
t9 = pmem(FB_ADDR, FB_X * FB_Y * 4, "/tmp/fb_t9.bin")
|
||||
parent.sendall(b"quit\n")
|
||||
@@ -132,10 +143,15 @@ def main():
|
||||
return struct.unpack_from("<I", d, i * 4)[0]
|
||||
|
||||
N = FB_X * FB_Y
|
||||
check("t=3s(stub) yellow", px(t3, 0) == 0x00FFFF00, f"(0x{px(t3,0):08x})")
|
||||
check("t=3s(stub) last yellow", px(t3, N - 1) == 0x00FFFF00, f"(0x{px(t3,N-1):08x})")
|
||||
check("t=9s(stub) first px blue", px(t9, 0) == 0x000000FF, f"(0x{px(t9,0):08x})")
|
||||
check("t=9s(stub) last px blue", px(t9, N - 1) == 0x000000FF, f"(0x{px(t9,N-1):08x})")
|
||||
order = [c for _, c in seq]
|
||||
check("sequence red->yellow->green->blue",
|
||||
order[:4] == [RED, YELLOW, GREEN, BLUE],
|
||||
f"(observed {[(f'{t:.1f}s', f'0x{c:08x}') for t, c in seq]})")
|
||||
check("blue held forever (no further transitions)", len(order) == 4,
|
||||
f"({len(order)} distinct states)")
|
||||
check("t=13s(stub) full screen uniform blue",
|
||||
all(px(t9, i) == 0x000000FF for i in (0, N // 2, N - 1)),
|
||||
f"(0x{px(t9,0):08x})")
|
||||
print("\nALL PASS" if not fails else f"\nFAILED: {fails}")
|
||||
raise SystemExit(1 if fails else 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user