valgrind no timeout
This commit is contained in:
19
build.zig
19
build.zig
@@ -48,7 +48,7 @@ pub fn build(b: *std.Build) !void {
|
||||
const cc = b.option([]const u8, "cc", "C compiler") orelse "zig";
|
||||
const no_exec = b.option(bool, "no-exec", "Compile test binary without running it") orelse false;
|
||||
const valgrind = b.option(bool, "valgrind", "Run tests under valgrind") orelse false;
|
||||
const test_timeout = b.option([]const u8, "test-timeout", "Test execution timeout (default: 10s, or 60s with valgrind)");
|
||||
const test_timeout = b.option([]const u8, "test-timeout", "Test execution timeout (default: 10s, none with valgrind)");
|
||||
|
||||
const target = blk: {
|
||||
var query = b.standardTargetOptionsQueryOnly(.{});
|
||||
@@ -166,11 +166,22 @@ fn addTestStep(
|
||||
.use_llvm = false,
|
||||
.use_lld = false,
|
||||
});
|
||||
const timeout = test_timeout orelse if (valgrind) "300" else "10";
|
||||
const timeout: ?[]const u8 = test_timeout orelse if (valgrind) null else "10";
|
||||
if (valgrind) {
|
||||
if (timeout) |t|
|
||||
test_exe.setExecCmd(&.{
|
||||
"timeout",
|
||||
timeout,
|
||||
t,
|
||||
"valgrind",
|
||||
"--error-exitcode=2",
|
||||
"--leak-check=full",
|
||||
"--show-leak-kinds=all",
|
||||
"--errors-for-leak-kinds=all",
|
||||
"--track-fds=yes",
|
||||
null,
|
||||
})
|
||||
else
|
||||
test_exe.setExecCmd(&.{
|
||||
"valgrind",
|
||||
"--error-exitcode=2",
|
||||
"--leak-check=full",
|
||||
@@ -180,7 +191,7 @@ fn addTestStep(
|
||||
null,
|
||||
});
|
||||
} else {
|
||||
test_exe.setExecCmd(&.{ "timeout", timeout, null });
|
||||
test_exe.setExecCmd(&.{ "timeout", timeout orelse "10", null });
|
||||
}
|
||||
if (no_exec) {
|
||||
const install = b.addInstallArtifact(test_exe, .{});
|
||||
|
||||
Reference in New Issue
Block a user