summaryrefslogtreecommitdiff
path: root/build/snap.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build/snap.zig')
-rw-r--r--build/snap.zig53
1 files changed, 23 insertions, 30 deletions
diff --git a/build/snap.zig b/build/snap.zig
index 766be2b4..2b549e63 100644
--- a/build/snap.zig
+++ b/build/snap.zig
@@ -1,15 +1,5 @@
-//! Build-time wiring for the two snapshot suites — the `snap` step (scripted
-//! pty traces diffed against test/snapshots/*.golden) and the `web-snap` step
-//! (the same idea driven through headless Chromium). Kept out of build.zig so
-//! the test harness's plumbing is not tangled with the shell/platform build.
-//!
-//! Both steps forward `-- <args>` to their runner: `--update` regenerates
-//! goldens, `--jobs=N` / `--idle=MS` tune the tty runner's parallelism.
-
const std = @import("std");
-/// TTY parity suite: pardes-snap forks the real binary in a pty per script.
-/// The runner handles its own locking and fan-out, so this is just a run step.
pub fn addTty(b: *std.Build, opts: struct {
exe: *std.Build.Step.Compile,
target: std.Build.ResolvedTarget,
@@ -26,15 +16,20 @@ pub fn addTty(b: *std.Build, opts: struct {
}),
});
if (opts.ghostty_vt) |vt| snap.root_module.addImport("ghostty-vt", vt);
+ const ninep_options = b.addOptions();
+ ninep_options.addOption(bool, "quic", false);
+ const ninep_client = b.createModule(.{
+ .target = opts.target,
+ .optimize = opts.optimize,
+ .root_source_file = b.path("src/9p_io.zig"),
+ .link_libc = true,
+ });
+ ninep_client.addOptions("9p_options", ninep_options);
+ snap.root_module.addImport("9p_io", ninep_client);
switch (opts.target.result.os.tag) {
.freebsd, .netbsd, .openbsd => snap.root_module.linkSystemLibrary("util", .{}),
else => {},
}
- // The deterministic mock language server (test/lspmock.zig): the runner
- // points PARDES_LSP_RS at it, so the lsp-client scripts drive the REAL
- // protocol client — spawn, handshake, reader thread, progress narration —
- // against answers a golden can quote byte for byte. No pardes import; it
- // is a foreign binary on purpose.
const lspmock = b.addExecutable(.{
.name = "pardes-lspmock",
.root_module = b.createModule(.{
@@ -44,12 +39,6 @@ pub fn addTty(b: *std.Build, opts: struct {
.link_libc = true,
}),
});
- const install_lspmock = &b.addInstallArtifact(lspmock, .{ .dest_dir = .{ .override = .{ .custom = "dev" } } }).step;
- // Installed by `snap` and not by the default install step, and into
- // `<prefix>/dev` rather than `<prefix>/bin`: a bare `zig build` installs
- // the two shells into the user's own bin directory, and this harness is
- // neither of them.
- const install_snap = &b.addInstallArtifact(snap, .{ .dest_dir = .{ .override = .{ .custom = "dev" } } }).step;
const run_snap = b.addRunArtifact(snap);
run_snap.addArtifactArg(opts.exe);
run_snap.addPrefixedFileArg("--lspmock=", lspmock.getEmittedBin());
@@ -57,16 +46,18 @@ pub fn addTty(b: *std.Build, opts: struct {
// scripts fork children and drive real ptys: never cached, never "up to date"
run_snap.has_side_effects = true;
const snap_step = b.step("snap", "run the snapshot parity suite (-- --update regenerates goldens)");
- snap_step.dependOn(install_snap);
- snap_step.dependOn(install_lspmock);
snap_step.dependOn(&run_snap.step);
+ const run_driver_test = b.addRunArtifact(snap);
+ run_driver_test.addArg("--self-test");
+ run_driver_test.has_side_effects = true;
+ b.step("snap-driver-test", "test snapshot retry evidence and failure reporting").dependOn(&run_driver_test.step);
}
-/// Browser regression suite: make an isolated freestanding web build from the
-/// real TTY dump captured from Git's tracked-plus-new/nonignored `.zig` view.
-/// The dependency-free Chrome/CDP driver then exercises real DOM pointer events.
-/// This recursive build selects `web`, not `web-snap`, so it bottoms out.
pub fn addWeb(b: *std.Build) void {
+ const driver_test = b.addSystemCommand(&.{ "node", "--test", "test/web_driver_test.mjs" });
+ driver_test.setCwd(b.path("."));
+ driver_test.has_side_effects = true;
+ b.step("web-driver-test", "test browser driver deadlines and cleanup").dependOn(&driver_test.step);
const build_web_snap = b.addSystemCommand(&.{
b.graph.zig_exe,
"build",
@@ -74,7 +65,7 @@ pub fn addWeb(b: *std.Build) void {
"-Dplatform=web",
"-Dtarget=wasm32-freestanding",
"-Dtree-sitter=zig",
- "-Ddump=test/web-snapshots/source-list.dump.zon",
+ "-Ddump=test/web-snapshots/touch.dump.zon",
"-p",
"zig-out/web-snap-test",
});
@@ -83,11 +74,13 @@ pub fn addWeb(b: *std.Build) void {
"node",
"test/web_snapshot.mjs",
"zig-out/web-snap-test/web",
- "test/web-snapshots/source-list.snap",
+ "test/web-snapshots/touch.mjs",
});
run_web_snap.setCwd(b.path("."));
run_web_snap.step.dependOn(&build_web_snap.step);
+ run_web_snap.step.dependOn(&driver_test.step);
+ run_web_snap.has_side_effects = true;
if (b.args) |args| run_web_snap.addArgs(args);
- b.step("web-snap", "run browser touch/LOOK snapshots (-- --update regenerates goldens)").dependOn(&run_web_snap.step);
+ b.step("web-snap", "run browser highlighting, touch, Look, resize and scroll checks").dependOn(&run_web_snap.step);
b.step("web-e2e", "run the Chrome-driven DOM end-to-end suite").dependOn(&run_web_snap.step);
}