diff options
Diffstat (limited to 'test/daemon.py')
| -rw-r--r-- | test/daemon.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/test/daemon.py b/test/daemon.py index 7dc1b4bd..a8ae4331 100644 --- a/test/daemon.py +++ b/test/daemon.py @@ -269,8 +269,11 @@ class Replica: is read, whole. A daemon of another replica protocol (an older build's, across an Upgrade) is dialled again in its own.""" name = session.encode() - self.send(0x01, struct.pack('<HQH', wire or self.WIRE, build, len(name)) + name + b'\xff') - self.send(0x06, b'\x00') + # Its first word (not far) in the same write, as a client's join + # sends it (core/replica.zig joinOn): a refused hello's connection + # is closed, and a second write after it would meet that. + hello = struct.pack('<HQH', wire or self.WIRE, build, len(name)) + name + b'\xff' + self.s.sendall(struct.pack('<BI', 0x01, len(hello)) + hello + struct.pack('<BIB', 0x06, 1, 0)) tag, body = self.read() if tag == 0x01: pid, n = struct.unpack_from('<IH', body) @@ -1504,7 +1507,10 @@ def by_hash(binary): started.append(sess.pid) wait_for('the replica socket', (root / 'pardes-replica.sock').exists) wait_for('the session\'s 9P socket', (root / 'pardes-9p-files.sock').exists) - nine = Client(root / 'pardes-9p-files.sock') + # Each reply waited for as long as the opens it answers take: the + # 17 MiB file's Look took 1.6-6.6 s in a Debug build at a load of + # 35 (ninep.py's 5 s is a reply's whole wait). + nine = Client(root / 'pardes-9p-files.sock', timeout=60) pane = next(int(row.split()[0]) for row in nine.read('/index').splitlines() if row.split()[1] == b'text') (ta, a), (tf, f) = client('a', False), client('f', True) seen = {n: len(checks(root / f'{n}.check')) for n in 'af'} @@ -2341,10 +2347,17 @@ def upgrades(old, new): sock = root / 'pardes-9p-again.sock' wait_for('the next session', sock.exists) client = Client(sock) - started.append(int(dict(line.split(maxsplit=1) for line in client.read('/status').decode().splitlines())['pid'])) + again = int(dict(line.split(maxsplit=1) for line in client.read('/status').decode().splitlines())['pid']) + started.append(again) # Its reader of the daemon starts after its first frame: an Adopt - # before that waits for an `ok` nobody reads, and is refused. + # before that waits for an `ok` nobody reads, and is refused. The + # daemon lists it once it has taken its hello, which its `ok` + # answers: an Adopt before that waits at most 2 s for the `ok` + # (daemon.zig `kept`), which a loaded machine can take (3 in 40 at + # a load of 35). wait_for('the next session\'s first frame', lambda: b'\x1b[?1049h' in term.text()) + wait_for('the next session listed by the daemon', lambda: f'session again {again} ' in subprocess.run( + [str(binary), '--ps'], env=env, capture_output=True, timeout=30).stdout.decode()) before = set(terminals(client)) client.write(f'/pane/{min(before)}/exec', b'Adopt\n') pane = wait_for('the adopted pane', lambda: set(terminals(client)) - before).pop() |
