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 =...@@ -420,6 +420,7 @@ const usage_build_generic =
420 \\ --test-cmd [arg] Specify test execution command one arg at a time420 \\ --test-cmd [arg] Specify test execution command one arg at a time
421 \\ --test-cmd-bin Appends test binary path to test cmd args421 \\ --test-cmd-bin Appends test binary path to test cmd args
422 \\ --test-evented-io Runs the test in evented I/O mode422 \\ --test-evented-io Runs the test in evented I/O mode
423 \\ --test-no-exec Compiles test binary without running it
423 \\424 \\
424 \\Debug Options (Zig Compiler Development):425 \\Debug Options (Zig Compiler Development):
425 \\ -ftime-report Print timing diagnostics426 \\ -ftime-report Print timing diagnostics
...@@ -603,6 +604,7 @@ fn buildOutputType(...@@ -603,6 +604,7 @@ fn buildOutputType(
603 var linker_nxcompat = false;604 var linker_nxcompat = false;
604 var linker_dynamicbase = false;605 var linker_dynamicbase = false;
605 var test_evented_io = false;606 var test_evented_io = false;
607 var test_no_exec = false;
606 var stack_size_override: ?u64 = null;608 var stack_size_override: ?u64 = null;
607 var image_base_override: ?u64 = null;609 var image_base_override: ?u64 = null;
608 var use_llvm: ?bool = null;610 var use_llvm: ?bool = null;
...@@ -938,6 +940,8 @@ fn buildOutputType(...@@ -938,6 +940,8 @@ fn buildOutputType(
938 try test_exec_args.append(null);940 try test_exec_args.append(null);
939 } else if (mem.eql(u8, arg, "--test-evented-io")) {941 } else if (mem.eql(u8, arg, "--test-evented-io")) {
940 test_evented_io = true;942 test_evented_io = true;
943 } else if (mem.eql(u8, arg, "--test-no-exec")) {
944 test_no_exec = true;
941 } else if (mem.eql(u8, arg, "--watch")) {945 } else if (mem.eql(u8, arg, "--watch")) {
942 watch = true;946 watch = true;
943 } else if (mem.eql(u8, arg, "-ftime-report")) {947 } else if (mem.eql(u8, arg, "-ftime-report")) {
...@@ -2167,7 +2171,8 @@ fn buildOutputType(...@@ -2167,7 +2171,8 @@ fn buildOutputType(
2167 }2171 }
21682172
2169 const run_or_test = switch (arg_mode) {2173 const run_or_test = switch (arg_mode) {
2170 .run, .zig_test => true,2174 .run => true,
2175 .zig_test => !test_no_exec,
2171 else => false,2176 else => false,
2172 };2177 };
2173 if (run_or_test) {2178 if (run_or_test) {