| ... | ... | @@ -672,6 +672,7 @@ const usage_build_generic = |
| 672 | 672 | \\ --test-cmd-bin Appends test binary path to test cmd args |
| 673 | 673 | \\ --test-no-exec Compiles test binary without running it |
| 674 | 674 | \\ --test-runner [path] Specify a custom test runner |
| 675 | \\ --test-execve Runs the test binary with execve if available instead of as a child process |
| 675 | 676 | \\ |
| 676 | 677 | \\Debug Options (Zig Compiler Development): |
| 677 | 678 | \\ -fopt-bisect-limit=[limit] Only run [limit] first LLVM optimization passes |
| ... | ... | @@ -888,6 +889,7 @@ fn buildOutputType( |
| 888 | 889 | var linker_optimization: ?[]const u8 = null; |
| 889 | 890 | var linker_module_definition_file: ?[]const u8 = null; |
| 890 | 891 | var test_no_exec = false; |
| 892 | var test_execve = false; |
| 891 | 893 | var entry: Compilation.CreateOptions.Entry = .default; |
| 892 | 894 | var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty; |
| 893 | 895 | var stack_size: ?u64 = null; |
| ... | ... | @@ -1393,6 +1395,8 @@ fn buildOutputType( |
| 1393 | 1395 | test_no_exec = true; |
| 1394 | 1396 | } else if (mem.eql(u8, arg, "--time-report")) { |
| 1395 | 1397 | time_report = true; |
| 1398 | } else if (mem.eql(u8, arg, "--test-execve")) { |
| 1399 | test_execve = true; |
| 1396 | 1400 | } else if (mem.eql(u8, arg, "-fstack-report")) { |
| 1397 | 1401 | stack_report = true; |
| 1398 | 1402 | } else if (mem.eql(u8, arg, "-fPIC")) { |
| ... | ... | @@ -3770,6 +3774,7 @@ fn buildOutputType( |
| 3770 | 3774 | all_args, |
| 3771 | 3775 | runtime_args_start, |
| 3772 | 3776 | create_module.resolved_options.link_libc, |
| 3777 | test_execve, |
| 3773 | 3778 | environ_map, |
| 3774 | 3779 | ); |
| 3775 | 3780 | } |
| ... | ... | @@ -4407,6 +4412,7 @@ fn runOrTest( |
| 4407 | 4412 | all_args: []const []const u8, |
| 4408 | 4413 | runtime_args_start: ?usize, |
| 4409 | 4414 | link_libc: bool, |
| 4415 | test_execve: bool, |
| 4410 | 4416 | environ_map: *process.Environ.Map, |
| 4411 | 4417 | ) !void { |
| 4412 | 4418 | const raw_emit_bin = comp.emit_bin orelse return; |
| ... | ... | @@ -4448,7 +4454,7 @@ fn runOrTest( |
| 4448 | 4454 | |
| 4449 | 4455 | // We do not execve for tests because if the test fails we want to print |
| 4450 | 4456 | // the error message and invocation below. |
| 4451 | | if (process.can_replace and arg_mode == .run) { |
| 4457 | if (process.can_replace and (arg_mode == .run or (arg_mode == .zig_test and test_execve))) { |
| 4452 | 4458 | // process replacement releases the locks; no need to destroy the Compilation here. |
| 4453 | 4459 | _ = try io.lockStderr(&.{}, .no_color); |
| 4454 | 4460 | const err = process.replace(io, .{ .argv = argv.items, .environ_map = environ_map }); |