summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-08 23:49:04 -0300
committerGabriel Schneider <[email protected]>2026-11-09 01:28:28 -0300
commit174e031985db910b4907ba324d6fd12c67898a5a (patch)
tree5bcb0dbc1dbab457fcf4a4b95572a1631bb3ade1 /build.zig
parent21277ffc6b08f458eb9a1210a3818e40b14293d2 (diff)
downloadpardes-174e031985db910b4907ba324d6fd12c67898a5a.tar.gz
pardes-174e031985db910b4907ba324d6fd12c67898a5a.zip
tests: monkey and replay are modes of the T1 runner and snapshot.zig goes: behaviour-test runs test/monkey9p.zig bare (its smoke), `-- --monkey <seeds>` 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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig46
1 files changed, 21 insertions, 25 deletions
diff --git a/build.zig b/build.zig
index 1491ed35..e731f682 100644
--- a/build.zig
+++ b/build.zig
@@ -1,7 +1,7 @@
const std = @import("std");
const builtin = @import("builtin");
const mupdf_build = @import("mupdf.zig");
-const snap_build = @import("build/snap.zig");
+const process_build = @import("build/process.zig");
const grammar_manifest = @import("src/grammar_manifest.zig");
/// The package manifest, imported UNTYPED on purpose — see the `version`
/// option in `shellOptions` for why that word is load-bearing.
@@ -760,13 +760,13 @@ pub fn build(b: *std.Build) void {
vaxis_mod.root_source_file = files.getDirectory().path(b, "main.zig");
}
- var ghostty_vt_for_snap: ?*std.Build.Module = null;
+ var ghostty_vt_for_tests: ?*std.Build.Module = null;
const ghostty_simd = !target.result.os.tag.isDarwin() or b.graph.host.result.os.tag.isDarwin();
const ghostty_optimize: std.lang.Optimize = if (optimize == .debug) .safe else optimize;
const ghostty_dep = b.lazyDependency("ghostty", .{ .target = target, .optimize = ghostty_optimize, .simd = ghostty_simd, .@"app-runtime" = .none, .@"emit-xcframework" = false });
if (ghostty_dep) |dep| {
const ghostty_vt = dep.module("ghostty-vt");
- ghostty_vt_for_snap = ghostty_vt;
+ ghostty_vt_for_tests = ghostty_vt;
ghostty_vt.addImport("uucode", uucode_mod);
patchGhosttyKitty(b, io, dep, ghostty_vt);
ghostty_core_vt = ghostty_vt;
@@ -1221,12 +1221,12 @@ pub fn build(b: *std.Build) void {
}
const addons: []const *std.Build.Step.Compile = if (pdf_addon) |l| b.allocator.dupe(*std.Build.Step.Compile, &.{ image_addon, l }) catch @panic("OOM") else &.{image_addon};
- snap_build.addTty(b, .{
+ process_build.add(b, .{
.exe = exe,
.addons = addons,
.target = target,
.optimize = optimize,
- .ghostty_vt = ghostty_vt_for_snap,
+ .ghostty_vt = ghostty_vt_for_tests,
.cloud9 = cloud9,
.gui = platform == .gui,
});
@@ -1240,7 +1240,7 @@ pub fn build(b: *std.Build) void {
.link_libc = true,
}),
});
- if (ghostty_vt_for_snap) |vt| image_harness.root_module.addImport("ghostty-vt", vt);
+ if (ghostty_vt_for_tests) |vt| image_harness.root_module.addImport("ghostty-vt", vt);
switch (target.result.os.tag) {
.freebsd, .netbsd, .openbsd => image_harness.root_module.linkSystemLibrary("util", .{}),
else => {},
@@ -1274,7 +1274,7 @@ pub fn build(b: *std.Build) void {
.link_libc = true,
}),
});
- if (ghostty_vt_for_snap) |vt| kitty_harness.root_module.addImport("ghostty-vt", vt);
+ if (ghostty_vt_for_tests) |vt| kitty_harness.root_module.addImport("ghostty-vt", vt);
switch (target.result.os.tag) {
.freebsd, .netbsd, .openbsd => kitty_harness.root_module.linkSystemLibrary("util", .{}),
else => {},
@@ -1428,7 +1428,7 @@ pub fn build(b: *std.Build) void {
});
perf.root_module.addImport("pardes", core_module);
// --live drives the real binary through a pty (test/e2e_harness.zig).
- if (ghostty_vt_for_snap) |vt| perf.root_module.addImport("ghostty-vt", vt);
+ if (ghostty_vt_for_tests) |vt| perf.root_module.addImport("ghostty-vt", vt);
perf.root_module.addOptions("perf_options", perf_options);
const run_perf = b.addRunArtifact(perf);
run_perf.has_side_effects = true;
@@ -1588,7 +1588,7 @@ pub fn build(b: *std.Build) void {
});
session_module.addImport("pardes", core_module);
// The scripted language server its language words ask
- // (Session.initLanguage), as the snapshot scripts' do.
+ // (Session.initLanguage), as the tty cases do.
const session_options = b.addOptions();
session_options.addOptionPath("lspmock", b.addExecutable(.{
.name = "pardes-lspmock",
@@ -1632,7 +1632,7 @@ pub fn build(b: *std.Build) void {
// window's word knows which build it runs in.
behaviour_module.addImport("pardes_config", core_module.import_table.get("pardes_config").?);
const behaviour_tests = b.addTest(.{ .root_module = behaviour_module, .filters = test_filters });
- const behaviour_test_step = b.step("behaviour-test", "run the behavioural tests, through the 9P tree alone (test/behaviour/)");
+ const behaviour_test_step = b.step("behaviour-test", "run the behavioural tests, through the 9P tree alone (test/behaviour/), and the T1 runner (-- [--seed N]... | --monkey <seeds> | --replay)");
_ = units.add(b, behaviour_tests, behaviour_test_step);
// An addon's own test: `--addon-test` over the fake (the template)
// and the snake (a shipped example, built but not installed), each
@@ -1659,10 +1659,12 @@ pub fn build(b: *std.Build) void {
addon_test_step.dependOn(&compare.step);
if (lib == pdf_addon) mupdf_check.dependOn(&compare.step);
};
- // The 9P monkey at T1 (test/monkey9p.zig): random requests against
- // an in-process session, the documented rules checked after each.
- // Its fixed-seed smoke run is part of behaviour-test.
- const monkey_session = b.addExecutable(.{
+ // The T1 runner (test/monkey9p.zig): its modes over an in-process
+ // session, random 9P requests with the documented rules checked
+ // after each, random input hunting panics (`-- --monkey <seeds>`),
+ // and its seeds' tapes replayed (`-- --replay`). Bare, a short
+ // fixed-seed run of the first, part of behaviour-test.
+ const t1_runner = b.addExecutable(.{
.name = "pardes-monkey-session",
.root_module = b.createModule(.{
.target = target,
@@ -1671,17 +1673,11 @@ pub fn build(b: *std.Build) void {
.link_libc = true,
}),
});
- monkey_session.root_module.addImport("session", session_module);
- const run_monkey_session = b.addRunArtifact(monkey_session);
- run_monkey_session.addPassthruArgs();
- run_monkey_session.has_side_effects = true;
- b.step("monkey-session", "random 9P requests against an in-process session, checking the documented rules (-- [--seed N]... [--steps M] [--only i,j,k] [--no-shrink] [-v])").dependOn(&run_monkey_session.step);
- const run_monkey_session_smoke = b.addRunArtifact(monkey_session);
- run_monkey_session_smoke.addArg("--smoke");
- run_monkey_session_smoke.has_side_effects = true;
- const monkey_session_smoke_step = b.step("monkey-session-smoke", "a short fixed-seed run of monkey-session (part of behaviour-test)");
- monkey_session_smoke_step.dependOn(&run_monkey_session_smoke.step);
- if (test_filters.len == 0) behaviour_test_step.dependOn(&run_monkey_session_smoke.step);
+ t1_runner.root_module.addImport("session", session_module);
+ const run_t1_runner = b.addRunArtifact(t1_runner);
+ run_t1_runner.addPassthruArgs();
+ run_t1_runner.has_side_effects = true;
+ if (test_filters.len == 0) behaviour_test_step.dependOn(&run_t1_runner.step);
// Kitty graphics conformance at the core: what a terminal pane's
// program sends, what it reads back, what ghostty stores and what a