WIP: add remote_endpoint_test

This commit is contained in:
CJ van den Berg 2026-03-07 14:46:18 +01:00
parent b580d9da36
commit 0e804fc61f
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
6 changed files with 462 additions and 7 deletions

View file

@ -86,6 +86,16 @@ pub fn build(b: *std.Build) void {
});
const cbor_mod = cbor_dep.module("cbor");
// thespian_mod must come before anything that depends on it.
const thespian_mod = b.addModule("thespian", .{
.root_source_file = b.path("src/thespian.zig"),
.imports = &.{
.{ .name = "cbor", .module = cbor_mod },
},
});
thespian_mod.addIncludePath(b.path("include"));
thespian_mod.linkLibrary(lib);
const framing_mod = b.createModule(.{
.root_source_file = b.path("src/remote/framing.zig"),
});
@ -97,6 +107,18 @@ pub fn build(b: *std.Build) void {
},
});
const endpoint_mod = b.createModule(.{
.root_source_file = b.path("src/remote/endpoint.zig"),
.imports = &.{
.{ .name = "thespian", .module = thespian_mod },
.{ .name = "cbor", .module = cbor_mod },
.{ .name = "framing", .module = framing_mod },
.{ .name = "protocol", .module = protocol_mod },
},
});
// --- Child binaries (no Thespian context) ---
const remote_child = b.addExecutable(.{
.name = "remote_child_send",
.root_module = b.createModule(.{
@ -123,14 +145,27 @@ pub fn build(b: *std.Build) void {
}),
});
const thespian_mod = b.addModule("thespian", .{
.root_source_file = b.path("src/thespian.zig"),
.imports = &.{
.{ .name = "cbor", .module = cbor_mod },
},
// --- Child endpoint binary (full Thespian context) ---
const remote_child_endpoint = b.addExecutable(.{
.name = "remote_child_endpoint",
.root_module = b.createModule(.{
.root_source_file = b.path("test/remote_child_endpoint.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "thespian", .module = thespian_mod },
.{ .name = "cbor", .module = cbor_mod },
.{ .name = "framing", .module = framing_mod },
.{ .name = "protocol", .module = protocol_mod },
},
}),
});
thespian_mod.addIncludePath(b.path("include"));
thespian_mod.linkLibrary(lib);
remote_child_endpoint.linkLibrary(lib);
remote_child_endpoint.linkLibrary(asio_dep.artifact("asio"));
remote_child_endpoint.linkLibCpp();
// --- Test suite ---
const tests = b.addTest(.{
.root_module = b.createModule(.{
@ -142,12 +177,14 @@ pub fn build(b: *std.Build) void {
options.addOptionPath("remote_child_path", remote_child.getEmittedBin());
options.addOptionPath("remote_child_roundtrip_path", remote_child_roundtrip.getEmittedBin());
options.addOptionPath("remote_child_endpoint_path", remote_child_endpoint.getEmittedBin());
tests.root_module.addImport("build_options", options_mod);
tests.root_module.addImport("cbor", cbor_mod);
tests.root_module.addImport("thespian", thespian_mod);
tests.root_module.addImport("framing", framing_mod);
tests.root_module.addImport("protocol", protocol_mod);
tests.root_module.addImport("endpoint", endpoint_mod);
tests.addIncludePath(b.path("test"));
tests.addIncludePath(b.path("src"));
tests.addIncludePath(b.path("include"));