summaryrefslogtreecommitdiff
path: root/test/fs.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/fs.py')
-rw-r--r--test/fs.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/test/fs.py b/test/fs.py
index c3ffa440..b20dc8ee 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -106,9 +106,8 @@ def newest(client):
def new_pane(client, contents):
- """mkdir in /pane; the editor names the directory after the new serial."""
- client.mkdir('/pane', 'scratch')
- serial = newest(client)
+ """An open of /pane/new makes a pane; the read names it."""
+ serial = int(client.read('/pane/new'))
if contents:
client.write(f'/pane/{serial}/body', contents)
return serial
@@ -151,7 +150,7 @@ def discovery(binary, embedded=False):
assert ('src' in top) == embedded, (top, embedded)
before = client.read('/index')
guide = client.read('/README')
- assert guide.count(b'\n') <= 45 and b'Msg hello' in guide and b'mkdir' in guide, guide
+ assert guide.count(b'\n') <= 45 and b'Msg hello' in guide and b'pane/new' in guide, guide
assert client.stat('/README')['length'] == len(guide)
# ls/stat/find over the whole tree, without opening, creates nothing.
seen = walk_tree(client)
@@ -183,17 +182,20 @@ def discovery(binary, embedded=False):
status = dict(line.split(maxsplit=1) for line in client.read('/status').decode().splitlines())
assert int(status['pid']) > 0 and status['version'] and int(status['panes']) >= 1, status
assert client.read('/exec') == b''
- # mkdir makes a pane, named by the serial the editor gives it.
+ # An open of /pane/new makes a pane and the read names it; each
+ # open makes another. A stat makes none, which is why new can be
+ # listed at all: ls -l stats every name a listing gave it.
log = client.open('/log')
- client.mkdir('/pane', 'one')
- first = newest(client)
- client.mkdir('/pane', 'two')
- second = newest(client)
+ first = int(client.read('/pane/new'))
+ assert first == newest(client)
+ second = int(client.read('/pane/new'))
assert first != second and first != fixture, (first, second)
- assert 'one' not in client.list('/pane') and 'two' not in client.list('/pane')
+ assert 'new' in client.list('/pane'), 'new should be visible to ls'
+ client.stat('/pane/new')
+ assert newest(client) == second, 'a stat of new made a pane'
assert client.read_fid(log) == f'new {first} {root}/+New\n'.encode()
assert client.read_fid(log) == f'new {second} {root}/+New\n'.encode()
- assert set(client.list('/pane')) == {str(fixture), str(first), str(second)}
+ assert set(client.list('/pane')) == {'new', str(fixture), str(first), str(second)}
client.write(f'/pane/{first}/body', b'first pane', truncate=True)
assert client.read(f'/pane/{first}/body') == b'first pane'
assert client.read(f'/pane/{second}/body') == b''
@@ -247,6 +249,7 @@ def discovery(binary, embedded=False):
refused = [lambda: client.write('/exec', b'Msg a\x00b'),
lambda: client.write('/status', b'anything\n'),
lambda: client.mkdir('/', 'x'),
+ lambda: client.mkdir('/pane', 'one'),
lambda: client.create('/pane', 'plain-file'),
lambda: client.remove('/pane/1/body'),
lambda: client.remove('/index')]
@@ -262,7 +265,7 @@ def discovery(binary, embedded=False):
assert client.read('/src/pardes.zig').startswith(b'const std')
assert client.stat('/src/pardes.zig')['mode'] == 0o444
assert b'pub const Pardes' in client.read(f'/pane/{look(client, "/virtual/src/pardes.zig")}/body')
- print('9P discovery: listing/stat/find are inert; create, remove, look, exec, name, sel and log behave')
+ print('9P discovery: listing/stat/find are inert; new, remove, look, exec, name, sel and log behave')
def test(binary, quic=False):