From c23768ab2c18354479618d99f7f32ce8a6d4b62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Thu, 24 Jun 2021 11:21:32 +0200 Subject: [PATCH] zig test: Add a --test-no-exec flag. --- src/main.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index e56f1ba07e..ddccd02b6d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -420,6 +420,7 @@ const usage_build_generic = \\ --test-cmd [arg] Specify test execution command one arg at a time \\ --test-cmd-bin Appends test binary path to test cmd args \\ --test-evented-io Runs the test in evented I/O mode + \\ --test-no-exec Compiles test binary without running it \\ \\Debug Options (Zig Compiler Development): \\ -ftime-report Print timing diagnostics @@ -603,6 +604,7 @@ fn buildOutputType( var linker_nxcompat = false; var linker_dynamicbase = false; var test_evented_io = false; + var test_no_exec = false; var stack_size_override: ?u64 = null; var image_base_override: ?u64 = null; var use_llvm: ?bool = null; @@ -938,6 +940,8 @@ fn buildOutputType( try test_exec_args.append(null); } else if (mem.eql(u8, arg, "--test-evented-io")) { test_evented_io = true; + } else if (mem.eql(u8, arg, "--test-no-exec")) { + test_no_exec = true; } else if (mem.eql(u8, arg, "--watch")) { watch = true; } else if (mem.eql(u8, arg, "-ftime-report")) { @@ -2167,7 +2171,8 @@ fn buildOutputType( } const run_or_test = switch (arg_mode) { - .run, .zig_test => true, + .run => true, + .zig_test => !test_no_exec, else => false, }; if (run_or_test) {