summaryrefslogtreecommitdiff
path: root/build/tests.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 09:47:44 -0300
committerGabriel Schneider <[email protected]>2026-11-25 09:47:44 -0300
commita6d2b61bd78768cf4bbf177717ffea319825de69 (patch)
treea5d2fe57480efecab632d90271e6c282353f51dd /build/tests.zig
parent58d7434f56a9fef3098cfc191fbd1cb32ec09cfb (diff)
downloadpardes-a6d2b61bd78768cf4bbf177717ffea319825de69.tar.gz
pardes-a6d2b61bd78768cf4bbf177717ffea319825de69.zip
test/replicas.zig: the soak's typist guards q from its space to its next Esc, not only right after the space: SPC's level stays open over a key it has no child for (keys.zig leaderKey: struck, the level stays) and Backspace takes it back up, so `SPC 7 o q` and `SPC l Backspace q` reached Exit and ended the session mid-run (G4's M6 soak run 1, seed 2 rtt 207: "the session ended (Exit, the last pane's Del)", the last keys drawn client 1's `7 o q 0`); THE CAUSE: nextEvent cleared Script.space on any typed key that was not a space and on every normal-mode key, and the search's and the sweep's scripts (`script.* = .{...}`) reset it with the whole Script; THE FIX: Script.space is set by a space and cleared only by the typist's Esc (the one key sure to leave the level), and both scripts keep it; a q typed meanwhile is an r, as it was right after a space; TEST FIRST: replicas.zig "the typist types no q while a leader its space opened may be open: from its space to its next Esc (SPC 7 o q was Exit)" (200,000 events of seed 109, the level modelled open from a space to an Esc): fails on the base at replicas.zig:3678, and after the first half of the fix at :3679 (the search's script reset), passes now; the harness's tests are built beside it (build/tests.zig: test/replicas.zig as a unit-test root, run by `replicas` and unit-test, its imports the program's); a user could not hit it: the soak's typist only
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'build/tests.zig')
-rw-r--r--build/tests.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/build/tests.zig b/build/tests.zig
index 5e913501..8cf42acd 100644
--- a/build/tests.zig
+++ b/build/tests.zig
@@ -148,7 +148,8 @@ pub fn add(b: *std.Build, c: struct {
// The replicas' soak, its clients showing a picture, a game of life and
// a PDF (docs/design.pdf) from these libraries, as a user's addons are
// loaded.
- const replicas = program(b, "pardes-replicas", "test/replicas.zig", c.target, c.optimize, &.{ .{ .name = "pardes", .module = c.core_module }, .{ .name = "runtime", .module = c.core_runtime }, .{ .name = "term", .module = c.parts.term } });
+ const replicas_imports: []const std.Build.Module.Import = &.{ .{ .name = "pardes", .module = c.core_module }, .{ .name = "runtime", .module = c.core_runtime }, .{ .name = "term", .module = c.parts.term } };
+ const replicas = program(b, "pardes-replicas", "test/replicas.zig", c.target, c.optimize, replicas_imports);
const run_replicas = b.addRunArtifact(replicas);
for ([_]?*std.Build.Step.Compile{ c.image_addon, life_lib, c.pdf_addon }) |l| if (l) |lib| {
run_replicas.addArg("--addon");
@@ -160,7 +161,10 @@ pub fn add(b: *std.Build, c: struct {
}
run_replicas.addPassthruArgs();
run_replicas.has_side_effects = true;
- b.step("replicas", "one authority and several replicas in process, each client typing over a delayed link: digests at quiescence, rollback rate and costs per RTT (-- [--seeds N] [--steps M] [--clients C] [--rtt 30,80,207])").dependOn(&run_replicas.step);
+ const replicas_step = b.step("replicas", "one authority and several replicas in process, each client typing over a delayed link: digests at quiescence, rollback rate and costs per RTT (-- [--seeds N] [--steps M] [--clients C] [--rtt 30,80,207])");
+ replicas_step.dependOn(&run_replicas.step);
+ // Its typist's own tests (what it never types), with every soak and unit-test.
+ _ = units.add(b, units.root(b, "test/replicas.zig", true, replicas_imports), replicas_step);
for ([_]*std.Build.Module{ snake_mod, life_mod, liar_mod, c.parts.image }) |m| addon_test_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = m })).step);
if (c.pdf_addon) |lib| addon_test_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = lib.root_module })).step);
// ...and the pdf addon's, which mupdf-check runs too (its script