valgrind no timeout
This commit is contained in:
39
build.zig
39
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 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 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 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: {
|
const target = blk: {
|
||||||
var query = b.standardTargetOptionsQueryOnly(.{});
|
var query = b.standardTargetOptionsQueryOnly(.{});
|
||||||
@@ -166,21 +166,32 @@ fn addTestStep(
|
|||||||
.use_llvm = false,
|
.use_llvm = false,
|
||||||
.use_lld = 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 (valgrind) {
|
||||||
test_exe.setExecCmd(&.{
|
if (timeout) |t|
|
||||||
"timeout",
|
test_exe.setExecCmd(&.{
|
||||||
timeout,
|
"timeout",
|
||||||
"valgrind",
|
t,
|
||||||
"--error-exitcode=2",
|
"valgrind",
|
||||||
"--leak-check=full",
|
"--error-exitcode=2",
|
||||||
"--show-leak-kinds=all",
|
"--leak-check=full",
|
||||||
"--errors-for-leak-kinds=all",
|
"--show-leak-kinds=all",
|
||||||
"--track-fds=yes",
|
"--errors-for-leak-kinds=all",
|
||||||
null,
|
"--track-fds=yes",
|
||||||
});
|
null,
|
||||||
|
})
|
||||||
|
else
|
||||||
|
test_exe.setExecCmd(&.{
|
||||||
|
"valgrind",
|
||||||
|
"--error-exitcode=2",
|
||||||
|
"--leak-check=full",
|
||||||
|
"--show-leak-kinds=all",
|
||||||
|
"--errors-for-leak-kinds=all",
|
||||||
|
"--track-fds=yes",
|
||||||
|
null,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
test_exe.setExecCmd(&.{ "timeout", timeout, null });
|
test_exe.setExecCmd(&.{ "timeout", timeout orelse "10", null });
|
||||||
}
|
}
|
||||||
if (no_exec) {
|
if (no_exec) {
|
||||||
const install = b.addInstallArtifact(test_exe, .{});
|
const install = b.addInstallArtifact(test_exe, .{});
|
||||||
|
|||||||
Reference in New Issue
Block a user