summaryrefslogtreecommitdiff
path: root/build/snap.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build/snap.zig')
-rw-r--r--build/snap.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/build/snap.zig b/build/snap.zig
index 35a246ad..6982379c 100644
--- a/build/snap.zig
+++ b/build/snap.zig
@@ -66,6 +66,27 @@ pub fn addTty(b: *std.Build, opts: struct {
run_monkey.addPassthruArgs();
run_monkey.has_side_effects = true;
b.step("monkey", "random snapshot scripts hunting panics (-- <seeds> [steps] [--from=N] [--out=DIR])").dependOn(&run_monkey.step);
+ // The replay-divergence gate (src/tape.zig, docs/next-daemon.md): every
+ // snapshot script and `replay-seeds` monkey seeds with each session's
+ // tape recorded, each replayed into two replicas at different
+ // addresses and one that never draws, every digest checked.
+ const tapes = ".zig-cache/tapes";
+ const run_replay = b.addRunArtifact(snap);
+ run_replay.addArtifactArg(opts.exe);
+ run_replay.addPrefixedFileArg("--lspmock=", lspmock.getEmittedBin());
+ run_replay.addArg("--tape=" ++ tapes);
+ run_replay.setCwd(b.path("."));
+ run_replay.has_side_effects = true;
+ const seeds = b.option(u32, "replay-seeds", "monkey seeds `zig build replay` records and replays (default 20)") orelse 20;
+ const run_monkey_replay = b.addRunArtifact(monkey);
+ run_monkey_replay.addArtifactArg(snap);
+ run_monkey_replay.addArtifactArg(opts.exe);
+ run_monkey_replay.addArgs(&.{ b.fmt("{d}", .{seeds}), "70", "--tape=" ++ tapes ++ "/monkey", "--out=" ++ tapes ++ "/monkey" });
+ run_monkey_replay.setCwd(b.path("."));
+ run_monkey_replay.has_side_effects = true;
+ // One pardes-snap run at a time (its lock): the scripts, then the seeds.
+ run_monkey_replay.step.dependOn(&run_replay.step);
+ b.step("replay", "record every snapshot script's and -Dreplay-seeds monkey seeds' tapes and require each to replay without diverging").dependOn(&run_monkey_replay.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);