readPanel() needed width and height in [peripheral.LCD0], which many boards leave to qemu's panel model, naming only the type; the screen box then fell back to 132x176. For the 130x130 panels (l2f50250: the SL65 preset, lh15kah2: C65, C72) the box jumped at the first frame, and a later setAspect() stretched the last frame back into 3:4. readPanel() now falls back from the type to its size, a small table mirroring qemu/hw/lcd (lcd.c's 240x320 for the rest), the paint loop remembers the size the guest reported for the run's board, and a device the page applies itself (from the file name or the image) sets the aspect as a hand-picked one does. Review: WEB-12. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| baremetal | ||
| tcg-isa | ||
| tcgbench | ||
| unit | ||
| wasm | ||
| insncount.c | ||
| lockstep.c | ||
| README.md | ||
| run.mjs | ||
Test suite
Boot + benchmark tests for the pmb887x emulator (native build), run over
the fullflashes that currently work: s75, el71, c81, ke800, ke970
(fullflashes/). The LG flashes carry their EEPROM in the NOR flash EFA
block — the .cfi-efa sidecar (KE800-v11b.bin.cfi-efa,
KE970v10d.bin.cfi-efa) must sit next to the fullflash (the launcher picks
it up automatically).
Sibling suites in this directory (each with its own README): tcg-isa/
(the guest op-suite, gate scripts/run-tcg-isa.sh) and tcgbench/ (the
versatilepb perf bench + device-tax mirrors, tools/tcgbench.mjs); both
build on baremetal/ (startup, linker script, compiler flags).
wasm/dispatchbench.mjs is a standalone node microbenchmark of the
wasm64 TB-to-TB transition (no build, no page; options in its header).
unit/ holds node --test suites for the page's pure modules
(site/boards.js, exit-report.js, otp.js, ua.js, keyboards.js,
fullflashes.js, gprs-net.js, gsm-badge.js): node --test tests/unit/*.test.mjs, milliseconds, also the gate's unit job.
The lockstep harness is documented below.
Running
scripts/build-native.sh # build/qemu-native-build/qemu-system-arm (WEB_BUILD, QEMU_NATIVE_BUILD)
bash scripts/sync-bsp.sh # the bsp/ submodule, at its gitlink
node tests/run.mjs # ~1 min (see defaults below)
node tests/run.mjs --label after --timeout 150 --bench-secs 45
Useful options:
| flag | default | meaning |
|---|---|---|
--label NAME |
run |
labels results JSON + tmp dirs |
--timeout SECS |
180 | per-flash hard deadline |
--bench-secs SECS |
45 | benchmark window (see below) |
--flash a,b |
all | subset of s75,el71,c81,ke800,ke970 |
--keep |
– | keep per-run dirs under /tmp for inspection |
Env overrides QEMU_BIN / BOARDS_DIR select the emulator binary and
board-config directory (forwarded to scripts/run-native.sh); the default
binary and the insncount plugin come from the build directories of
tools/lib/build-dirs.mjs (WEB_BUILD, QEMU_NATIVE_BUILD,
TEST_PLUGINS_DIR, as for scripts/build-dirs.sh). Results are
written to tests/results/<label>-<timestamp>.json together with a PNG
screenshot per flash — <label>-<stamp>-<flash>-boot.png (first shot with
LCD content, the boot-progress proof) and <label>-<stamp>-<flash>.png
(final state); the JSON records the paths under screenshots. Exit code
is non-zero if any test fails.
What is tested
Every fullflash boots in parallel with the exact run-native.sh
recipe (-icount shift=3,sleep=off, OTP words derived from IMEI/ESN,
virtual SIM, ONLINE startup). The harness drives the HMP monitor
(screendump, info registers) and reads the serial log + the
instruction-count plugin.
- boot-init (15 s) — board config parses, no
hardware error:on stderr, guest executes ≥ 10M instructions, monitor answers. - boot-progress (deadline) — the LCD shows content (≥ 300
saturated pixels in screendumps — splash/menu), or serial output
together with a lit LCD; no firmware
>>EXIT<<abort. - no-exit — no
>>EXIT<</ hw_error / early process death during the whole observation window (catches regressions that only abort after early milestones).
Benchmarks
tests/insncount.c— TCG plugin that counts executed guest instructions (compiled tobuild/test-plugins/insncount.so, or into$WEB_BUILD/test-plugins/TEST_PLUGINS_DIRwhen set, byscripts/build-plugins.sh, whichgate.shruns; needs the qemu source tree headers).- MIPS — executed instructions per second over the
--bench-secswindow (plugin's own monotonic clock; comparable across builds, independent of guest-visible milestones). - milestone timings — seconds to first serial byte / LCD lit / LCD
content. Boot is deterministic under
-icount shift=3,sleep=off, so these track emulation speed too (icount is unpaced, so idle time is skipped; the instruction window is the pure-CPU measure).
The suite stops each instance ~10 s after the benchmark window once all
verdicts are in (fast path); the --timeout deadline is the worst case.
Lockstep (cross-backend value equality)
Whole-boot, value-level comparison of guest state between two TCG
backends; tools/lockstep-wasm.mjs runs the same comparison against the
wasm page. The gate forces one-insn-per-tb, so it cannot see
multi-instruction-TB bugs: tools/bootcheck.mjs and the LS_QARGS run of
lockstep-wasm.mjs cover those (doc/performance.md, Lockstep).
scripts/build-native.sh # a-side: reference JIT
scripts/build-native-tci.sh # b-side: TCI, plugins force-enabled
bash scripts/sync-bsp.sh
scripts/run-lockstep.sh # the gate: 3 full S75 boots
RUNS=1 INSNS=300e6 scripts/run-lockstep.sh # quick smoke
SELF=1 scripts/run-lockstep.sh # harness self-check (JIT vs JIT)
node tools/lockstep.mjs --corrupt 67108864 --insns 100e6 # positive control
- Plugin
tests/lockstep.c(built tobuild/test-plugins/lockstep.so, next toinsncount.soas above): samples the r0–pc + CPSR vector every 2^16 executed guest insns (an inline per-insn counter + conditional callback) and writes a tiny text log — one E-line per 2^20 insns with a hash of the vector at that sample, one M-line of SRAM/SDRAM digests per 2^23. Sampling is keyed on executed guest instructions, not TB boundaries (TB partitioning is TCG-internal — see the plugin header for the three qemu properties this design owes to). - Driver
tools/lockstep.mjs: boots the fullflash on both binaries under-accel tcg,one-insn-per-tb=on -rtc base=2000-01-01T00:00:00, clock=vmuntil both sides reach--insns, quits via the HMP monitor, byte-diffs the digest streams (+ serial logs), and saves both sides' final screendump next to the results JSON (lockstep-<label>-<stamp>-run<N>-{a,b}.png; the wasm gatetools/lockstep-wasm.mjsadds the browser page + LCD crops as-b.png/-b-lcd.png). On divergence it re-runs both sides with a dense per-insn dump window over the divergent epoch and reports the exact first differing insn + register vector — hand that to the op-suite (tests/tcg-isa) to bisect by op. - Positive control:
--corrupt Nflips one bit of r0 on the b-side only, from insn N to the end of its epoch; the gate must flag that epoch and the dense rerun must pinpoint insn N.
The gate is JIT vs TCI on S75, 3 × 2.5G guest insns (a full boot through idle), run in parallel. Lockstep requires the icount timing model. SL65 is not deterministic enough for it even against itself (doc/performance.md, Lockstep).
Notes
- The instances run in parallel, one per fullflash. Under heavy contention a phone may miss a firmware deadline
(
>>EXIT<<) — if a flake is suspected, rerun, or boot that phone alone with--flash <id>. lit= non-black pixels of the qemu console screendump (240×320 frame containing the phone LCD);col= saturated-pixel count.