1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
const std = @import("std");
pub fn addTty(b: *std.Build, opts: struct {
exe: *std.Build.Step.Compile,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
ghostty_vt: ?*std.Build.Module,
}) void {
const snap = b.addExecutable(.{
.name = "pardes-snap",
.root_module = b.createModule(.{
.target = opts.target,
.optimize = opts.optimize,
.root_source_file = b.path("test/snapshot.zig"),
.link_libc = true,
}),
});
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 => {},
}
const lspmock = b.addExecutable(.{
.name = "pardes-lspmock",
.root_module = b.createModule(.{
.target = opts.target,
.optimize = opts.optimize,
.root_source_file = b.path("test/lspmock.zig"),
.link_libc = true,
}),
});
const run_snap = b.addRunArtifact(snap);
run_snap.addArtifactArg(opts.exe);
run_snap.addPrefixedFileArg("--lspmock=", lspmock.getEmittedBin());
if (b.args) |args| run_snap.addArgs(args);
// 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(&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);
}
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",
"web",
"-Dplatform=web",
"-Dtarget=wasm32-freestanding",
"-Dtree-sitter=zig",
"-Ddump=test/web-snapshots/touch.dump.zon",
"-p",
"zig-out/web-snap-test",
});
build_web_snap.setCwd(b.path("."));
const run_web_snap = b.addSystemCommand(&.{
"node",
"test/web_snapshot.mjs",
"zig-out/web-snap-test/web",
"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 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);
}
|