summaryrefslogtreecommitdiff
path: root/test/agent_session_test.py
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 16:50:10 -0300
committerGabriel Schneider <[email protected]>2026-11-04 17:04:36 -0300
commit2693c24cf44b8788ec26f98eeedc4d74b5ac98de (patch)
tree4464a03090122f03e221b3d6e6e05577e806625a /test/agent_session_test.py
parentbe3985092df1c3388cfa09ca5e989d2fa66f55ec (diff)
downloadpardes-2693c24cf44b8788ec26f98eeedc4d74b5ac98de.tar.gz
pardes-2693c24cf44b8788ec26f98eeedc4d74b5ac98de.zip
test: the 9P monkey at T1 and the agent driver's interaction checks at T2, for the Python ports: test/monkey9p.zig (was test/monkey9p.py) drives an in-process Session with random 9P requests, every op drawn from the seed alone (panes, columns, stale serials and held files as tokens resolved when the op runs), so --seed/--steps replay a run, --only replays any subset of its steps and a failure shrinks by delta debugging over them; each run is a child of the program in a throwaway root (its HOME, XDG directories and dump), so a panic or a hang is a failure reported and shrunk like the rules' (one failure rule, close runs only line files, /index matching /pane, chunked reads equal whole, the log marker); the 9P engine's own refusals and OTRUNC's truncation made by the monkey, Session doing no effects; steps monkey-session and monkey-session-smoke, the smoke part of behaviour-test; Session's mky helpers walk, ask (a raw request answering errno, held or bytes) and ended; test/process/terminals.zig, three cases of test/agent_session_test.py (a prompt that settles, input shown and ^U taking the screen back; history past a screenful in the body; a raw-mode control byte through pty/data), the driver's own argument, output, timeout and cleanup checks left in Python; monkey9p.py deleted; each checked to fail against a break: serveFs not noting a pane file's err (one failure rule), noting it twice (one failure rule's upper bound), a msg beside a refused pane write (its msg clause), /pane leaving out serial 3 (index matching pane dirs), stagedReply skipping a byte past offset 0 on small reads (chunked equals whole), a panic in pty/run's write (a crash, shrunk 377 -> 3 ops), the root ctl taking an unknown word (the log marker), pty/data dropping a lone control byte (raw key), a 4 KiB terminal scrollback (history, raw key), pty/data dropping a write's last byte (all three terminal cases)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/agent_session_test.py')
-rw-r--r--test/agent_session_test.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/agent_session_test.py b/test/agent_session_test.py
index ba20b5a9..6dc385ab 100644
--- a/test/agent_session_test.py
+++ b/test/agent_session_test.py
@@ -71,6 +71,12 @@ def check(binary, options, command, expected, phase=None, cleanup_failure=False)
assert time.monotonic() - started < 8, 'timeout did not bound cleanup'
+# What pardes does for the driver (a prompt that settles, history past a
+# screenful, a raw-mode key, a probe and ^U) is test/process/terminals.zig;
+# what is left here is the driver's own: its arguments, its JSON, its
+# timeouts and its cleanup.
+
+
def main():
parser = argparse.ArgumentParser()
parser.add_argument('binary', type=Path)
@@ -93,16 +99,11 @@ def main():
]:
check(binary, options, argv, 2)
check(binary, ready + ['--timeout', '10'], command, 0)
- check(binary, ready + ['--timeout', '10', '--min-rows', '1000'],
- ['/bin/sh', '-c', 'printf "AGENT_READY> "; sleep .3; seq 1 3000; printf "AGENT_READY> "; read answer'], 0)
- check(binary, ready + ['--timeout', '10', '--min-rows', '1000', '--prepare-key', '0f'],
- ['/bin/sh', '-c', 'stty raw -echo; printf "AGENT_READY> "; dd bs=1 count=1 of=/dev/null 2>/dev/null; '
- 'stty sane; seq 1 3000; printf "AGENT_READY> "; read answer'], 0)
check(binary, ready + ['--timeout', '2', '--min-rows', '1000'], command, 1, 'history')
check(binary, ready + ['--timeout', '1'],
['/bin/sh', '-c', ': AGENT_READY; sleep 30'], 1, 'readiness')
check(binary, ready + ['--timeout', '10'], command, 1, 'files-cleanup', cleanup_failure=True)
- print('agent-session: 16 functional argument, interaction, timeout and cleanup checks passed')
+ print('agent-session: 14 argument, output, timeout and cleanup checks of the driver passed')
if __name__ == '__main__':