refactor build system: separate test module and streamline test dependencies
This commit is contained in:
18
build.zig
18
build.zig
@@ -34,9 +34,18 @@ pub fn build(b: *std.Build) void
|
|||||||
.target = target,
|
.target = target,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const test_mod = b.createModule(.{
|
||||||
|
.root_source_file = b.path("src/root.zig"),
|
||||||
|
.target = target,
|
||||||
|
.link_libc = true,
|
||||||
|
});
|
||||||
|
|
||||||
mod.addImport("toml", toml_dep.module("toml"));
|
mod.addImport("toml", toml_dep.module("toml"));
|
||||||
mod.addImport("args", args_dep.module("args"));
|
mod.addImport("args", args_dep.module("args"));
|
||||||
|
|
||||||
|
test_mod.addImport("toml", toml_dep.module("toml"));
|
||||||
|
test_mod.addImport("args", args_dep.module("args"));
|
||||||
|
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "zocket",
|
.name = "zocket",
|
||||||
.root_module = b.createModule(.{
|
.root_module = b.createModule(.{
|
||||||
@@ -66,20 +75,13 @@ pub fn build(b: *std.Build) void
|
|||||||
}
|
}
|
||||||
|
|
||||||
const mod_tests = b.addTest(.{
|
const mod_tests = b.addTest(.{
|
||||||
.root_module = mod,
|
.root_module = test_mod,
|
||||||
});
|
});
|
||||||
|
|
||||||
const run_mod_tests = b.addRunArtifact(mod_tests);
|
const run_mod_tests = b.addRunArtifact(mod_tests);
|
||||||
|
|
||||||
const exe_tests = b.addTest(.{
|
|
||||||
.root_module = exe.root_module,
|
|
||||||
});
|
|
||||||
|
|
||||||
const run_exe_tests = b.addRunArtifact(exe_tests);
|
|
||||||
|
|
||||||
const test_step = b.step("test", "Run tests");
|
const test_step = b.step("test", "Run tests");
|
||||||
test_step.dependOn(&run_mod_tests.step);
|
test_step.dependOn(&run_mod_tests.step);
|
||||||
test_step.dependOn(&run_exe_tests.step);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getGitVersion(b: *std.Build) []const u8
|
fn getGitVersion(b: *std.Build) []const u8
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ pub const memory = @import("memory/util.zig");
|
|||||||
pub const signals = @import("signals/models.zig");
|
pub const signals = @import("signals/models.zig");
|
||||||
pub const logging = @import("logging/log.zig");
|
pub const logging = @import("logging/log.zig");
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
const std = @import("std");
|
||||||
|
|
||||||
test {
|
test {
|
||||||
_ = config;
|
std.testing.refAllDecls(@This());
|
||||||
_ = memory;
|
|
||||||
_ = signals;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user