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