diff --git a/build.zig b/build.zig index 5745498..f4b1783 100644 --- a/build.zig +++ b/build.zig @@ -1074,6 +1074,25 @@ pub fn build(b: *std.Build) void { // Charts read straight out of a .zip, and the aux files that travel with // them: pure over std, so each tests alone. _ = addPkgTest(b, test_step, "src/zipsrc.zig", target, optimize, &.{}); + // src/chart.zig holds tests no other step collects: the engine imports it + // as a module, and a module import leaves another module's test blocks out. + // It needs libc for portray's embedded Lua. + addPkgTest(b, test_step, "src/chart.zig", target, optimize, &.{ + .{ .name = "s57", .module = s57_mod }, + .{ .name = "s101", .module = s101_mod }, + .{ .name = "tiles", .module = tiles_mod }, + .{ .name = "scene", .module = scene_mod }, + .{ .name = "render", .module = render_mod }, + .{ .name = "portray", .module = portray_mod }, + .{ .name = "sprite", .module = sprite_mod }, + .{ .name = "catalog", .module = catalog_embed }, + .{ .name = "zipsrc", .module = zipsrc_mod }, + .{ .name = "auxfiles", .module = auxfiles_mod }, + .{ .name = "style", .module = style_mod }, + .{ .name = "coverage", .module = coverage_mod }, + .{ .name = "compose", .module = compose_mod }, + .{ .name = "raster", .module = raster_mod }, + }).link_libc = true; _ = addPkgTest(b, test_step, "src/auxfiles.zig", target, optimize, &.{}); // Geometry core for the cross-band composition. No longer std-only: plane.zig // reads its partition tuning/stats valves via std.c.getenv, so the test binary diff --git a/src/chart.zig b/src/chart.zig index 42ac17c..8bacb9b 100644 --- a/src/chart.zig +++ b/src/chart.zig @@ -39,6 +39,17 @@ const zipsrc = @import("zipsrc"); // charts read straight out of a .zip const auxfiles = @import("auxfiles"); // the text and pictures a cell points at const raster_pkg = @import("raster"); // picture charts, for the inventory probe +// lua_shim.c is compiled into every binary that links the portray module, and +// it references 30 symbols exported from portray.zig, s101/catalogue.zig and +// portray/rules_embed.zig. Zig emits an export only after analyzing the +// declaration, and the tests in this file reach none of the three, so without +// these references a test binary links lua_shim.o against 30 undefined +// symbols. rules_embed follows from portray. +comptime { + _ = portray; + _ = catalogue; +} + // c_allocator, not smp_allocator: smp's per-CPU slab freelists never return // pages to the OS, so a long-lived host process's footprint ratchets up to the // worst transient peak (compose bursts) and never recovers. libc malloc frees