| ... | ... | @@ -12,7 +12,7 @@ pub const std_options: std.Options = .{ |
| 12 | 12 | }; |
| 13 | 13 | |
| 14 | 14 | var log_err_count: usize = 0; |
| 15 | | var fba = std.heap.FixedBufferAllocator.init(&fba_buffer); |
| 15 | var fba: std.heap.FixedBufferAllocator = .init(&fba_buffer); |
| 16 | 16 | var fba_buffer: [8192]u8 = undefined; |
| 17 | 17 | var stdin_buffer: [4096]u8 = undefined; |
| 18 | 18 | var stdout_buffer: [4096]u8 = undefined; |
| ... | ... | @@ -131,6 +131,7 @@ fn mainServer() !void { |
| 131 | 131 | |
| 132 | 132 | .run_test => { |
| 133 | 133 | testing.allocator_instance = .{}; |
| 134 | testing.io_instance = .init(fba.allocator()); |
| 134 | 135 | log_err_count = 0; |
| 135 | 136 | const index = try server.receiveBody_u32(); |
| 136 | 137 | const test_fn = builtin.test_functions[index]; |
| ... | ... | @@ -152,6 +153,8 @@ fn mainServer() !void { |
| 152 | 153 | break :s .fail; |
| 153 | 154 | }, |
| 154 | 155 | }; |
| 156 | testing.io_instance.deinit(); |
| 157 | fba.reset(); |
| 155 | 158 | const leak_count = testing.allocator_instance.detectLeaks(); |
| 156 | 159 | testing.allocator_instance.deinitWithoutLeakChecks(); |
| 157 | 160 | try server.serveTestResults(.{ |
| ... | ... | @@ -228,18 +231,13 @@ fn mainTerminal() void { |
| 228 | 231 | }); |
| 229 | 232 | const have_tty = std.fs.File.stderr().isTty(); |
| 230 | 233 | |
| 231 | | var async_frame_buffer: []align(builtin.target.stackAlignment()) u8 = undefined; |
| 232 | | // TODO this is on the next line (using `undefined` above) because otherwise zig incorrectly |
| 233 | | // ignores the alignment of the slice. |
| 234 | | async_frame_buffer = &[_]u8{}; |
| 235 | | |
| 236 | 234 | var leaks: usize = 0; |
| 237 | 235 | for (test_fn_list, 0..) |test_fn, i| { |
| 238 | 236 | testing.allocator_instance = .{}; |
| 237 | testing.io_instance = .init(fba.allocator()); |
| 239 | 238 | defer { |
| 240 | | if (testing.allocator_instance.deinit() == .leak) { |
| 241 | | leaks += 1; |
| 242 | | } |
| 239 | if (testing.allocator_instance.deinit() == .leak) leaks += 1; |
| 240 | testing.io_instance.deinit(); |
| 243 | 241 | } |
| 244 | 242 | testing.log_level = .warn; |
| 245 | 243 | |