summaryrefslogtreecommitdiff
path: root/test/daemon.py
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-30 18:42:49 -0300
committerGabriel Schneider <[email protected]>2026-10-30 18:42:49 -0300
commitcfaadd978e671c15d9bae96eed72c5ab12718ea1 (patch)
treeffb7eba0f562f15a2ba9aeee1271833feb0ce2e6 /test/daemon.py
parent2d269375f7b49cf430a2c2d62caed88aa5c10e37 (diff)
downloadpardes-cfaadd978e671c15d9bae96eed72c5ab12718ea1.tar.gz
pardes-cfaadd978e671c15d9bae96eed72c5ab12718ea1.zip
test/daemon.py: a session Exited by its 9P may close the link before the write's clunk is answered: that EOF is the session gone, as asked (exit_session, at the three places that Exit twice past unsaved text)
The far clients' teardown failed once in a Debug run of 20: the second Exit ended the session, and ninep.write's clunk after it met the closed link, an EOFError the test did not take for the session going. The session is right: a link is closed with its session, whatever was asked on it after the write that ended it. Four runs of 20 since, each through the far clients. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/daemon.py')
-rw-r--r--test/daemon.py35
1 files changed, 18 insertions, 17 deletions
diff --git a/test/daemon.py b/test/daemon.py
index 7b0e5343..b55c9b24 100644
--- a/test/daemon.py
+++ b/test/daemon.py
@@ -132,6 +132,21 @@ def ps(*args):
return subprocess.run(['ps', *args], capture_output=True).stdout
+def exit_session(nine, pane):
+ """Exit, by the session's 9P, again when unsaved text asks first. The
+ Exit that ends the session may close its link before the write's clunk
+ is answered: that EOF is the session gone, as asked."""
+ for _ in range(2):
+ try:
+ nine.write(f'/pane/{pane}/exec', b'Exit\n')
+ return
+ except EOFError:
+ return
+ except OSError as err:
+ # An edited file asks before it goes.
+ assert 'Exit again' in str(err), err
+
+
def processes(root):
"""The pids whose environment is this run's (its runtime directory)."""
found = []
@@ -434,12 +449,7 @@ def clients(binary):
f'one put off the session\'s state joined again and agreed {len(checks(root / "d.check"))} times; '
f'one killed, the other typed on and detached; a third typed into a shell, agreed '
f'{len(checks(root / "c.check"))} times, and was hung up')
- try:
- nine.write(f'/pane/{pane}/exec', b'Exit\n')
- except OSError as e:
- # An edited file asks before it goes.
- assert 'Exit again' in str(e), e
- nine.write(f'/pane/{pane}/exec', b'Exit\n')
+ exit_session(nine, pane)
sess.wait(timeout=10)
nine.socket.close()
wait_for('nothing left', lambda: not [p for p in processes(root) if alive(p)], timeout=10)
@@ -704,12 +714,7 @@ def window_clients(binary, gui_binary):
print(f'daemon: window clients of a terminal\'s session at 0/30/80/207 ms beside a terminal\'s, digests agreed '
f'{agreements} and {len(checks(root / "a.check"))} times; one put off the session\'s state joined again, '
f'joined again across an Upgrade, agreed {len(checks(dcheck))} times and detached (far: its joins {joins(root / "wd.stats")})')
- try:
- nine.write(f'/pane/{pane}/exec', b'Exit\n')
- except OSError as e:
- # An edited file asks before it goes.
- assert 'Exit again' in str(e), e
- nine.write(f'/pane/{pane}/exec', b'Exit\n')
+ exit_session(nine, pane)
sess.wait(timeout=10)
nine.socket.close()
# A window's session (its daemon on, as a desktop's is), served to a
@@ -947,11 +952,7 @@ def far(binary):
a_joins[0]['sent_kb'], b_joins[0]['from_disk'], b_joins[0]['blobs'], b_joins[1]['from_memory'],
b_joins[1]['blobs'], c_join['from_disk'], c_join['blobs'], d_join['sent_kb'],
sum(len(checks(root / f'{n}.check')) for n in 'abcdef')))
- try:
- nine.write(f'/pane/{pane}/exec', b'Exit\n')
- except OSError as err:
- assert 'Exit again' in str(err), err
- nine.write(f'/pane/{pane}/exec', b'Exit\n')
+ exit_session(nine, pane)
sess.wait(timeout=10)
nine.socket.close()
wait_for('nothing left', lambda: not [p for p in processes(root) if alive(p)], timeout=10)