diff options
Diffstat (limited to 'test/daemon.py')
| -rw-r--r-- | test/daemon.py | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/test/daemon.py b/test/daemon.py index 2c86c04f..041bc75b 100644 --- a/test/daemon.py +++ b/test/daemon.py @@ -399,6 +399,23 @@ def view_panes(client): if line.split()[:1] != ['active'] for x in line.split()[6:]} +def in_own_view(what, live, client, pane, theirs): + """`live()` makes a client's view the live one (made_live, still), and + /layout read after it lays out its pane and not the other client's: + asked again until it does, for a view is the live one only until the + next input (the session's own terminal answering a query late, the + other client's rejoin sizing it). A view lost lays out neither pane, + another's lays out theirs: neither ever passes.""" + def own(): + live() + shown = view_panes(client) + return pane in shown and theirs not in shown + try: + wait_for(what, own, timeout=30) + except TimeoutError: + raise AssertionError((what, pane, theirs, client.read('/layout'))) from None + + def clients(binary): """Replica clients of a detached session: one on the replica socket, one through the delay relay; each one's keys in the session's text and @@ -3161,9 +3178,7 @@ def upgrades(old, new): wait_for('the client joined again', lambda: b'joined again: the session is upgrading' in t.text(), timeout=30) assert again.poll() is None and again5.poll() is None for (t, check), pane, theirs in zip(owners, mine, reversed(mine)): - made_live(t, check) - shown = view_panes(client) - assert pane in shown and theirs not in shown, ('its own view again', pane, theirs, client.read('/layout')) + in_own_view('its own view again', lambda: made_live(t, check), client, pane, theirs) for c, t in ((again, term4), (again5, term5)): c.send_signal(signal.SIGHUP) c.wait(timeout=10) @@ -3332,10 +3347,10 @@ def upgrade_clients(old, new): wait_for('the terminal entered again', lambda: t.text().rfind(b'\x1b[?1049h') > t.text().rfind(b'\x1b[?1049l') > 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)): - still(check, key) if knows_exec(new): - shown = view_panes(nine) - assert pane in shown and theirs not in shown, ('its own view again', pane, theirs, nine.read('/layout')) + in_own_view('its own view again', lambda: still(check, key), nine, pane, theirs) + else: + still(check, key) print('upgrade with clients: a terminal client and a window client exec\'d the build at their start path, the same processes, ' + ('each back in its own view, its own pane in it' if knows_exec(new) else 'each in a view of its own (that build joins for no view it is handed)')) assert alive(shell_pid) and ppid(shell_pid) == session |
