From 3267d276ab2553adb412183eb92390ed579b494f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 17:03:15 -0300 Subject: zig build monkey: random snapshot scripts hunting panics test/monkey.zig (Zig, as the project's tooling is): one random .snap per seed, over bad-UTF-8, wide-glyph and long files: keys, leader bursts, typing (an alphabet with no path characters), workspace words run by a middle click (Newcol for narrow panes, Find and Grep for prompts, long prompt text), presses, drags, wheel, hover, and resizes down to a cell. pardes-snap runs it with --update; a panic is a record in the app's crash file (in the script's fake home: seen even when the crash cut the script short) or a `.zig:N:N: 0x` frame of the app's (not the harness's) in its report or captured grid, and a hit keeps the script, captures and log under --out (default /tmp/pardes-monkey). A seed always makes the same script (tested), so --from=N replays one. Not a gate. README documents it next to snap. No Shader line: the tty has no post chain; the core fuzz in src/draw.zig covers the compile-error notice at a gui's metrics. 80 seeds x 70 steps: no panic. --- build/snap.zig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'build/snap.zig') diff --git a/build/snap.zig b/build/snap.zig index 6b3d2104..7aa06884 100644 --- a/build/snap.zig +++ b/build/snap.zig @@ -49,6 +49,25 @@ pub fn addTty(b: *std.Build, opts: struct { run_snap.has_side_effects = true; const snap_step = b.step("snap", "run the snapshot parity suite (-- --update regenerates goldens)"); snap_step.dependOn(&run_snap.step); + // Random scripts through pardes-snap, hunting panics (test/monkey.zig): + // not a gate, it is slow and random over seeds; a seed replays. + const monkey = b.addExecutable(.{ + .name = "pardes-monkey", + .root_module = b.createModule(.{ + .target = opts.target, + .optimize = opts.optimize, + .root_source_file = b.path("test/monkey.zig"), + .link_libc = true, + }), + }); + const run_monkey = b.addRunArtifact(monkey); + run_monkey.addArtifactArg(snap); + run_monkey.addArtifactArg(opts.exe); + if (b.args) |args| run_monkey.addArgs(args); + run_monkey.has_side_effects = true; + b.step("monkey", "random snapshot scripts hunting panics (-- [steps] [--from=N] [--out=DIR])").dependOn(&run_monkey.step); + const monkey_tests = b.addTest(.{ .root_module = monkey.root_module }); + b.step("monkey-test", "test the monkey's generator and panic detector").dependOn(&b.addRunArtifact(monkey_tests).step); const run_driver_test = b.addRunArtifact(snap); run_driver_test.addArg("--self-test"); run_driver_test.has_side_effects = true; -- cgit v1.3