summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:51:04 -0300
committerGabriel Schneider <[email protected]>2026-11-05 09:54:56 -0300
commit2e244415aca9d3ae1936c89d418e912bea8d68cf (patch)
tree4d0034dc3641b4368ccbdb80c8d9b52dc765b1df
parentd589e9d44294406f7fbef434fd009734eb3c5f61 (diff)
downloadpardes-2e244415aca9d3ae1936c89d418e912bea8d68cf.tar.gz
pardes-2e244415aca9d3ae1936c89d418e912bea8d68cf.zip
build: the 9p-io-test and fs-unit-test modules are two rows of one loop, where each copied the core's link objects and imports by hand
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
-rw-r--r--build.zig43
1 files changed, 14 insertions, 29 deletions
diff --git a/build.zig b/build.zig
index ad8abccd..ff9f1550 100644
--- a/build.zig
+++ b/build.zig
@@ -1724,35 +1724,20 @@ pub fn build(b: *std.Build) void {
kitty_test_step.dependOn(&run_kitty_tests.step);
if (testMatch(b, unit_profile, test_filters, kitty_test_step)) |check| check.addArtifactArg(kitty_tests);
- // Keep native transport integration reachable even when the core's
- // anonymous test-import block is filtered out by Zig.
- const ninep_io_module = b.createModule(.{
- .root_source_file = b.path("src/9p_io.zig"),
- .target = target,
- .optimize = optimize,
- .link_libc = true,
- });
- ninep_io_module.link_objects.appendSlice(b.allocator, core_module.link_objects.items) catch @panic("OOM");
- var ninep_imports = core_module.import_table.iterator();
- while (ninep_imports.next()) |entry| ninep_io_module.addImport(entry.key_ptr.*, entry.value_ptr.*);
- const ninep_io_tests = b.addTest(.{
- .root_module = ninep_io_module,
- .filters = &.{ "Unix and TCP", "one fetch", "expired sessions", "posts itself" },
- });
- b.step("9p-io-test", "run native 9P transport and client integration tests")
- .dependOn(&b.addRunArtifact(ninep_io_tests).step);
-
- const fs_module = b.createModule(.{
- .root_source_file = b.path("src/fs.zig"),
- .target = target,
- .optimize = optimize,
- .link_libc = true,
- });
- fs_module.link_objects.appendSlice(b.allocator, core_module.link_objects.items) catch @panic("OOM");
- var fs_imports = core_module.import_table.iterator();
- while (fs_imports.next()) |entry| fs_module.addImport(entry.key_ptr.*, entry.value_ptr.*);
- const fs_tests = b.addTest(.{ .root_module = fs_module, .filters = test_filters });
- b.step("fs-unit-test", "run filesystem unit tests").dependOn(&b.addRunArtifact(fs_tests).step);
+ // 9p_io.zig's and fs.zig's tests as roots of their own, on the
+ // core's imports and C libraries: native transport integration
+ // 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 = "src/fs.zig", .step = "fs-unit-test", .about = "run filesystem unit tests", .filters = test_filters },
+ }) |t| {
+ const m = b.createModule(.{ .root_source_file = b.path(t.path), .target = target, .optimize = optimize, .link_libc = true });
+ m.link_objects.appendSlice(b.allocator, core_module.link_objects.items) catch @panic("OOM");
+ var imports = core_module.import_table.iterator();
+ while (imports.next()) |entry| m.addImport(entry.key_ptr.*, entry.value_ptr.*);
+ b.step(t.step, t.about).dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = m, .filters = t.filters })).step);
+ }
const protocol_step = b.step("9p-test", "run freestanding 9P protocol tests");
const protocol_match = testMatch(b, unit_profile, test_filters, protocol_step);