Commit 736447eb authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d245e5ef
......@@ -805,7 +805,7 @@ def _watch(twlink, zf, at, pinok, replyok):
assert reply[:len(rok)] == rok
else:
assert reply == replyok
# cancel _expectPin waiting upon receiving "ok" from wcfs
# cancel _expectPin waiting upon receiving reply from wcfs
# -> error that missed pins were not received.
cancel()
wg.go(_)
......@@ -966,25 +966,54 @@ def test_wcfs():
f.assertCache([1,1,1,1])
t.change(zf, { 2: '4c', 5: '4f'}) # FIXME + 4a after δbtree works
at4 = t.commit()
f.assertCache([1,1,0,1,0,0]) # FIXME a must be invalidated - see ^^^
f.assertCache([1,1,0,1,0,0]) # FIXME a must be invalidated - see δbtree ^^^
ctx, cancel = with_timeout()
wg = sync.WorkGroup(ctx)
blk = 2
blk_data = f.blk(blk)
assert f.cached()[blk] == 0
# XXX dup wrte tWatchLink._watch
ev = []
def _(ctx):
pinv = wl._expectPin(ctx, zf, pinok)
ev.append('pin rx')
tdelay() # XXX + ev.sleep ?
ev.append('pin ack')
pin.ack()
blk = f.blk(2)
assert f.cached()[2] == 0
ev.append('read pre')
blk[0] # read access -> XXX without GIL
ev.append('read post')
assert f.cached()[2] > 0
f.assertBlk(2, '4c')
assert ev == ['read pre', 'pin rx', 'pin ack', 'read post']
assert f.cached()[2] == 1
tdelay() # XXX doc
ev.append('pin ack pre')
for p in pinv:
pin.reply("ack")
# check that we don't get extra pins before read wakeup
try:
req = twlink.recvReq(ctx)
except Exception as e:
if e is context.canceled:
return # cancel is expected after seeing "ok"
reraise(e, None, e.__traceback__)
assert False, "extra pin message received: %r" % req.msg
wg.go(_)
def _(ctx):
assert f.cached()[blk] == 0
ev.append('read pre')
blk_data[0] # read access -> XXX without GIL
ev.append('read')
# cancel _expectPin waiting upon waking up from read from wcfs
# -> error that missed pins were not received.
cancel()
wg.go(_)
wg.wait()
assert ev == ['read pre', 'pin rx', 'pin ack pre', 'read']
assert f.cached()[blk] > 0
f.assertBlk(blk, '4c')
assert f.cached()[blk] == 1
wl.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment