summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig32
1 files changed, 31 insertions, 1 deletions
diff --git a/build.zig b/build.zig
index 13e54ec..334da9f 100644
--- a/build.zig
+++ b/build.zig
@@ -36,7 +36,6 @@ pub fn build(b: *std.Build) void {
.root_source_file = b.path("web/main.zig"),
.target = target,
.optimize = optimize,
- .link_libc = true,
.imports = &.{.{ .name = "cloud9", .module = module }},
}) });
bridge.root_module.addAnonymousImport("client.wasm", .{ .root_source_file = wasm.getEmittedBin() });
@@ -58,6 +57,19 @@ pub fn build(b: *std.Build) void {
.imports = &.{.{ .name = "cloud9", .module = module }},
}) });
b.step("http-test", "Test HTTP WebSocket transport framing").dependOn(&b.addRunArtifact(http_tests).step);
+ const mux_mod = b.createModule(.{
+ .root_source_file = b.path("web/mux.zig"),
+ .target = target,
+ .optimize = optimize,
+ .imports = &.{.{ .name = "cloud9", .module = module }},
+ });
+ const mux_tests = b.addTest(.{ .root_module = b.createModule(.{
+ .root_source_file = b.path("test/web/mux.zig"),
+ .target = target,
+ .optimize = optimize,
+ .imports = &.{ .{ .name = "cloud9", .module = module }, .{ .name = "mux", .module = mux_mod } },
+ }) });
+ b.step("mux-test", "Test the 9web multiplexer (shared upstream, fid isolation, reconnect)").dependOn(&b.addRunArtifact(mux_tests).step);
const e2e = b.addSystemCommand(&.{ "node", "test/web/e2e.mjs" });
e2e.addArtifactArg(bridge);
e2e.addArtifactArg(native_http);
@@ -165,6 +177,24 @@ pub fn build(b: *std.Build) void {
if (i.debug_test_step) |s| programs_test.dependOn(s);
}
+ // 9web can embed 9proc for self-introspection (--probe). The module is
+ // linked into 9web only when 9proc is enabled (Linux); otherwise the probe
+ // code compiles to a stub selected by the have_probe build option.
+ {
+ const web_opts = b.addOptions();
+ web_opts.addOption(bool, "have_probe", proc != null);
+ bridge.root_module.addImport("build_options", web_opts.createModule());
+ if (proc) |i| bridge.root_module.addImport("9proc", i.module);
+ }
+
+ // The HTTP /fs mapping suite drives 9web against a 9proc-demo upstream.
+ if (proc) |i| if (i.demo) |demo| {
+ const hfs = b.addSystemCommand(&.{ "node", "test/web/http_fs.mjs" });
+ hfs.addArtifactArg(demo);
+ hfs.addArtifactArg(bridge);
+ b.step("http-fs-test", "Test the HTTP /fs view against a 9proc-demo upstream").dependOn(&hfs.step);
+ };
+
const ns: ?ns_build.Artifacts = if (want_9ns) ns_build.add(b, .{
.target = target,
.optimize = optimize,