mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
test runner: handle start_fuzzing message
This commit is contained in:
parent
bce3b1efb0
commit
7366b4b9e2
1 changed files with 22 additions and 0 deletions
|
|
@ -128,6 +128,28 @@ fn mainServer() !void {
|
|||
},
|
||||
});
|
||||
},
|
||||
.start_fuzzing => {
|
||||
const index = try server.receiveBody_u32();
|
||||
const test_fn = builtin.test_functions[index];
|
||||
while (true) {
|
||||
testing.allocator_instance = .{};
|
||||
defer if (testing.allocator_instance.deinit() == .leak) std.process.exit(1);
|
||||
log_err_count = 0;
|
||||
is_fuzz_test = false;
|
||||
test_fn.func() catch |err| switch (err) {
|
||||
error.SkipZigTest => continue,
|
||||
else => {
|
||||
if (@errorReturnTrace()) |trace| {
|
||||
std.debug.dumpStackTrace(trace.*);
|
||||
}
|
||||
std.debug.print("failed with error.{s}\n", .{@errorName(err)});
|
||||
std.process.exit(1);
|
||||
},
|
||||
};
|
||||
if (!is_fuzz_test) @panic("missed call to std.testing.fuzzInput");
|
||||
if (log_err_count != 0) @panic("error logs detected");
|
||||
}
|
||||
},
|
||||
|
||||
else => {
|
||||
std.debug.print("unsupported message: {x}\n", .{@intFromEnum(hdr.tag)});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue