summaryrefslogtreecommitdiff
path: root/test/daemon.py
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 04:30:17 -0300
committerGabriel Schneider <[email protected]>2026-11-23 05:12:06 -0300
commit5a864360e6b0e72fc9734ab76c085a38fe1e60ba (patch)
treeea889bbfa099eb649153b121e706abc81fb1158d /test/daemon.py
parentb07ad676c56a01d9e782b6d42f371f734440e869 (diff)
downloadpardes-5a864360e6b0e72fc9734ab76c085a38fe1e60ba.tar.gz
pardes-5a864360e6b0e72fc9734ab76c085a38fe1e60ba.zip
upgrade, daemon: the start path less Linux's " (deleted)", and the file it started from the one it runs, whenever it is first asked: a session looked its start path up once, after its first pass round its loop (runtime/upgrade.zig `locate`: a readlink of /proc/self/exe and a stat OF THE PATH, "nothing is reinstalled within a frame of a start"), and a pair's session draws no frame: its first pass can come after its client's first frame, when a build is installed there (pair_exec_reaps, installed to ReleaseSafe on one CPU, 1 of 80 after the change before: "the session exec'd" not in 60 s, the session's own words "Upgrade: …/bin/pardes (deleted) would not start; this session stays as it is"); looked up after a reinstall the path is "PATH (deleted)" (the Upgrade execs that name, refused) and the "started" inode is the new file's (`replaced` and `newer` then say no newer build: a client that looked late does not exec at an Upgrade, and the newer-build notice never comes); and a daemon started by a process whose file was replaced (daemon.zig `spawn`, its own readlink: a pair's client at its start, a session whose daemon died after a reinstall) execs "PATH (deleted)" and none starts ("Upgrade: no daemon keeps this session, so its client could not join it again"); a user can hit both: a build installed in the first moments of a session, then an Upgrade, refused; a build installed, then the daemon killed or dead: no session can start the next; THE TEST that makes it come every time: test/daemon.py `pair_exec_reaps(new, new, early=True)` (run by every `--upgrade`: the same build installed again at once, before the session looked its path up and as the client starts the daemon: the session must exec it and the client, its build the session's still, join again in place): on pardes-m63-base 0 of 20 (ReleaseSafe on CPUs 5,13 and Debug: every one "no daemon keeps this session"); now `upgrade.startPath` (the path as the system names it, less " (deleted)") is what `locate` keeps and what `spawn` execs, and the started inode is the file the process runs (a stat of /proc/self/exe on Linux; the path's on FreeBSD as before); after (loads 4.4-9.0): the early row 20 of 20 on Debug (CPUs 5,13) and on ReleaseSafe once its expectation was the same-build rejoin, pair_exec_reaps 120 of 120 (Debug to ReleaseSafe, ReleaseSafe to Debug, installed to ReleaseSafe; 20 each on CPU 5 and on CPUs 5,13)
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.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/test/daemon.py b/test/daemon.py
index 2f4a9c04..4114fac1 100644
--- a/test/daemon.py
+++ b/test/daemon.py
@@ -1217,12 +1217,18 @@ def pair_upgrade_views(binary):
shutil.rmtree(root, ignore_errors=True)
-def pair_exec_reaps(old, new):
+def pair_exec_reaps(old, new, early=False):
"""PARDES_PAIR across builds: a pair started from `root/bin` (old), its
session upgraded to the build installed there since (new): its client,
the session's parent, execs that build (the blink) and is still its
parent; Exit typed then: the client returns once the session is gone,
- reaped, its status the session's (0), as before the exec."""
+ reaped, its status the session's (0), as before the exec. `early`: old
+ and new the same build, installed again at once, before the session's
+ first pass round its loop, where it first looks its start path up
+ (upgrade.zig `locate`), and as the client starts the daemon from its
+ own (daemon.zig `spawn`): the path is the path, not Linux's "PATH
+ (deleted)", so the daemon starts and the session execs it; the client,
+ its build the session's still, joins again in place (no exec)."""
scratch = Path(__file__).resolve().parent.parent.parent / '.scratch' / 'daemon' / 'dmn'
scratch.mkdir(parents=True, exist_ok=True)
root = Path(tempfile.mkdtemp(prefix='rpx-', dir=scratch))
@@ -1243,30 +1249,38 @@ def pair_exec_reaps(old, new):
t = Term(30, 100)
terms.append(t)
c = t.spawn([str(binary), '--9p=px', str(notes)], env)
+ if early:
+ install(new, binary)
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'])
assert ppid(session) == c.pid
wait_for('drawn', lambda: b'line 3 of the notes' in t.text(), timeout=30)
- install(new, binary)
+ if not early:
+ install(new, binary)
ino = sock.stat().st_ino
# Before the Upgrade: the exec'd client can draw before its exec is seen.
mark = len(t.text())
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: on_build(c, binary), timeout=30)
+ if early:
+ wait_for('joined again in place', lambda: b'joined again' in t.text()[mark:], timeout=30)
+ else:
+ 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.
- wait_for('drawn again', lambda: b'line 3 of the notes' in (entered_again(t.text(), mark) or b''), timeout=30)
+ if not early:
+ 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
# Its parent's wait returned: the session reaped, not a zombie left
# 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')
+ print('pair exec reaps: a pair\'s client exec\'d at its session\'s Upgrade still reaps it at Exit, status 0'
+ + (' (the same build installed again before the session looked its path up: joined again in place)' if early else ''))
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 [])
@@ -3931,6 +3945,9 @@ if __name__ == '__main__':
far_exec(old, new)
else:
print('far exec: skipped: the old build\'s far client, cut at the Upgrade with no last word, takes it for its session\'s end (no PARDES_JOIN_SIZE)')
+ # A reinstall of the new build before the pair's first look: the
+ # new build's own, whatever the old one does.
+ pair_exec_reaps(new, new, early=True)
# With a pardes-gui beside each: the clients carried too.
if all(a.with_name('pardes-gui').exists() for a in (old, new)):
upgrade_clients(old, new)