summaryrefslogtreecommitdiff
path: root/test/v9fs.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/v9fs.py')
-rw-r--r--test/v9fs.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/test/v9fs.py b/test/v9fs.py
index fa35388f..30efe9fb 100644
--- a/test/v9fs.py
+++ b/test/v9fs.py
@@ -45,6 +45,7 @@ def worker(mountpoint, socket, uid, gid, original_namespace):
tree = mountpoint
assert {'os', 'index', 'pane', 'status', 'look', 'exec', 'log', 'screen', 'README'} <= set(os.listdir(tree))
assert 'self' not in os.listdir(tree) and 'new' not in os.listdir(tree)
+ assert 'new' not in os.listdir(tree / 'pane'), 'a listing would make a pane per stat'
# A direct connection provides independent evidence for VFS reads/writes.
with Client(socket) as client:
assert (tree / 'index').read_bytes() == client.read('/index')
@@ -55,26 +56,22 @@ def worker(mountpoint, socket, uid, gid, original_namespace):
subprocess.run(['find', str(tree / 'pane'), '-ls'], check=True, capture_output=True, timeout=5)
assert (tree / 'README').read_bytes() == client.read('/README')
assert client.read('/index') == before, 'browsing created panes'
- # mkdir through the kernel mount opens a pane. The editor names it
- # after its serial, not after the name asked for, so the kernel's own
- # revalidation of that name may fail; the index is the answer.
+ # Opening pane/new makes a pane and the read names it, so no trip
+ # through the index. Whether a repeated path reaches the server at all
+ # is the kernel's dentry cache's business, so the second pane comes
+ # over the wire, where the open is exact.
def serials():
return {int(row.split()[0]) for row in (tree / 'index').read_bytes().splitlines()}
- def mkpane(name):
+ def mkpane():
known = serials()
- try:
- (tree / 'pane' / name).mkdir()
- except FileNotFoundError:
- pass
- made = serials() - known
- assert len(made) == 1, (name, made)
- return made.pop()
+ made = int((tree / 'pane' / 'new').read_bytes())
+ assert made not in known, 'the open of new made no pane'
+ return made
- serial = mkpane('kernel-made')
- another = mkpane('kernel-made-again')
- assert serial != another, 'a second mkdir reused a pane'
- assert not (tree / 'pane' / 'kernel-made').exists()
+ serial = mkpane()
+ another = int(client.read('/pane/new'))
+ assert serial != another, 'a second open of new reused a pane'
(tree / 'pane' / str(another)).rmdir()
assert another not in serials()
pane = tree / 'pane' / str(serial)