| ... | ... | @@ -148,11 +148,7 @@ fn mainServer() !void { |
| 148 | 148 | const test_fn = builtin.test_functions[index]; |
| 149 | 149 | const entry_addr = @intFromPtr(test_fn.func); |
| 150 | 150 | try server.serveU64Message(.fuzz_start_addr, entry_addr); |
| 151 | | const prev_allocator_state = testing.allocator_instance; |
| 152 | | defer { |
| 153 | | testing.allocator_instance = prev_allocator_state; |
| 154 | | if (testing.allocator_instance.deinit() == .leak) std.process.exit(1); |
| 155 | | } |
| 151 | defer if (testing.allocator_instance.deinit() == .leak) std.process.exit(1); |
| 156 | 152 | is_fuzz_test = false; |
| 157 | 153 | test_fn.func() catch |err| switch (err) { |
| 158 | 154 | error.SkipZigTest => return, |
| ... | ... | @@ -383,18 +379,24 @@ pub fn fuzz( |
| 383 | 379 | testOne(input_ptr[0..input_len]) catch |err| switch (err) { |
| 384 | 380 | error.SkipZigTest => return, |
| 385 | 381 | else => { |
| 386 | | if (@errorReturnTrace()) |trace| { |
| 387 | | std.debug.dumpStackTrace(trace.*); |
| 388 | | } |
| 382 | std.debug.lockStdErr(); |
| 383 | if (@errorReturnTrace()) |trace| std.debug.dumpStackTrace(trace.*); |
| 389 | 384 | std.debug.print("failed with error.{s}\n", .{@errorName(err)}); |
| 390 | 385 | std.process.exit(1); |
| 391 | 386 | }, |
| 392 | 387 | }; |
| 393 | | if (log_err_count != 0) @panic("error logs detected"); |
| 388 | if (log_err_count != 0) { |
| 389 | std.debug.lockStdErr(); |
| 390 | std.debug.print("error logs detected\n", .{}); |
| 391 | std.process.exit(1); |
| 392 | } |
| 394 | 393 | } |
| 395 | 394 | }; |
| 396 | 395 | if (builtin.fuzz) { |
| 396 | const prev_allocator_state = testing.allocator_instance; |
| 397 | testing.allocator_instance = .{}; |
| 397 | 398 | fuzzer_start(&global.fuzzer_one); |
| 399 | testing.allocator_instance = prev_allocator_state; |
| 398 | 400 | return; |
| 399 | 401 | } |
| 400 | 402 | |