Commit ec199348 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f18ca4c6
......@@ -303,6 +303,7 @@ class tFile:
assert blk < (st.st_size // t.blksize)
assert st.st_size // t.blksize <= t._max_tracked
# XXX assert individually for every block page? (easier debugging?)
assert t.blk(blk) == data, ("#blk: %d" % blk)
# we just accessed the block - it has to be in OS cache
......@@ -360,13 +361,12 @@ def test_wcfs():
# (use !wcfs mode so that we prepare data independently of wcfs code paths)
zfh = zf.fileh_open(_use_wcfs=False)
vma = zfh.mmap(2, 1) # 1 page at offset=2
s = b"hello world"
memcpy(vma, s)
memcpy(vma, b'alpha')
t.commit()
t.wcsync()
f.assertCache([0,0,0]) # initially not cached
f.assertData ([b'',b'',s], mtime=t.head)
f.assertData ([b'',b'',b'alpha'], mtime=t.head)
# >>> commit data again -> verify we can see both latest and snapshotted states.
......@@ -375,22 +375,20 @@ def test_wcfs():
zfh = zf.fileh_open(_use_wcfs=False)
vma1 = zfh.mmap(2, 1)
vma2 = zfh.mmap(2+1, 1)
s1 = b"hello 123"
s2 = b"alpha"
memcpy(vma1,s1)
memcpy(vma2,s2)
memcpy(vma1,b'beta')
memcpy(vma2,b'gamma')
t.commit()
t.wcsync()
# f @head
f.assertCache([1,1,0,0])
f.assertData ([b'',b'', s1+b'ld', s2], mtime=t.head)
f.assertData ([b'',b'', b'betaa', b'gamma'], mtime=t.head)
# f @at1
f1 = t.open(zf, at=at1)
f1.assertCache([0,0,1])
f1.assertData ([b'',b'',s]) # XXX + mtime=at1?
f1.assertData ([b'',b'',b'alpha']) # XXX + mtime=at1?
# >>> commit again without changing zf size
......@@ -399,7 +397,7 @@ def test_wcfs():
zfh = zf.fileh_open(_use_wcfs=False)
vma = zfh.mmap(2, 1)
memcpy(vma, b'hello kitty')
memcpy(vma, b'kitty')
t.commit()
t.wcsync()
......@@ -413,15 +411,15 @@ def test_wcfs():
f.assertCache([1,1,0,1])
# f @head
f.assertData ([b'',b'',b'hello kitty',b'alpha'], mtime=t.head)
f.assertData ([b'',b'',b'kitty',b'gamma'], mtime=t.head)
# f @at2
f2.assertCache([0,0,1,0])
f2.assertData ([b'',b'',b'hello 123ld',b'alpha']) # XXX mtime=at2
f2.assertData ([b'',b'',b'betaa',b'gamma']) # XXX mtime=at2
# f @at1
f1.assertCache([1,1,1])
f1.assertData ([b'',b'',b'hello world']) # XXX + mtime=at1?
f1.assertData ([b'',b'',b'alpha']) # XXX + mtime=at1?
......
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