summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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):