Commit a7dde4cb authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f9c4ebde
...@@ -671,15 +671,27 @@ def test_wcfs(): ...@@ -671,15 +671,27 @@ def test_wcfs():
# checkSetupWatch verifies setting up new watch for zf@at. # checkSetupWatch verifies setting up new watch for zf@at.
def checkSetupWatch(zf, at): def checkSetupWatch(zf, at):
print('check setup watch f<%s> @%s' % (h(zf._p_oid), h(at))) print('C: check setup watch f%s @%s' % (h(zf._p_oid), h(at)))
# all changes to zf # all changes to zf
vdf = [_.byfile[zf] for _ in t.dFtail if zf in t.dFtail.byfile] vdf = [_.byfile[zf] for _ in t.dFtail if zf in _.byfile]
# changes to zf after at # {} blk -> at that have to be pinned
vdfpost = [_ for _ in vdf if _.rev > at] # XXX also check that head/file[blk] is in cache - else no need to pin
pinok = {}
# XXX ... for df in [_ for _ in vdf if _.rev > at]:
for blk in df.ddata:
if blk in pinok:
continue
# history of blk changes <= at
blkhistoryat = [_.rev for _ in vdf if blk in _.ddata and _.rev <= at]
if len(blkhistoryat) == 0:
pinrev = 0 # was hole XXX -> h64
else:
pinrev = max(blkhistoryat)
pinok[blk] = pinrev
print('# pinok: %s' % pinok)
# open watch, send watch request and check that we receive pins for # open watch, send watch request and check that we receive pins for
# in-cache blocks changed > at. # in-cache blocks changed > at.
...@@ -687,7 +699,7 @@ def test_wcfs(): ...@@ -687,7 +699,7 @@ def test_wcfs():
ctx, cancel = context.with_cancel(bg) ctx, cancel = context.with_cancel(bg)
wg = sync.WorkGroup(ctx) wg = sync.WorkGroup(ctx)
def _(ctx): def _(ctx):
pinv = w.expectPin(ctx, zf, {}) # XXX expect=? pinv = w.expectPin(ctx, zf, pinok)
for p in pinv: for p in pinv:
p.reply(b"ack") p.reply(b"ack")
wg.go(_) wg.go(_)
...@@ -697,8 +709,9 @@ def test_wcfs(): ...@@ -697,8 +709,9 @@ def test_wcfs():
cancel() cancel()
wg.wait() wg.wait()
for i in range(len(t.dFtail)): for dF in t.dFtail:
1/0 for zf in dF.byfile:
checkSetupWatch(zf, dF.rev)
return return
......
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