build: add mode paramater to testStep functions

This commit is contained in:
alichraghi 2022-07-20 16:31:57 +04:30 committed by Stephen Gutekanst
parent 26f5a7a490
commit e0884da649

View file

@ -4,12 +4,14 @@ const Builder = std.build.Builder;
const system_sdk = @import("system_sdk.zig"); const system_sdk = @import("system_sdk.zig");
pub fn build(b: *Builder) void { pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const test_step = b.step("test", "Run library tests"); const test_step = b.step("test", "Run library tests");
test_step.dependOn(&testStep(b).step); test_step.dependOn(&testStep(b, mode).step);
} }
pub fn testStep(b: *Builder) *std.build.LibExeObjStep { pub fn testStep(b: *Builder, mode: std.builtin.Mode) *std.build.LibExeObjStep {
const main_tests = b.addTest(thisDir() ++ "/src/main.zig"); const main_tests = b.addTest(thisDir() ++ "/src/main.zig");
main_tests.setBuildMode(mode);
link(b, main_tests, .{}); link(b, main_tests, .{});
return main_tests; return main_tests;
} }