summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 04:05:56 -0300
committerGabriel Schneider <[email protected]>2026-11-23 04:23:04 -0300
commit40ab34b24f4f290c6c3d2bac107d9d225f3edaa8 (patch)
treea87b1f741ddac8f73354a63e28e4a244574ad1f1
parent4faf94b72b60ecb0656e7e90ca693b63b1fde71c (diff)
downloadpardes-40ab34b24f4f290c6c3d2bac107d9d225f3edaa8.tar.gz
pardes-40ab34b24f4f290c6c3d2bac107d9d225f3edaa8.zip
tests: pair_exec_reaps keeps its evidence at a failure, and a client gone before the new build says so: the row ("a pair's client exec'd at its session's Upgrade still reaps it at Exit", test/daemon.py, run by every `--upgrade`) failed in three gates this week (Debug to ReleaseSafe: "drawn again" not in 30 s, twice; installed to ReleaseSafe: `exe_of` reading /proc/PID/exe of a process already gone, a bare FileNotFoundError) and kept nothing; now any failure of it (a wait run out, an assertion, an OSError, an EOF, a timeout) keeps what `upgrades` keeps since the upgrade agent's `keep_evidence` (.scratch/daemon/kept/pair-exec-<time>-<pid>: the client's terminal bytes, its exit status and where each thread waits, the session's screen and /log over 9P, `pardes --ps`, the crash file, the session's process) and names the directory in its words; `exe_of` reads a process gone or a zombie as running nothing (not an exception out of the wait), and `on_build` (the waits on a Popen child: this row, far_exec, pair_window_geometry) says at once that the child ended and with what status, not as a wait run out; on this base (pardes-m63-base), pair_exec_reaps alone (.scratch/sketch/reorg/pardes-pair-13/rx.sh, each run under a pty as the gate runs it, ONE heavy slot a batch) failed 12 of 80: Debug to ReleaseSafe 19 of 20 pinned to CPU 5 (load 3.6) and 20 of 20 to CPUs 5,13 (load 5.0), installed (5393ce743d78) to ReleaseSafe 15 of 20 on CPU 5 (load 1.8) and 14 of 20 on 5,13 (load 0.9); all twelve kept the same picture: the client alive on the new build, listed by `pardes --ps` as the session's client, its terminal left (the leave at byte 5596) and entered again (5661) with the notes drawn after the enter: the next change is the cause (the test's)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
-rw-r--r--test/daemon.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/test/daemon.py b/test/daemon.py
index dc1abcbc..4520d63a 100644
--- a/test/daemon.py
+++ b/test/daemon.py
@@ -1237,11 +1237,12 @@ def pair_exec_reaps(old, new):
notes = root / 'notes.txt'
notes.write_text(''.join(f'line {i} of the notes\n' for i in range(30)))
terms = []
+ sock = root / 'pardes-9p-px.sock'
+ c = session = None
try:
t = Term(30, 100)
terms.append(t)
c = t.spawn([str(binary), '--9p=px', str(notes)], env)
- sock = root / 'pardes-9p-px.sock'
wait_for('the socket', sock.exists)
nine = Client(sock)
session = int(dict(line.split(maxsplit=1) for line in nine.read('/status').decode().splitlines())['pid'])
@@ -1254,7 +1255,7 @@ def pair_exec_reaps(old, new):
nine.write('/ctl', b'Upgrade\n')
nine.socket.close()
wait_for('the session exec\'d', lambda: sock.stat().st_ino != ino, timeout=60)
- wait_for('the client on the new build', lambda: exe_of(c.pid) == (str(binary), True), timeout=30)
+ wait_for('the client on the new build', lambda: on_build(c, binary), timeout=30)
nine = reconnect(sock)
assert ppid(session) == c.pid
# The blink: its screen left and entered again, the notes drawn there.
@@ -1267,6 +1268,10 @@ def pair_exec_reaps(old, new):
# to whoever takes it in.
assert not os.path.exists(f'/proc/{session}') if procfs else not alive(session), open(f'/proc/{session}/stat').read()
print('pair exec reaps: a pair\'s client exec\'d at its session\'s Upgrade still reaps it at Exit, status 0')
+ except (TimeoutError, AssertionError, OSError, EOFError, subprocess.TimeoutExpired) as err:
+ kept = keep_evidence('pair-exec', root, env, binary, sock, [('session', session)] if session else [],
+ [('client', t, c, root / 'client.check', root / 'client.stats')] if c else [])
+ raise AssertionError(f'{type(err).__name__}: {err} (kept: {kept})') from None
finally:
for p in processes(root):
try:
@@ -1324,7 +1329,7 @@ def far_exec(old, new):
nine.socket.close()
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: exe_of(c.pid) == (str(binary), True), timeout=30)
+ 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)
# 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
@@ -1403,7 +1408,7 @@ def pair_window_geometry(gui_binary, new_gui):
nine.write('/ctl', b'Upgrade\n')
nine.socket.close()
wait_for('the session exec\'d', lambda: sock.stat().st_ino != ino, timeout=60)
- wait_for('the window on the new build', lambda: exe_of(p.pid) == (str(gui), True), timeout=30)
+ wait_for('the window on the new build', lambda: on_build(p, gui), timeout=30)
nine = reconnect(sock)
time.sleep(3)
assert grid(nine) == sized, ('the exec\'d window the size it had', grid(nine), sized, plain)
@@ -3265,7 +3270,10 @@ def exe_of(pid):
if not procfs:
rows = subprocess.run(['procstat', '-b', str(pid)], capture_output=True).stdout.decode().splitlines()
return (rows[-1].split()[-1] if len(rows) > 1 else ''), None
- link = os.readlink(f'/proc/{pid}/exe')
+ try:
+ link = os.readlink(f'/proc/{pid}/exe')
+ except OSError: # gone, or a zombie: it runs nothing
+ return '', False
try:
same = os.stat(f'/proc/{pid}/exe').st_ino == os.stat(link).st_ino
except OSError:
@@ -3273,6 +3281,13 @@ def exe_of(pid):
return link, same
+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."""
+ assert proc.poll() is None, f'pid {proc.pid} ended ({proc.returncode}) before it ran {binary}'
+ return exe_of(proc.pid) == (str(binary), True)
+
+
def ppid(pid):
if not procfs:
return int(ps('-o', 'ppid=', '-p', str(pid)))