Repository navigation
Commit 1556e36
committed
Size the relay test's payload from the pipe capacity
test_pipeline_writer_relay_lends_only_while_a_producer_waits hardcoded a 280000-byte payload and a
200000-byte first read, assuming the 64 KiB pipes of a 4 KiB-page system. A pipe holds a fixed
number of pages, so a 16 KiB-page kernel has 256 KiB pipes and a 64 KiB-page one 1 MiB pipes.
There the relay drains the whole payload into the consumer's pipe before the child has to wait, no
lend happens, and the test asserts a lend that was never needed. cmd2 itself behaves correctly;
only the test's assumption depends on the page size.
Size the payload from the consumer pipe's capacity, reported by F_GETPIPE_SZ where the kernel has
it, and fall back to the 64 KiB that macOS and the BSDs cap a pipe at elsewhere. The consumer's
first read leaves more than a pipe's worth pending, so part of the payload is still in the relay
when cmd2 writes after it, and the rest fits in the pipes, so the child can finish.1 parent 5ffe145 commit 1556e36
1 file changed
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| 481 | + | |
481 | 482 | | |
482 | 483 | | |
483 | 484 | | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | 485 | | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
489 | 494 | | |
490 | 495 | | |
491 | 496 | | |
| |||
0 commit comments