summaryrefslogtreecommitdiff
path: root/build/tests.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-18 20:52:50 -0300
committerGabriel Schneider <[email protected]>2026-11-18 21:22:58 -0300
commita75956bb3443aa8aac778d2ff12c42f5ef99e0e9 (patch)
tree17547cbf6606c8bd05be313cd8f835cb85d13e57 /build/tests.zig
parent5b33c88476054fffc1044fff0526f7f0b28563cf (diff)
downloadpardes-a75956bb3443aa8aac778d2ff12c42f5ef99e0e9.tar.gz
pardes-a75956bb3443aa8aac778d2ff12c42f5ef99e0e9.zip
runtime: main, daemon, upgrade, crash, addon_test, 9p_io, 9p and macos.zig into runtime/ (the reorganisation's tree, step 2a), skill.txt with main.zig, its one reader: module `runtime` (runtime/root.zig) and the core, each naming the other, a product's root (main.zig, macos.zig) a module of its own over both; the files name across by module (`@import("runtime").daemon`, `@import("core").look`), pardes.zig exporting what they name (ctl, edit_cmd, tracy, selection_pipe, and the frontends until they move); core-test and shell-test run each module's test program, so the same tests run (the ledger: every named test of every suite the base's, tui and gui); nothing else changes: frames byte-identical, the same counts (tui core-test 822/963, the one more an anonymous collector)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'build/tests.zig')
-rw-r--r--build/tests.zig31
1 files changed, 19 insertions, 12 deletions
diff --git a/build/tests.zig b/build/tests.zig
index e0b9235a..2d43d743 100644
--- a/build/tests.zig
+++ b/build/tests.zig
@@ -9,7 +9,10 @@ const program = tools.program;
/// addon-test (and the addons it loads), kitty-test, the 9P roots.
pub fn add(b: *std.Build, c: struct {
addon_mod: *std.Build.Module,
- core_lean: *std.Build.Module,
+ /// The core without a terminal and the runtime beside it: core-test.
+ core_lean: core.Modules,
+ /// The shell's root, core and runtime: shell-test.
+ root_set: core.Modules,
core_module: *std.Build.Module,
/// core_module's configuration, for the test roots that run on its imports.
core_cfg: core.Core,
@@ -60,12 +63,15 @@ pub fn add(b: *std.Build, c: struct {
// The perf and fs bench programs' own tests: they compile no editor.
_ = units.add(b, units.root(b, "test/perf.zig", true, &.{.{ .name = "perf_options", .module = c.tools.perf_options.createModule() }}), null);
_ = units.add(b, units.root(b, "test/fs_bench.zig", null, &.{}), null);
- const core_test = b.addTest(.{ .root_module = c.core_lean, .filters = c.test_filters });
- const run_core_test = b.addRunArtifact(core_test);
- run_core_test.has_side_effects = true;
- const core_test_step = b.step("core-test", "run core tests without native shell tests, on the core without a terminal (a test that needs one skips)");
- core_test_step.dependOn(&run_core_test.step);
- if (testMatch(b, c.unit_profile, c.test_filters, core_test_step)) |check| check.addArtifactArg(core_test);
+ const core_test_step = b.step("core-test", "run core tests without native shell tests, on the core without a terminal (a test that needs one skips), and the runtime's beside it");
+ const core_match = testMatch(b, c.unit_profile, c.test_filters, core_test_step);
+ for ([_]*std.Build.Module{ c.core_lean.core, c.core_lean.runtime }) |m| {
+ const core_test = b.addTest(.{ .root_module = m, .filters = c.test_filters });
+ const run_core_test = b.addRunArtifact(core_test);
+ run_core_test.has_side_effects = true;
+ core_test_step.dependOn(&run_core_test.step);
+ if (core_match) |check| check.addArtifactArg(core_test);
+ }
// The terminal module's own tests (src/term/): the emulator without a core.
const run_term_test = units.add(b, b.addTest(.{ .root_module = c.parts.term, .filters = c.test_filters }), null);
b.step("term-test", "run the terminal module's own tests (src/term/)").dependOn(&run_term_test.step);
@@ -190,18 +196,18 @@ pub fn add(b: *std.Build, c: struct {
// stays reachable even when Zig's filter leaves the core's
// anonymous test-import block out.
for ([_]struct { path: []const u8, step: []const u8, about: []const u8, filters: []const []const u8 }{
- .{ .path = "src/9p_io.zig", .step = "9p-io-test", .about = "run native 9P transport and client integration tests", .filters = &.{ "Unix and TCP", "one fetch", "expired sessions", "posts itself" } },
+ .{ .path = "runtime/root.zig", .step = "9p-io-test", .about = "run native 9P transport and client integration tests", .filters = &.{ "Unix and TCP", "one fetch", "expired sessions", "posts itself" } },
.{ .path = "src/fs.zig", .step = "fs-unit-test", .about = "run filesystem unit tests", .filters = c.test_filters },
}) |t| {
var cfg = c.core_cfg;
cfg.root = t.path;
- const m = core.module(b, c.parts, cfg);
+ const m = core.module(b, c.parts, cfg).root;
b.step(t.step, t.about).dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = m, .filters = t.filters })).step);
}
const cloud9: []const std.Build.Module.Import = &.{.{ .name = "cloud9", .module = c.parts.cloud9 }};
_ = units.add(b, units.root(b, "test/history.zig", false, cloud9), null);
- const protocol_tests = units.root(b, "src/9p.zig", false, cloud9);
+ const protocol_tests = units.root(b, "runtime/9p.zig", false, cloud9);
const protocol_step = b.step("9p-test", "run freestanding 9P protocol tests");
protocol_step.dependOn(&units.add(b, protocol_tests, null).step);
if (testMatch(b, c.unit_profile, c.test_filters, protocol_step)) |check| check.addArtifactArg(protocol_tests);
@@ -213,10 +219,11 @@ pub fn add(b: *std.Build, c: struct {
_ = units.add(b, units.root(b, "test/deck/replay.zig", null, &.{.{ .name = "deck", .module = b.createModule(.{ .target = c.target, .optimize = c.optimize, .root_source_file = b.path("src/gui/deck.zig") }) }}), null);
if (c.platform == .tui or c.platform == .gui) {
- const run_shell_test = units.add(b, b.addTest(.{ .root_module = c.root_mod, .filters = c.test_filters }), null);
// The native shell's tests alone, without the perf gate's
// ReleaseFast build: what a -Dtest-filter iteration wants.
- b.step("shell-test", "run the native shell's unit tests (src/main.zig's)").dependOn(&run_shell_test.step);
+ const shell_test_step = b.step("shell-test", "run the native shell's unit tests (runtime/main.zig's, and its core's and runtime's)");
+ for ([_]*std.Build.Module{ c.root_set.root, c.root_set.core, c.root_set.runtime }) |m|
+ shell_test_step.dependOn(&units.add(b, b.addTest(.{ .root_module = m, .filters = c.test_filters }), null).step);
const profile_test = b.addExecutable(.{
.name = "pardes-unit-profile-test",
.root_module = b.createModule(.{