diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-29 14:27:42 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-29 14:27:42 -0300 |
| commit | 7bd678868901ec9ae7c8e4369c16c53d30282e41 (patch) | |
| tree | bf673949f03f81d3e9e0d5f6785c9ed2b44c1670 | |
| parent | 00c56a4ca3fd938ebec2933ca3308aadbe4da6af (diff) | |
| download | pardes-7bd678868901ec9ae7c8e4369c16c53d30282e41.tar.gz pardes-7bd678868901ec9ae7c8e4369c16c53d30282e41.zip | |
test/fs.py: a new +Pager each run, its colours through the theme until Filter, SYSTEMD_PAGER read by the shell, and no pager of the caller's
Since 046979b8 (committed 2026-10-22) `pardes -` makes a new +Pager for
each paged text, one already there keeping its page, and maps its
colours through the theme as a terminal's until Filter shows them as
sent; the test still expected one +Pager refilled and the colour as
given. coreutils 9.12's printenv quotes a value with a blank on a
terminal, so the shell prints SYSTEMD_PAGER instead. And a session's
shells no longer inherit the caller's pagers: a PAGER naming the user's
own pardes-gui ran instead of the binary under test.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
| -rw-r--r-- | docs/next-daemon.md | 8 | ||||
| -rw-r--r-- | test/fs.py | 56 |
2 files changed, 40 insertions, 24 deletions
diff --git a/docs/next-daemon.md b/docs/next-daemon.md index 159e66e7..f60e32ab 100644 --- a/docs/next-daemon.md +++ b/docs/next-daemon.md @@ -381,9 +381,11 @@ Everything of ours lives in `/root/pardes-test`, nothing outside it. - test/daemon.py passes there at 20 cycles. One earlier run failed at cycle 3, one process short in its count (most likely ps -e failing to read an environment). - - test/fs.py runs as far as its `pardes -` +Pager checks. Those expect - one +Pager reused, which has not been true on Linux either since - 2026-10-22 (a new one each run). + - test/fs.py runs past its `pardes -` +Pager checks now, as far as the + SIGTERM and SIGHUP of a `--tty` stub: that test stops reading the pty + after the first frame, FreeBSD's pty fills before the session's frame + and reset are written, and the session waits in `ttyout` (a binary + from before these fixes too). Open. - **At 207 ms, for the replicas.** - In today's model every key is a round trip. Measured through `ssh -tt` (min, median and max): @@ -22,8 +22,10 @@ from ninep import Client @contextlib.contextmanager def session(binary, root, name, *options, socket_name=None, file=None, tty=False, network=None, launch=None, inherited=None, terminal=None): + # No pager of the caller's (a session's own PAGER, SYSTEMD_PAGER...): + # its shells get the session's defaults, the ones under test. env = {key: value for key, value in os.environ.items() - if not key.startswith('PARDES_')} + if not key.startswith('PARDES_') and 'PAGER' not in key} env.update(HOME=str(root), XDG_RUNTIME_DIR=str(root), XDG_CONFIG_HOME=str(root / 'config'), PARDES_NOTIME='1', PARDES_DUMP=str(root / (name + '.dump.zon'))) @@ -519,8 +521,10 @@ def run_file(binary): assert b'\x1b' not in client.read(f'/pane/{pager[0]}/body') client.remove(f'/pane/{pager[0]}') # systemd's tools page through their own variable: set too, its - # secure mode off, the path unquoted where it needs none. - systemd_pager = run(client, term, b'printenv SYSTEMD_PAGER; printenv SYSTEMD_PAGERSECURE\n') + # secure mode off, the path unquoted where it needs none. Read + # by the shell: coreutils 9.12's printenv quotes a value with a + # blank on a terminal. + systemd_pager = run(client, term, b'printf "%s\\n" "$SYSTEMD_PAGER" "$SYSTEMD_PAGERSECURE"\n') assert systemd_pager.startswith(b'exit 0\n') and systemd_pager.rstrip().endswith(b' -\n0'), systemd_pager if shutil.which('journalctl'): assert run(client, term, b'journalctl -n 3 --no-hostname\n').startswith(b'exit ') @@ -1762,34 +1766,43 @@ def test(binary, quic=False): assert f'\nnew {made_now} {root}/+Pager\n' in '\n' + log_now, log_now[-400:] assert f'\nrename {made_now} ' not in '\n' + log_now # Its colours are the pane's, drawn and never read: the body is - # the plain text, and the screen shows `red` in the theme's red - # and `rgb` in the colour given, the rest in the pane's ink. + # the plain text, and the screen shows `red` in the theme's red, + # the rest in the pane's ink. Mapped through the theme, as a + # terminal's are; Filter shows them as sent, `rgb` in the colour + # given. + # Each run is its own +Pager; one there already keeps its page. fed = subprocess.run([binary, '-'], cwd=root, env=env, input=b'\x1b]0;title\x07\x1b[31mred\x1b[m \x1b[38;2;1;2;3mrgb\x1b[m plain\n', stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=10) assert fed.returncode == 0, fed.stderr - assert client.read(f'/pane/{made_now}/body') == b'red rgb plain\n' - screen = client.screen() - for row in range(screen['rows']): - cells = screen['cells'][row * screen['cols']:(row + 1) * screen['cols']] - text = ''.join(cell[0] for cell in cells) - at = text.find('red rgb plain') - if at >= 0: - break - else: + coloured, = serials() - before - {made_now} + assert client.read(f'/pane/{coloured}/name') == f'{root}/+Pager\n'.encode() + assert client.read(f'/pane/{coloured}/body') == b'red rgb plain\n' + assert client.read(f'/pane/{made_now}/body') == b'bold text\n' + def inks(): + screen = client.screen() + for row in range(screen['rows']): + cells = screen['cells'][row * screen['cols']:(row + 1) * screen['cols']] + at = ''.join(cell[0] for cell in cells).find('red rgb plain') + if at >= 0: + return [screen['styles'][cells[at + i][1]]['fg'] for i in (0, 4, 8)] raise AssertionError(('the paged text is not on the screen', screen)) - ink = [screen['styles'][cells[at + i][1]]['fg'] for i in (0, 4, 8)] + ink = inks() + assert ink[0] != ink[2] and ink[1] != {'rgb': [1, 2, 3]}, ink + client.write(f'/pane/{coloured}/exec', b'Filter\n') + ink = inks() assert ink[1] == {'rgb': [1, 2, 3]}, ink assert ink[0] != ink[2] and ink[0] != ink[1], ink - # The directory's one +Pager: the next paged text refills it. + # A progress line keeps its last state. fed = subprocess.run([binary, '-'], cwd=root, env=env, input=b'again\r\nprogress 10%\rprogress 100%\n', stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=10) assert fed.returncode == 0, fed.stderr - assert serials() - before == {made_now}, (serials(), before) - assert client.read(f'/pane/{made_now}/body') == b'again\nprogress 100%\n' - client.remove(f'/pane/{made_now}') + again, = serials() - before - {made_now, coloured} + assert client.read(f'/pane/{again}/body') == b'again\nprogress 100%\n' + for serial in (made_now, coloured, again): + client.remove(f'/pane/{serial}') # More than one 8 MiB write's worth arrives whole, byte for byte, - # in the one +Pager (each write once replaced the last). + # in its +Pager (each write once replaced the last). big = b''.join(b'line %08d of the paged text\n' % i for i in range(400000)) # ~11 MiB assert len(big) > 8 * 1024 * 1024 fed = subprocess.run([binary, '-'], cwd=root, env=env, input=big, @@ -1804,7 +1817,8 @@ def test(binary, quic=False): stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=600) huge.wait() assert fed.returncode == 0, fed.stderr - assert serials() - before == {big_pane} + client.remove(f'/pane/{big_pane}') + big_pane, = serials() - before got = client.read(f'/pane/{big_pane}/body') note = b'\n[pardes: the rest of stdin is cut: a pane holds at most a file\'s limit]\n' assert got.endswith(note) and len(got) == cap + len(note), (len(got), got[-120:]) |
