From 174e031985db910b4907ba324d6fd12c67898a5a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 8 Nov 2026 23:49:04 -0300 Subject: tests: monkey and replay are modes of the T1 runner and snapshot.zig goes: behaviour-test runs test/monkey9p.zig bare (its smoke), `-- --monkey ` drives an in-process session with test/monkey.zig's input (keys, leader bursts, the mouse, tiny resizes, over /kbdin, /mousein and Session.resize) hunting panics and hangs, `-- --replay` records each seed's sessions as a tape in memory and replays it (tape.replayBytes, replayMain's loop: three replicas and the dump), and `process-test -- --replay` records and replays the tty cases' real sessions as `zig build replay` did (with the addons it lacked, so images passes); the snap, snap-driver-test, monkey, monkey-test (it no longer compiled), replay and monkey-session steps, pardes-snap and build/snap.zig (now build/process.zig) go; checked: a counter outside the core bumped at the 40th update diverges every T1 seed and 89 of 103 old tapes, one bumped on terminal output diverges no T1 seed but 69 tty cases and 70 old tapes (why the tty replay stays), a panic on a window under 5x5 is found by the T1 monkey (seeds 1 8 17 20) and the old one (seed 13) Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/snapshot.zig | 1753 ----------------------------------------------------- 1 file changed, 1753 deletions(-) delete mode 100644 test/snapshot.zig (limited to 'test/snapshot.zig') diff --git a/test/snapshot.zig b/test/snapshot.zig deleted file mode 100644 index 51c81dd9..00000000 --- a/test/snapshot.zig +++ /dev/null @@ -1,1753 +0,0 @@ -// pardes-snap: drive a pardes binary with a scripted input trace in a pty and -// capture the rendered grid at named sync points. The same script run against -// the prototype and the rewrite must produce byte-identical captures — this is -// the old-vs-new parity oracle for the rewrite. -// -// zig build snap run all snapshots/*.snap, diff goldens -// zig build snap -- --update regenerate goldens serially -// zig build snap -- snapshots/boot.snap one script -// zig build snap -- --jobs=1 serial (default: 1.25 per cpu) -// zig build snap -- --trace-stable show what every `stable` waited on -// -// Scripts run one per forked child, in parallel; each child's report is held -// in a temp file and printed in script order at the end. The runner takes its -// own lockfile, so `zig build snap` never needs an `flock` wrapper: a second -// run waits for the first instead of trampling the fixed /tmp paths that the -// goldens record verbatim. A script that fails in the parallel pass is re-run -// alone before it counts as a failure. -// -// `stable` no longer burns its wall-clock window: it returns as soon as the -// app is provably done — screen unchanged, pty empty, and every process it -// forked asleep (see waitStable). That, the fan-out, and building the vendored -// C optimized (build.zig's c_optimize: 90% of a Debug startup used to be -// tree-sitter's query analyser at -O0) took the suite from 7m54s to ~4s. The -// app now reaches first paint in ~25ms, so what is left is mostly real work: -// bash spawns, their output, and the 40 `settle`s after `key esc`. -// -// Script commands (line-oriented, # comments): -// file create file in the script's cwd (before start) -// lines [tail] create file with n numbered lines, tail on each -// dirmk create a subdirectory -// run run a command in the script's cwd (NOT in a pane) -// start [arg] fork the app in a pty (optional extra CLI arg) -// wait pump until needle appears on the grid (fails hard) -// settle pump for a fixed duration -// stable pump until the grid stops changing -// text send literal bytes -// send send with \e \r \n \t \\ \xNN escapes -// key enter esc tab bs space up down left right home end -// pgup pgdn c- a- (after esc: settle, or -// vaxis reads the next byte in the same batch and -// parses it as alt-. The scripts said 700ms and -// it cost the suite 28s; there is no timer in vaxis -// to outlast — 20ms passes, they use 100ms) -// press|release <[ctrl-]left|middle|right> SGR mouse, 1-based -// drag motion with button held -// motion button-less motion (hover) -// wheel -// resize -// snap