From c04b6498310633a43fa3f54695372c8ffec3176c Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Tue, 17 Nov 2026 11:08:00 +0100 Subject: [PATCH] test: size job-control output from page size On ppc64le, test_pipeline_stops_with_cmd2_and_returns_terminal[interrupt-busy-producer] times out waiting for cmd2 to hand the terminal to the pager: foreground process group: 605 605 ... Sl+ hrtime application.py 633 ... S poll_s pager.py The busy producers write 256 KiB, meant to be more than a pipe holds so that the write blocks and cmd2 lends the terminal. Linux sizes a pipe in pages, 16 by default, and ppc64le uses 64 KiB pages, so a pipe holds 1 MiB there. The write completes without blocking and the terminal is never lent. Write 64 pages instead: unchanged at 256 KiB with 4 KiB pages, 4 MiB with 64 KiB pages. Co-Authored-By: Claude Opus 5.5 --- tests/test_pipeline_job_control.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test_pipeline_job_control.py b/tests/test_pipeline_job_control.py index cf6dcf4bb..fa9ab6868 100644 --- a/tests/test_pipeline_job_control.py +++ b/tests/test_pipeline_job_control.py @@ -18,6 +18,10 @@ pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="POSIX job control") +# More output than a pipe and the relay's pipe hold, so a producer blocks until the consumer reads. Linux sizes a pipe +# in pages, 16 by default, so follow the page size: 256 KiB with 4 KiB pages, 4 MiB with the 64 KiB pages of ppc64le. +PIPE_FILL = 64 * (os.sysconf("SC_PAGE_SIZE") if hasattr(os, "sysconf") else 4096) + def describe_processes(root: int, master: int) -> str: """Report the terminal's foreground group and every descendant of root, for a timeout. @@ -154,13 +158,13 @@ def test_pipeline_stops_with_cmd2_and_returns_terminal( "class App(Cmd):\n" " def do_busy(self, statement):\n" " os.write(2, b'BUSY_READY\\n')\n" - " self.stdout.write('x' * 262144)\n" + f" self.stdout.write('x' * {PIPE_FILL})\n" " self.stdout.flush()\n" " time.sleep(30)\n" " def do_ask(self, statement):\n" " self.poutput(self.read_input('INPUT> '))\n" " def do_direct(self, statement):\n" - " self.stdout.buffer.write(b'x' * 262144)\n" + f" self.stdout.buffer.write(b'x' * {PIPE_FILL})\n" " self.stdout.flush()\n" " assert self.select('first second', 'SELECT> ') == 'first'\n" " assert input('PLAIN> ') == 'answer'\n" @@ -305,7 +309,7 @@ def running(*pids: int) -> bool: "import os, signal, sys, time\n" "signal.signal(signal.SIGINT, signal.SIG_DFL)\n" "os.write(2, b'BUSY_READY\\n')\n" - "sys.stdout.write('x' * 262144)\n" + f"sys.stdout.write('x' * {PIPE_FILL})\n" "sys.stdout.flush()\n" "time.sleep(30)\n", encoding="utf-8",