summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fs.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/fs.py b/test/fs.py
index b2f52c3e..789021bd 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -1467,6 +1467,29 @@ def test(binary, quic=False):
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}')
+ # More than one 8 MiB write's worth arrives whole, byte for byte,
+ # in the one +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,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=120)
+ assert fed.returncode == 0, fed.stderr
+ big_pane, = serials() - before
+ assert client.read(f'/pane/{big_pane}/body') == big, 'the paged body is not the text'
+ # Past the 256 MiB cap: the first 256 MiB, then the cut note.
+ cap = 256 * 1024 * 1024
+ huge = subprocess.Popen(['sh', '-c', f'yes 0123456789abcdef | head -c {cap + 4096}'], stdout=subprocess.PIPE)
+ fed = subprocess.run([binary, '-'], cwd=root, env=env, stdin=huge.stdout,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=600)
+ huge.wait()
+ assert fed.returncode == 0, fed.stderr
+ assert serials() - before == {big_pane}
+ 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:])
+ assert got[:cap] == (b'0123456789abcdef\n' * (cap // 17 + 1))[:cap]
+ del got, big
+ client.remove(f'/pane/{big_pane}')
# From a directory whose name could not be a ctl line: the
# session's directory's +Pager, the text whole, no stray +New.
odd = root / 'two\nlines'