| ... | @@ -185,7 +185,6 @@ fn mainServer(init: std.process.Init.Minimal) !void { | ... | @@ -185,7 +185,6 @@ fn mainServer(init: std.process.Init.Minimal) !void { |
| 185 | .environ = init.environ, | 185 | .environ = init.environ, |
| 186 | }); | 186 | }); |
| 187 | defer io_instance.deinit(); | 187 | defer io_instance.deinit(); |
| 188 | const io = io_instance.io(); | | |
| 189 | | 188 | |
| 190 | const mode: fuzz_abi.LimitKind = @fromBackingInt(@intCast(try server.receiveBody_u8())); | 189 | const mode: fuzz_abi.LimitKind = @fromBackingInt(@intCast(try server.receiveBody_u8())); |
| 191 | const amount_or_instance = try server.receiveBody_u64(); | 190 | const amount_or_instance = try server.receiveBody_u64(); |
| ... | @@ -208,7 +207,7 @@ fn mainServer(init: std.process.Init.Minimal) !void { | ... | @@ -208,7 +207,7 @@ fn mainServer(init: std.process.Init.Minimal) !void { |
| 208 | .indexes = test_indexes, | 207 | .indexes = test_indexes, |
| 209 | .server = &server, | 208 | .server = &server, |
| 210 | .gpa = gpa, | 209 | .gpa = gpa, |
| 211 | .io = io, | 210 | .threaded_io = &io_instance, |
| 212 | .input_poller = undefined, | 211 | .input_poller = undefined, |
| 213 | }; | 212 | }; |
| 214 | | 213 | |
| ... | @@ -422,7 +421,7 @@ var fuzz_runner: if (builtin.fuzz) struct { | ... | @@ -422,7 +421,7 @@ var fuzz_runner: if (builtin.fuzz) struct { |
| 422 | indexes: []u32, | 421 | indexes: []u32, |
| 423 | server: *std.zig.Server, | 422 | server: *std.zig.Server, |
| 424 | gpa: std.mem.Allocator, | 423 | gpa: std.mem.Allocator, |
| 425 | io: Io, | 424 | threaded_io: *Io.Threaded, |
| 426 | input_poller: Io.Future(Io.Cancelable!void), | 425 | input_poller: Io.Future(Io.Cancelable!void), |
| 427 | | 426 | |
| 428 | comptime { | 427 | comptime { |
| ... | @@ -443,6 +442,12 @@ var fuzz_runner: if (builtin.fuzz) struct { | ... | @@ -443,6 +442,12 @@ var fuzz_runner: if (builtin.fuzz) struct { |
| 443 | defer if (testing.allocator_instance.deinit() != 0) std.process.exit(1); | 442 | defer if (testing.allocator_instance.deinit() != 0) std.process.exit(1); |
| 444 | is_fuzz_test = false; | 443 | is_fuzz_test = false; |
| 445 | | 444 | |
| | 445 | testing.io_instance = .init(testing.allocator, .{ |
| | 446 | .argv0 = fuzz_runner.threaded_io.argv0, |
| | 447 | .environ = fuzz_runner.threaded_io.environ.process_environ, |
| | 448 | }); |
| | 449 | defer testing.io_instance.deinit(); |
| | 450 | |
| 446 | builtin.test_functions[fuzz_runner.indexes[i]].func() catch |err| switch (err) { | 451 | builtin.test_functions[fuzz_runner.indexes[i]].func() catch |err| switch (err) { |
| 447 | error.SkipZigTest => return, | 452 | error.SkipZigTest => return, |
| 448 | else => { | 453 | else => { |
| ... | @@ -473,7 +478,8 @@ var fuzz_runner: if (builtin.fuzz) struct { | ... | @@ -473,7 +478,8 @@ var fuzz_runner: if (builtin.fuzz) struct { |
| 473 | | 478 | |
| 474 | export fn runner_start_input_poller() void { | 479 | export fn runner_start_input_poller() void { |
| 475 | @disableInstrumentation(); | 480 | @disableInstrumentation(); |
| 476 | const future = fuzz_runner.io.concurrent(inputPoller, .{}) catch |e| switch (e) { | 481 | const io = fuzz_runner.threaded_io.io(); |
| | 482 | const future = io.concurrent(inputPoller, .{}) catch |e| switch (e) { |
| 477 | error.ConcurrencyUnavailable => @panic("failed to spawn concurrent fuzz input poller"), | 483 | error.ConcurrencyUnavailable => @panic("failed to spawn concurrent fuzz input poller"), |
| 478 | }; | 484 | }; |
| 479 | fuzz_runner.input_poller = future; | 485 | fuzz_runner.input_poller = future; |
| ... | @@ -481,17 +487,20 @@ var fuzz_runner: if (builtin.fuzz) struct { | ... | @@ -481,17 +487,20 @@ var fuzz_runner: if (builtin.fuzz) struct { |
| 481 | | 487 | |
| 482 | export fn runner_stop_input_poller() void { | 488 | export fn runner_stop_input_poller() void { |
| 483 | @disableInstrumentation(); | 489 | @disableInstrumentation(); |
| 484 | assert(fuzz_runner.input_poller.cancel(fuzz_runner.io) == error.Canceled); | 490 | const io = fuzz_runner.threaded_io.io(); |
| | 491 | assert(fuzz_runner.input_poller.cancel(io) == error.Canceled); |
| 485 | } | 492 | } |
| 486 | | 493 | |
| 487 | export fn runner_futex_wait(ptr: *const u32, expected: u32) bool { | 494 | export fn runner_futex_wait(ptr: *const u32, expected: u32) bool { |
| 488 | @disableInstrumentation(); | 495 | @disableInstrumentation(); |
| 489 | return fuzz_runner.io.futexWait(u32, ptr, expected) == error.Canceled; | 496 | const io = fuzz_runner.threaded_io.io(); |
| | 497 | return io.futexWait(u32, ptr, expected) == error.Canceled; |
| 490 | } | 498 | } |
| 491 | | 499 | |
| 492 | export fn runner_futex_wake(ptr: *const u32, waiters: u32) void { | 500 | export fn runner_futex_wake(ptr: *const u32, waiters: u32) void { |
| 493 | @disableInstrumentation(); | 501 | @disableInstrumentation(); |
| 494 | fuzz_runner.io.futexWake(u32, ptr, waiters); | 502 | const io = fuzz_runner.threaded_io.io(); |
| | 503 | io.futexWake(u32, ptr, waiters); |
| 495 | } | 504 | } |
| 496 | | 505 | |
| 497 | fn inputPoller() Io.Cancelable!void { | 506 | fn inputPoller() Io.Cancelable!void { |