Commit ab17f37c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bc4bb76c
......@@ -35,7 +35,7 @@ from ZODB.utils import z64, u64, p64
import sys, os, os.path, subprocess, threading, inspect, traceback, re
from errno import EINVAL
from golang import go, chan, func, defer, select
from golang import go, chan, select, func, defer
from golang import context, sync, time
from golang.gcompat import qq
from zodbtools.util import ashex as h, fromhex
......@@ -525,8 +525,19 @@ class tFile:
#
# pinokByWLink: {} tWatchLink -> {} blk -> at.
# pinokByWLink can be None - in that case it is computed automatically.
@func
def assertBlk(t, blk, dataok, pinokByWLink=None):
print('assertBlk #%d' % blk)
#print('assertBlk #%d' % blk)
# XXX -> assertCtx('blk #%d' % blk)
def _():
assertCtx = 'blk #%d' % blk
_, e, _ = sys.exc_info()
if isinstance(e, AssertionError):
assert len(e.args) == 1 # pytest puts everything as args[0]
e.args = (assertCtx + "\n" + e.args[0],)
defer(_)
if not isinstance(dataok, bytes):
dataok = dataok.encode('utf-8')
assert len(dataok) <= t.blksize
......@@ -535,8 +546,18 @@ class tFile:
dataok += b'\0'*(t.blksize - len(dataok)) # tailing zeros
assert blk < t._sizeinblk()
# access to this block must not trigger access to other blocks
incore_before = t.cached()
def _():
incore_after = t.cached()
incore_before[blk] = ''
incore_after [blk] = ''
incore_after [-1] = 2.0 # XXX
assert incore_before == incore_after
defer(_)
cached = t.cached()[blk]
assert cached in (0, 1), "blk #%d" % blk # XXX temp - breaks becuase of kernel readahead
assert cached in (0, 1)
shouldPin = False # whether at least one wlink should receive a pin
# watches must be notified if access goes to @head/file; not if to @rev/file. XXX text
......
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