diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-30 15:27:04 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-30 19:37:50 -0300 |
| commit | e7ae154d436991b4a9c7bbe72958262381e0b1d8 (patch) | |
| tree | 20891b234f876946cd7f5f88f00a1edf53c7b2ac /test | |
| parent | 8e848932bc84ce261b1919692e40df2e9570d67a (diff) | |
| download | pardes-e7ae154d436991b4a9c7bbe72958262381e0b1d8.tar.gz pardes-e7ae154d436991b4a9c7bbe72958262381e0b1d8.zip | |
test/soak.py: the gate commands and the narrowing flags in its header; a client's speculation (at once of its inputs) and predicted echo in the table; each session's log kept an epoch, and a dead box session's core; the box's 9P forward waited for until it answers, its socket made afresh at a restart
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test')
| -rw-r--r-- | test/soak.py | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/test/soak.py b/test/soak.py index e6626d53..8c73aa1e 100644 --- a/test/soak.py +++ b/test/soak.py @@ -3,9 +3,24 @@ measured (docs/next-daemon.md, the replica and GUI replica notes). python3 -B test/soak.py local [--minutes 2] [--rtts 0,30,80,207] [--jitter 10] - [--seed 1] [--clients tty,win] [--pardes P] [--gui G] [--trace] + [--seed 1] [--clients tty,win] [--pardes P] [--gui G] [--trace] [--keep] python3 -B test/soak.py box [--minutes 20] [--clients win,tty] [--remote-bin B] - [--pardes P] [--gui G] [--seed 1] [--trace] + [--pardes P] [--gui G] [--seed 1] [--trace] [--keep] + +The gates (`source .scratch/daemon/hunt/env.sh` or any env without PARDES_*): + local, ~12 min: python3 -B test/soak.py local --minutes 2.5 + box, ~22 min: python3 -B test/soak.py box --minutes 20 +(the box's binary is deployed first as /root/pardes-test/bin/pardes-hunt, the +same build as --pardes/--gui here). Exit 0 only with no breach at all. + +Narrowing a breach down: `--trace` (PARDES_REPLICA_TRACE at both ends: per-field +digests, each unit and each divergence described in the clients' and the +session's logs), `--only move,insert` / `--skip click,hover` (the monkey's +actions by name, ACTIONS below), `--events resize,detach` ('' for none), +`--no-upgrade`, `--no-respawn` (a dead client stays dead, a dead session ends +the cell), `--near` (local clients without zstd and blobs by hash), `--keep` +(the run's files, with each terminal client's output and the actions log, a +line an input). A breach's files are kept whatever. `local`: a session on this machine (`pardes --detach=soak <a directory>`, the shape of the user's: a directory pane, then two shells), and at each RTT its @@ -288,11 +303,15 @@ class Base: return [line for line in checks(self.stats) if line.startswith('inputs ')] def stats_sum(self): - keys = ('inputs', 'at_once', 'stopped', 'units', 'fast', 'neutral', 'mispredicted', 'foreign', 'visible') + keys = ('inputs', 'at_once', 'stopped', 'units', 'fast', 'neutral', 'mispredicted', 'foreign', 'visible', 'missed') tot = dict.fromkeys(keys, 0) + tot['echoed'] = tot['typed'] = 0 for line in self.links(): w = line.split() d = {w[i]: w[i + 1] for i in range(0, len(w) - 1, 2)} + a, _, b = d.get('echo', '0/0').partition('/') + tot['echoed'] += int(a or 0) + tot['typed'] += int(b or 0) for k in keys: try: tot[k] += int(d.get(k, 0)) @@ -841,7 +860,7 @@ class Run: if self.args.trace: e['PARDES_REPLICA_TRACE'] = '1' self.session = self.spawn([self.pardes, f'--detach={NAME}', str(self.work)], env=e, cwd=self.work, - stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=open(self.root / 'session.err', 'w'), + stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=open(self.root / f'session.err.{self.epochs}', 'w'), start_new_session=True) self.nine_sock = self.root / f'pardes-9p-{NAME}.sock' wait_for('the session\'s 9P socket', self.nine_sock.exists, timeout=20) @@ -874,10 +893,7 @@ class Run: subprocess.run([self.pardes, f'--kill={NAME}'], env=self.env, cwd=self.root, capture_output=True, timeout=30) def session_said(self): - try: - return (self.root / 'session.err').read_text(errors='replace') - except FileNotFoundError: - return '' + return ''.join(f.read_text(errors='replace') for f in sorted(self.root.glob('session.err.*'))) def crashes(self): p = self.root / 'config' / 'pardes' / 'crashes' @@ -926,21 +942,23 @@ class BoxRun(Run): fixture(self.work, rng) tar = subprocess.run(['tar', '-C', str(self.work), '-cf', '-', '.'], capture_output=True, check=True).stdout bin_ = self.args.remote_bin + fresh = f'rm -rf {self.home}; ' if self.epochs <= 1 else f'mkdir -p {self.home}/cores; mv {self.home}/work/*.core {self.home}/cores/ 2>/dev/null; ' script = (f'set -e; [ -d {self.run_dir} ] && [ -n "$(ls {self.run_dir} 2>/dev/null)" ] && {{ echo "run-hunt busy"; ls {self.run_dir}; exit 3; }}; ' - f'rm -rf {self.home}; mkdir -p {self.home}/work {self.home}/config/pardes {BOX_T}/tmp-hunt {self.run_dir}; chmod 700 {self.run_dir}; ' + + fresh + f'mkdir -p {self.home}/work {self.home}/config/pardes {BOX_T}/tmp-hunt {self.run_dir}; chmod 700 {self.run_dir}; ' f'printf "Shell bash\\nMessageLinger 0\\n" > {self.home}/config/pardes/init; ' f'tar -C {self.home}/work -xf -; cd {self.home}/work; ' - f'env -i {self.benv()} {bin_} --detach={NAME} {self.home}/work </dev/null >{self.home}/session.err 2>&1 & ' + f'env -i {self.benv()} {bin_} --detach={NAME} {self.home}/work </dev/null >{self.home}/session.err.{self.epochs} 2>&1 & ' f'for i in $(seq 400); do [ -S {self.run_dir}/pardes-9p-{NAME}.sock ] && break; sleep 0.05; done; ' - f'[ -S {self.run_dir}/pardes-9p-{NAME}.sock ] || {{ cat {self.home}/session.err; exit 4; }}') + f'[ -S {self.run_dir}/pardes-9p-{NAME}.sock ] || {{ cat {self.home}/session.err.{self.epochs}; exit 4; }}') got = subprocess.run(SSH + [BOX, script], input=tar, capture_output=True, timeout=120) if got.returncode != 0: raise RuntimeError(f'box session: {got.returncode} {got.stdout.decode()} {got.stderr.decode()}') self.nine_sock = self.root / 'box9p.sock' + self.nine_sock.unlink(missing_ok=True) self.fwd = self.spawn(SSH + ['-N', '-o', 'StreamLocalBindUnlink=yes', '-L', f'{self.nine_sock}:{self.run_dir}/pardes-9p-{NAME}.sock', BOX], stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) wait_for('the 9P forward', self.nine_sock.exists, timeout=20) - status = self.nine_read('/status').decode() + status = wait_for('the session over the 9P forward', lambda: self.nine_read('/status'), timeout=30).decode() self.session_pid = int(dict(line.split(maxsplit=1) for line in status.splitlines())['pid']) for _ in range(2): self.nine_write('/pane/1/exec', b'Tty\n') @@ -951,7 +969,7 @@ class BoxRun(Run): return got.stdout.strip() == b'yes' def session_said(self): - got = self.box(f'cat {self.home}/session.err; ls {self.home}/*.core {self.home}/work/*.core 2>/dev/null; cat {self.home}/config/pardes/crashes 2>/dev/null', timeout=60) + got = self.box(f'cat {self.home}/session.err.*; ls {self.home}/cores/*.core {self.home}/work/*.core 2>/dev/null; cat {self.home}/config/pardes/crashes 2>/dev/null', timeout=60) return got.stdout.decode(errors='replace') def crashes(self): @@ -1274,7 +1292,7 @@ ROWS = [] def cores(run): """systemd-coredump's cores since the cell began, of the pids it started.""" - if isinstance(run, BoxRun) or not shutil.which('coredumpctl'): + if not shutil.which("coredumpctl"): return [] since = time.time() - (now() - run.t0) - 5 got = subprocess.run(['coredumpctl', 'list', '--no-legend', '--no-pager', f'--since=@{since:.0f}'], capture_output=True, text=True) @@ -1327,7 +1345,7 @@ def report_cell(run, rtt): ROWS.append({ 'cell': run.cell, 'client': c.label, 'rtt': rtt, 'min': dur, 'inputs': c.inputs, 'links': links, 'rejoins': diverged, 'checks': len(lines), 'differ': len(differ), 'visible': st['visible'], 'mispred': st['mispredicted'], - 'vis/min': st['visible'] / dur, 'clears/min': (c.term.clears / dur) if isinstance(c, TtyClient) else None, + 'vis/min': st['visible'] / dur, 'at_once': f"{st['at_once']}/{st['inputs']}", 'echo': f"{st['echoed']}/{st['typed']}", 'echo_missed': st['missed'], 'clears/min': (c.term.clears / dur) if isinstance(c, TtyClient) else None, 'p50': pct(lat, 50), 'p99': pct(lat, 99), 'nolat': missed, 'views': getattr(c, 'views', 0), 'view_bad': getattr(c, 'view_bad', 0), 'lost': getattr(c, 'lost', 0), 'exit': c.gone, 'epochs': run.epochs, }) @@ -1350,7 +1368,7 @@ def report_cell(run, rtt): def table(rows): - cols = ['cell', 'client', 'min', 'inputs', 'links', 'rejoins', 'checks', 'differ', 'visible', 'mispred', 'vis/min', 'clears/min', + cols = ['cell', 'client', 'min', 'inputs', 'links', 'rejoins', 'checks', 'differ', 'at_once', 'visible', 'mispred', 'vis/min', 'echo', 'echo_missed', 'clears/min', 'p50', 'p99', 'nolat', 'views', 'view_bad', 'lost', 'exit', 'epochs'] def fmt(v): if v is None: |
