Commit 91592050 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b96008cb
...@@ -484,6 +484,9 @@ class tFile: ...@@ -484,6 +484,9 @@ class tFile:
# Expected data may be given with size < t.blksize. In such case the data # Expected data may be given with size < t.blksize. In such case the data
# is implicitly appended with trailing zeros. Data can be both bytes and unicode. # is implicitly appended with trailing zeros. Data can be both bytes and unicode.
# #
# It also checks that file watches are properly notified on data access -
# - see "7.2) for all registered client@at watchers ..."
#
# pinokByWLink: {} tWatchLink -> (zf, {} blk -> at). # pinokByWLink: {} tWatchLink -> (zf, {} blk -> at).
# pinokByWLink can be None - in that case it is computed automatically. # pinokByWLink can be None - in that case it is computed automatically.
def assertBlk(t, blk, dataok, pinokByWLink=None): def assertBlk(t, blk, dataok, pinokByWLink=None):
...@@ -503,9 +506,13 @@ class tFile: ...@@ -503,9 +506,13 @@ class tFile:
pinok = {} pinok = {}
if t.at is None: # @head/... if t.at is None: # @head/...
wat = wlink._watching.get(zf) wat = wlink._watching.get(zf)
if wat is not None and wat < blkrev and cached == 0: if wat is not None and wat < blkrev:
# XXX and watch not already pinned on the watch if cached == 1:
pinok = {blk: t.tdb._blkRev(t.zf, blk, wat)} # XXX assert blk already pinned on that watch
pass
else:
# XXX and watch not already pinned on the watch
pinok = {blk: t.tdb._blkRev(t.zf, blk, wat)}
wpin[wlink] = (t.zf, pinok) wpin[wlink] = (t.zf, pinok)
if pinokByWLink is not None: if pinokByWLink is not None:
...@@ -540,7 +547,7 @@ class tFile: ...@@ -540,7 +547,7 @@ class tFile:
ev = doCheckingPin(_, pinokByWLink) ev = doCheckingPin(_, pinokByWLink)
# XXX hack - wlinks are notified and emit events simultaneously - we # XXX hack - wlinks are notified and emit events simultaneously - we
# check only that events begin and end with read-related and that pins # check only that events begin and end with read pre/post and that pins
# are inside. Better do explicit check in tracetest style. # are inside. Better do explicit check in tracetest style.
assert ev[0] == 'read pre' assert ev[0] == 'read pre'
assert ev[-1] == 'read ' + dataok[0] assert ev[-1] == 'read ' + dataok[0]
......
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