authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2025-12-29 21:02:11-05:00
committergravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2025-12-29 21:06:08-05:00
log1ea2d5692d5e0ed5adf1a398f43a442b22c7563d
tree2569b8adc79631db8f9cfa093f078fda95037a62
parent51728f10535d9a10fcee85a6e03ee82e3211a149
signaturelock-open Commit is signed but in an unrecognized format.

openbsd: init Io.Threaded.argv0 for tests

Some tests (eg. std.process.openExecutable) require argv0 for OpenBSD, otherwise error.OperationUnsupported is encountered.

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

lib/compiler/test_runner.zig+10-6
......@@ -66,13 +66,13 @@ pub fn main() void {
6666 }
6767
6868 if (listen) {
69 return mainServer() catch @panic("internal test runner failure");
69 return mainServer(args) catch @panic("internal test runner failure");
7070 } else {
71 return mainTerminal();
71 return mainTerminal(args);
7272 }
7373}
7474
75fn mainServer() !void {
75fn mainServer(args: []const [:0]const u8) !void {
7676 @disableInstrumentation();
7777 var stdin_reader = Io.File.stdin().readerStreaming(runner_threaded_io, &stdin_buffer);
7878 var stdout_writer = Io.File.stdout().writerStreaming(runner_threaded_io, &stdout_buffer);
......@@ -131,7 +131,9 @@ fn mainServer() !void {
131131
132132 .run_test => {
133133 testing.allocator_instance = .{};
134 testing.io_instance = .init(testing.allocator, .{});
134 testing.io_instance = .init(testing.allocator, .{
135 .argv0 = if (@hasField(Io.Threaded.Argv0, "value")) .{ .value = args[0] } else .{},
136 });
135137 log_err_count = 0;
136138 const index = try server.receiveBody_u32();
137139 const test_fn = builtin.test_functions[index];
......@@ -215,7 +217,7 @@ fn mainServer() !void {
215217 }
216218}
217219
218fn mainTerminal() void {
220fn mainTerminal(args: []const [:0]const u8) void {
219221 @disableInstrumentation();
220222 if (builtin.fuzz) @panic("fuzz test requires server");
221223
......@@ -233,7 +235,9 @@ fn mainTerminal() void {
233235 var leaks: usize = 0;
234236 for (test_fn_list, 0..) |test_fn, i| {
235237 testing.allocator_instance = .{};
236 testing.io_instance = .init(testing.allocator, .{});
238 testing.io_instance = .init(testing.allocator, .{
239 .argv0 = if (@hasField(Io.Threaded.Argv0, "value")) .{ .value = args[0] } else .{},
240 });
237241 defer {
238242 testing.io_instance.deinit();
239243 if (testing.allocator_instance.deinit() == .leak) leaks += 1;