authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2021-06-24 11:21:32+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-10-04 22:21:37-04:00
logc23768ab2c18354479618d99f7f32ce8a6d4b62f
treed5caf27ec2a82a43f7147bf37d83701b50e0a4a4
parent4e590fadb5367d0400fd7e192f519caf3435e07b

zig test: Add a --test-no-exec flag.


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

src/main.zig+6-1
......@@ -420,6 +420,7 @@ const usage_build_generic =
420420 \\ --test-cmd [arg] Specify test execution command one arg at a time
421421 \\ --test-cmd-bin Appends test binary path to test cmd args
422422 \\ --test-evented-io Runs the test in evented I/O mode
423 \\ --test-no-exec Compiles test binary without running it
423424 \\
424425 \\Debug Options (Zig Compiler Development):
425426 \\ -ftime-report Print timing diagnostics
......@@ -603,6 +604,7 @@ fn buildOutputType(
603604 var linker_nxcompat = false;
604605 var linker_dynamicbase = false;
605606 var test_evented_io = false;
607 var test_no_exec = false;
606608 var stack_size_override: ?u64 = null;
607609 var image_base_override: ?u64 = null;
608610 var use_llvm: ?bool = null;
......@@ -938,6 +940,8 @@ fn buildOutputType(
938940 try test_exec_args.append(null);
939941 } else if (mem.eql(u8, arg, "--test-evented-io")) {
940942 test_evented_io = true;
943 } else if (mem.eql(u8, arg, "--test-no-exec")) {
944 test_no_exec = true;
941945 } else if (mem.eql(u8, arg, "--watch")) {
942946 watch = true;
943947 } else if (mem.eql(u8, arg, "-ftime-report")) {
......@@ -2167,7 +2171,8 @@ fn buildOutputType(
21672171 }
21682172
21692173 const run_or_test = switch (arg_mode) {
2170 .run, .zig_test => true,
2174 .run => true,
2175 .zig_test => !test_no_exec,
21712176 else => false,
21722177 };
21732178 if (run_or_test) {