| ... | @@ -2166,11 +2166,15 @@ const FuzzTestRunner = struct { | ... | @@ -2166,11 +2166,15 @@ const FuzzTestRunner = struct { |
| 2166 | const result = completion.result; | 2166 | const result = completion.result; |
| 2167 | switch (completion.index % 3) { | 2167 | switch (completion.index % 3) { |
| 2168 | 0 => try f.completeStdinWrite(id, result.file_write_streaming catch |e| switch (e) { | 2168 | 0 => try f.completeStdinWrite(id, result.file_write_streaming catch |e| switch (e) { |
| 2169 | error.BrokenPipe => return f.instanceEos(id), | 2169 | // Avoid calling `instanceEos` until EndOfStream is seen with stderr so |
| | 2170 | // that all stderr is collected. |
| | 2171 | error.BrokenPipe => continue, |
| 2170 | else => |write_e| return write_e, | 2172 | else => |write_e| return write_e, |
| 2171 | }), | 2173 | }), |
| 2172 | 1 => try f.completeStdoutRead(id, result.file_read_streaming catch |e| switch (e) { | 2174 | 1 => try f.completeStdoutRead(id, result.file_read_streaming catch |e| switch (e) { |
| 2173 | error.EndOfStream => return f.instanceEos(id), | 2175 | // Avoid calling `instanceEos` until EndOfStream is seen with stderr so |
| | 2176 | // that all stderr is collected. |
| | 2177 | error.EndOfStream => continue, |
| 2174 | else => |read_e| return read_e, | 2178 | else => |read_e| return read_e, |
| 2175 | }), | 2179 | }), |
| 2176 | 2 => try f.completeStderrRead(id, result.file_read_streaming catch |e| switch (e) { | 2180 | 2 => try f.completeStderrRead(id, result.file_read_streaming catch |e| switch (e) { |
| ... | @@ -2360,7 +2364,10 @@ const FuzzTestRunner = struct { | ... | @@ -2360,7 +2364,10 @@ const FuzzTestRunner = struct { |
| 2360 | var in_name_buf: [12]u8 = undefined; | 2364 | var in_name_buf: [12]u8 = undefined; |
| 2361 | var in_name: []const u8 = undefined; | 2365 | var in_name: []const u8 = undefined; |
| 2362 | var i: u32 = 0; | 2366 | var i: u32 = 0; |
| 2363 | const header: InputHeader = while (true) { | 2367 | const header: InputHeader = while (true) : ({ |
| | 2368 | if (i == std.math.maxInt(u32)) return; |
| | 2369 | i += 1; |
| | 2370 | }) { |
| 2364 | const name_prefix = "f" ++ Io.Dir.path.sep_str ++ "in"; | 2371 | const name_prefix = "f" ++ Io.Dir.path.sep_str ++ "in"; |
| 2365 | in_name = std.fmt.bufPrint(&in_name_buf, name_prefix ++ "{x}", .{i}) catch unreachable; | 2372 | in_name = std.fmt.bufPrint(&in_name_buf, name_prefix ++ "{x}", .{i}) catch unreachable; |
| 2366 | in_f = b.cache_root.handle.openFile(io, in_name, .{ | 2373 | in_f = b.cache_root.handle.openFile(io, in_name, .{ |
| ... | @@ -2394,8 +2401,6 @@ const FuzzTestRunner = struct { | ... | @@ -2394,8 +2401,6 @@ const FuzzTestRunner = struct { |
| 2394 | } | 2401 | } |
| 2395 | | 2402 | |
| 2396 | in_f.close(io); | 2403 | in_f.close(io); |
| 2397 | if (i == std.math.maxInt(u32)) return; | | |
| 2398 | i += 1; | | |
| 2399 | }; | 2404 | }; |
| 2400 | defer in_f.close(io); | 2405 | defer in_f.close(io); |
| 2401 | | 2406 | |
| ... | @@ -2479,7 +2484,7 @@ const FuzzTestRunner = struct { | ... | @@ -2479,7 +2484,7 @@ const FuzzTestRunner = struct { |
| 2479 | const step_owner = f.run.step.owner; | 2484 | const step_owner = f.run.step.owner; |
| 2480 | const arena = step_owner.allocator; | 2485 | const arena = step_owner.allocator; |
| 2481 | | 2486 | |
| 2482 | // Collect any remaining stderr | 2487 | // Collect any available stderr |
| 2483 | while (f.batch.next()) |completion| { | 2488 | while (f.batch.next()) |completion| { |
| 2484 | if (completion.index % 3 != 2) continue; | 2489 | if (completion.index % 3 != 2) continue; |
| 2485 | const len = completion.result.file_read_streaming catch continue; | 2490 | const len = completion.result.file_read_streaming catch continue; |