summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fs.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/fs.py b/test/fs.py
index a6d24e0b..816f416c 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -218,21 +218,21 @@ def discovery(binary, embedded=False):
client.write('/exec', b'Msg woken\n')
reader.join(5)
assert woke and woke[0].endswith(b' woken\n'), woke
- # A pane's ctl takes acme's lock: a second open's lock waits until
- # the holder unlocks, and nothing else waits on it meanwhile.
+ # A pane's ctl takes acme's lock: a second open's lock fails at
+ # once with "file in use" until the holder unlocks, and nothing
+ # else waits on it meanwhile.
with Client(address) as other:
mine = client.open(f'/pane/{first}/ctl', 2)
client.rpc(118, struct.pack('<IQI', mine, 0, 5) + b'lock\n')
theirs = other.open(f'/pane/{first}/ctl', 1)
- locked = []
- locker = threading.Thread(target=lambda: locked.append(other.rpc(118, struct.pack('<IQI', theirs, 0, 5) + b'lock\n')), daemon=True)
- locker.start()
- time.sleep(.2)
- assert not locked
+ try:
+ other.rpc(118, struct.pack('<IQI', theirs, 0, 5) + b'lock\n')
+ raise AssertionError('a second lock was taken')
+ except OSError as refused:
+ assert 'file in use' in str(refused), refused
client.write(f'/pane/{first}/addr', b'#0')
client.rpc(118, struct.pack('<IQI', mine, 0, 7) + b'unlock\n')
- locker.join(5)
- assert locked, 'a lock waiting on another open goes once it unlocks'
+ other.rpc(118, struct.pack('<IQI', theirs, 0, 5) + b'lock\n')
client.close(mine)
other.close(theirs)
# /focus names the pane with the keyboard and moves it, as rio's