authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-25 15:36:21-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-26 19:58:56-08:00
logb0691df5ba898c8f6ac2c03e19e312502a2a0cc5
tree7fa1cb5bca6c8b8e3337da4c08ac329fe4b6986e
parent0126e71903fbb71ce0d968034920e2869f60548f

test_runner: fix simple runner compilation


1 files changed, 8 insertions(+), 6 deletions(-)

lib/compiler/test_runner.zig+8-6
...@@ -329,6 +329,8 @@ pub fn mainSimple() anyerror!void {...@@ -329,6 +329,8 @@ pub fn mainSimple() anyerror!void {
329 else => false,329 else => false,
330 };330 };
331331
332 testing.io_instance = .init(testing.allocator, .{});
333
332 var passed: u64 = 0;334 var passed: u64 = 0;
333 var skipped: u64 = 0;335 var skipped: u64 = 0;
334 var failed: u64 = 0;336 var failed: u64 = 0;
...@@ -338,26 +340,26 @@ pub fn mainSimple() anyerror!void {...@@ -338,26 +340,26 @@ pub fn mainSimple() anyerror!void {
338340
339 for (builtin.test_functions) |test_fn| {341 for (builtin.test_functions) |test_fn| {
340 if (enable_write) {342 if (enable_write) {
341 stdout.writeAll(test_fn.name) catch {};343 stdout.writeStreamingAll(runner_threaded_io, test_fn.name) catch {};
342 stdout.writeAll("... ") catch {};344 stdout.writeStreamingAll(runner_threaded_io, "... ") catch {};
343 }345 }
344 if (test_fn.func()) |_| {346 if (test_fn.func()) |_| {
345 if (enable_write) stdout.writeAll("PASS\n") catch {};347 if (enable_write) stdout.writeStreamingAll(runner_threaded_io, "PASS\n") catch {};
346 } else |err| {348 } else |err| {
347 if (err != error.SkipZigTest) {349 if (err != error.SkipZigTest) {
348 if (enable_write) stdout.writeAll("FAIL\n") catch {};350 if (enable_write) stdout.writeStreamingAll(runner_threaded_io, "FAIL\n") catch {};
349 failed += 1;351 failed += 1;
350 if (!enable_write) return err;352 if (!enable_write) return err;
351 continue;353 continue;
352 }354 }
353 if (enable_write) stdout.writeAll("SKIP\n") catch {};355 if (enable_write) stdout.writeStreamingAll(runner_threaded_io, "SKIP\n") catch {};
354 skipped += 1;356 skipped += 1;
355 continue;357 continue;
356 }358 }
357 passed += 1;359 passed += 1;
358 }360 }
359 if (enable_print) {361 if (enable_print) {
360 var stdout_writer = stdout.writer(&.{});362 var stdout_writer = stdout.writer(runner_threaded_io, &.{});
361 stdout_writer.interface.print("{} passed, {} skipped, {} failed\n", .{ passed, skipped, failed }) catch {};363 stdout_writer.interface.print("{} passed, {} skipped, {} failed\n", .{ passed, skipped, failed }) catch {};
362 }364 }
363 if (failed != 0) std.process.exit(1);365 if (failed != 0) std.process.exit(1);