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

.

parent d245e5ef
...@@ -805,7 +805,7 @@ def _watch(twlink, zf, at, pinok, replyok): ...@@ -805,7 +805,7 @@ def _watch(twlink, zf, at, pinok, replyok):
assert reply[:len(rok)] == rok assert reply[:len(rok)] == rok
else: else:
assert reply == replyok 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. # -> error that missed pins were not received.
cancel() cancel()
wg.go(_) wg.go(_)
...@@ -966,25 +966,54 @@ def test_wcfs(): ...@@ -966,25 +966,54 @@ def test_wcfs():
f.assertCache([1,1,1,1]) f.assertCache([1,1,1,1])
t.change(zf, { 2: '4c', 5: '4f'}) # FIXME + 4a after δbtree works t.change(zf, { 2: '4c', 5: '4f'}) # FIXME + 4a after δbtree works
at4 = t.commit() 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 = [] ev = []
def _(ctx): def _(ctx):
pinv = wl._expectPin(ctx, zf, pinok)
ev.append('pin rx') ev.append('pin rx')
tdelay() # XXX + ev.sleep ? tdelay() # XXX doc
ev.append('pin ack')
pin.ack() ev.append('pin ack pre')
for p in pinv:
blk = f.blk(2) pin.reply("ack")
assert f.cached()[2] == 0
ev.append('read pre') # check that we don't get extra pins before read wakeup
blk[0] # read access -> XXX without GIL try:
ev.append('read post') req = twlink.recvReq(ctx)
assert f.cached()[2] > 0 except Exception as e:
if e is context.canceled:
f.assertBlk(2, '4c') return # cancel is expected after seeing "ok"
assert ev == ['read pre', 'pin rx', 'pin ack', 'read post'] reraise(e, None, e.__traceback__)
assert f.cached()[2] == 1
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() 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