public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Steve Traylen <steve.traylen@cern.ch>
To: git-commits@fedoraproject.org
Subject: [rpms/python-cmd2] rawhide: Test adaption for ppc64le
Date: Tue, 17 Nov 2026 10:26:11 GMT	[thread overview]
Message-ID: <179491117104.1.4861232499097823734.rpms-python-cmd2-8395611ec708@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/python-cmd2
            Branch : rawhide
            Commit : 8395611ec7088071fc8e506651856c6715f8c655
            Author : Steve Traylen <steve.traylen@cern.ch>
            Date   : 2026-11-17T11:05:32+01:00
            Stats  : +107/-0 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-cmd2/c/8395611ec7088071fc8e506651856c6715f8c655?branch=rawhide

            Log:
            Test adaption for ppc64le

One tests fails because the pipe size is to small for the page
size on ppc64le

There is a timeout for getting a console. Make it longer.

---
diff --git a/0001-test-size-job-control-output-from-page-size.patch b/0001-test-size-job-control-output-from-page-size.patch
new file mode 100644
index 0000000..33fd8f1
--- /dev/null
+++ b/0001-test-size-job-control-output-from-page-size.patch
@@ -0,0 +1,72 @@
+From 01b3208c11c76fc132098e4be2d1cda329aa6678 Mon Sep 17 00:00:00 2001
+From: Stephen Traylen <AUTHOR-EMAIL@example.invalid>
+Date: Tue, 17 Nov 2026 10:59:51 +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 <noreply@anthropic.com>
+Claude-Session: https://claude.ai/code/session_01RZ9CqmpEYXunXxh9XU8TdL
+---
+ 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 cf6dcf4b..fa9ab686 100644
+--- a/tests/test_pipeline_job_control.py
++++ b/tests/test_pipeline_job_control.py
+@@ -18,6 +18,10 @@ import pytest
+ 
+ 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 test_pipeline_stops_with_cmd2_and_returns_terminal(
+                 "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",
+-- 
+2.43.0
+
+

diff --git a/1826.patch b/1826.patch
new file mode 100644
index 0000000..f2d739d
--- /dev/null
+++ b/1826.patch
@@ -0,0 +1,31 @@
+From ecf51e6656a26574e9ce280e82a000d1ddb60705 Mon Sep 17 00:00:00 2001
+From: Steve Traylen <steve.traylen@cern.ch>
+Date: Tue, 17 Nov 2026 10:20:57 +0100
+Subject: [PATCH] test: scale pipe relay slack with page size
+
+On ppc64le, test_pipeline_writer_relay_lends_only_while_a_producer_waits[True]
+fails with:
+
+    AssertionError: assert 1114112 == 1163264
+
+The test leaves a fixed 16 KiB slack, which assumes 4 KiB pages. A
+pipe frees space one whole page at a time, and ppc64le uses 64 KiB
+pages, so reading 16 KiB frees no space and the consumer comes up
+short. Use 4 pages of slack, so 4 KiB-page systems are unchanged.
+---
+ tests/test_utils.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/test_utils.py b/tests/test_utils.py
+index e34621f16..2e8ece185 100644
+--- a/tests/test_utils.py
++++ b/tests/test_utils.py
+@@ -492,7 +492,7 @@ def test_pipeline_writer_relay_lends_only_while_a_producer_waits(pauses) -> None
+     # first read fits, so the child can then finish. It is also more than the consumer's pipe holds, so part of it is still
+     # in the relay when cmd2 writes after it.
+     payload = b"x" * (2 * capacity + 2 * 65536)
+-    first_read = len(payload) - capacity - 16384 if pauses else len(payload)
++    first_read = len(payload) - capacity - 4 * os.sysconf("SC_PAGE_SIZE") if pauses else len(payload)
+     received = bytearray()
+     lent = threading.Event()
+     resume = threading.Event()

diff --git a/python-cmd2.spec b/python-cmd2.spec
index 09ca7be..727bf3b 100644
--- a/python-cmd2.spec
+++ b/python-cmd2.spec
@@ -8,6 +8,8 @@ Summary:          Extra features for standard library's cmd module
 License:          MIT
 URL:              https://pypi.python.org/pypi/cmd2
 Source0:          https://files.pythonhosted.org/packages/source/c/cmd2/cmd2-%{version}.tar.gz
+Patch0:           https://github.com/python-cmd2/cmd2/pull/1826.patch
+Patch1:           0001-test-size-job-control-output-from-page-size.patch
 
 BuildArch:        noarch
 
@@ -59,6 +61,8 @@ Requires:         /usr/bin/which
 %prep
 %autosetup -n %{pypi_name}-%{version} -p1
 
+# Increase timeout in tests
+
 # Disable coverage checks
 sed -i '/"\-\-cov/d' pyproject.toml
 

                 reply	other threads:[~2026-11-17 10:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179491117104.1.4861232499097823734.rpms-python-cmd2-8395611ec708@fedoraproject.org \
    --to=steve.traylen@cern.ch \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox