summaryrefslogtreecommitdiff
path: root/test/daemon.py
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 04:23:04 -0300
committerGabriel Schneider <[email protected]>2026-11-23 04:30:17 -0300
commitb07ad676c56a01d9e782b6d42f371f734440e869 (patch)
tree74d86ebe15261c28f4e6f19edf00b0e5d92d2602 /test/daemon.py
parent40ab34b24f4f290c6c3d2bac107d9d225f3edaa8 (diff)
downloadpardes-b07ad676c56a01d9e782b6d42f371f734440e869.tar.gz
pardes-b07ad676c56a01d9e782b6d42f371f734440e869.zip
tests: a client's blink at an Upgrade is a leave at or after the mark, not strictly after it: pair_exec_reaps's "drawn again", far_exec's and upgrade_clients' "the terminal entered again" took the text's length before the Upgrade (`mark`) and asked for the screen's last leave (`\e[?1049l`) to be AFTER it (test/daemon.py, the three waits: `x.rfind(leave) > mark`), but the leave is the first byte the old client writes after the Upgrade, so when the terminal's reader had read every byte before it (the old client idle since its frame, the reader caught up) the leave starts AT the mark and the wait runs out with the client alive, joined and drawn: the twelve failures of the change before (80 runs of pair_exec_reaps alone on pardes-m63-base, every one kept: the old client's one frame 5596 bytes, its leave at byte 5596, the exec'd client's enter at 5661 and the notes drawn after it, `pardes --ps` listing it as the session's client); the gate's "drawn again" (merge60, Debug to ReleaseSafe) is this; a user cannot hit it (the test's); now `entered_again(text, mark)` (the leave at or after the mark, an enter after the leave: what was drawn since) is the one predicate of the three waits; after it (rx.sh, the same 80 runs, loads 1.3-3.1): Debug to ReleaseSafe 20 of 20 on CPU 5 and 20 of 20 on CPUs 5,13, installed to ReleaseSafe 20 of 20 on 5,13 and 19 of 20 on CPU 5, the one failure another cause, the product's (the next change: the session read its start path after the new build was installed there, "Upgrade: …/bin/pardes (deleted) would not start")
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/daemon.py')
-rw-r--r--test/daemon.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/daemon.py b/test/daemon.py
index 4520d63a..2f4a9c04 100644
--- a/test/daemon.py
+++ b/test/daemon.py
@@ -1259,8 +1259,7 @@ def pair_exec_reaps(old, new):
nine = reconnect(sock)
assert ppid(session) == c.pid
# The blink: its screen left and entered again, the notes drawn there.
- wait_for('drawn again', lambda: (lambda x: x.rfind(b'\x1b[?1049h') > x.rfind(b'\x1b[?1049l') > mark
- and b'line 3 of the notes' in x[x.rfind(b'\x1b[?1049h'):])(t.text()), timeout=30)
+ wait_for('drawn again', lambda: b'line 3 of the notes' in (entered_again(t.text(), mark) or b''), timeout=30)
nine.write('/ctl', b'Exit\n')
nine.socket.close()
assert c.wait(timeout=30) == 0, c.returncode
@@ -1330,7 +1329,7 @@ def far_exec(old, new):
wait_for('the session exec\'d', lambda: sock.stat().st_ino != ino, timeout=60)
nine = reconnect(sock)
wait_for('the far client on the new build', lambda: on_build(c, binary), timeout=30)
- wait_for('the terminal entered again', lambda: t.text().rfind(b'\x1b[?1049h') > t.text().rfind(b'\x1b[?1049l') > mark, timeout=30)
+ wait_for('the terminal entered again', lambda: entered_again(t.text(), mark), timeout=30)
# Its environment read once the new image runs (it entered the
# screen): an exec names the new file in /proc/PID/exe before it has
# written where the environment is, and a read between gets nothing
@@ -3281,6 +3280,15 @@ def exe_of(pid):
return link, same
+def entered_again(text, mark):
+ """The blink of a client exec'd at an Upgrade: its terminal's screen
+ left at or after `mark` (the text's length before the Upgrade: when the
+ reader had read all the old client wrote, the leave is its very next
+ byte) and entered again. What was drawn since that enter, or None."""
+ enter, leave = text.rfind(b'\x1b[?1049h'), text.rfind(b'\x1b[?1049l')
+ return text[enter:] if enter > leave >= mark else None
+
+
def on_build(proc, binary):
"""Whether the test's child `proc` runs `binary` now (exe_of); one that
ended says so with its status at once, not as a wait run out."""
@@ -3776,7 +3784,7 @@ def upgrade_clients(old, new):
wait_for('the terminal client on the new build', lambda: exe_of(tc.pid) == (str(binary), True), timeout=30)
wait_for('the window client on the new build', lambda: exe_of(w.pid) == (str(gui_binary), True), timeout=30)
# The blink: its screen left, and entered again.
- wait_for('the terminal entered again', lambda: t.text().rfind(b'\x1b[?1049h') > t.text().rfind(b'\x1b[?1049l') > mark, timeout=30)
+ wait_for('the terminal entered again', lambda: entered_again(t.text(), mark), timeout=30)
assert tc.poll() is None and w.p.poll() is None
for (key, check), pane, theirs in zip(owners, mine, reversed(mine)):
if knows_exec(new):