aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-05-17 15:28:22 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-05-17 16:09:20 -0700
commitab6b0ad8a4f858c8e4e5591b2383156eab8ac0e4 (patch)
treee47a08f4349d8837819bb0ca1537a8e91976f729
parent8a7a07f30dc9aedb596db327f57d5dc12f2ffd52 (diff)
downloadzig-ab6b0ad8a4f858c8e4e5591b2383156eab8ac0e4.tar.gz
zig-ab6b0ad8a4f858c8e4e5591b2383156eab8ac0e4.zip
test runner: prepare stage2 workaround
This provides a simpler test runner that exercises fewer language features so that we can get to the point faster where `zig test` works for stage2.
-rw-r--r--lib/std/special/test_runner.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/std/special/test_runner.zig b/lib/std/special/test_runner.zig
index 7d03e4b059..d78de41436 100644
--- a/lib/std/special/test_runner.zig
+++ b/lib/std/special/test_runner.zig
@@ -22,6 +22,9 @@ fn processArgs() void {
}
pub fn main() anyerror!void {
+ if (builtin.zig_is_stage2) {
+ return main2();
+ }
processArgs();
const test_fn_list = builtin.test_functions;
var ok_count: usize = 0;
@@ -123,3 +126,10 @@ pub fn log(
std.debug.print("[{s}] ({s}): " ++ format ++ "\n", .{ @tagName(scope), @tagName(message_level) } ++ args);
}
}
+
+pub fn main2() anyerror!void {
+ // Simpler main(), exercising fewer language features, so that stage2 can handle it.
+ for (builtin.test_functions) |test_fn| {
+ try test_fn.func();
+ }
+}