Commit f18ca4c6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8d046f41
......@@ -345,19 +345,19 @@ def test_wcfs():
assert tidtime(tid2) > tidtime(tid1)
t.wcsync()
# lookup to non-BigFile - must be rejected
# >>> lookup non-BigFile -> must be rejected
with raises(OSError) as exc:
t.stat(nonfile)
assert exc.value.errno == EINVAL
f = t.open(zf)
# file initially empty
# * file initially empty
f.assertCache([])
f.assertData ([], mtime=tid1)
# commit data to zf -> verify we can see it on wcfs
# (use !wcfs mode so that we prepare data independently of wcfs code paths)
# >>> commit data to zf -> verify we can see it on 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"
......@@ -369,7 +369,7 @@ def test_wcfs():
f.assertData ([b'',b'',s], mtime=t.head)
# commit data again -> verify we can see both latest and snapshotted states.
# >>> commit data again -> verify we can see both latest and snapshotted states.
at1 = t.head
zfh = zf.fileh_open(_use_wcfs=False)
......@@ -393,12 +393,48 @@ def test_wcfs():
f1.assertData ([b'',b'',s]) # XXX + mtime=at1?
# >>> commit again without changing zf size
at2 = t.head
f2 = t.open(zf, at=at2)
zfh = zf.fileh_open(_use_wcfs=False)
vma = zfh.mmap(2, 1)
memcpy(vma, b'hello kitty')
t.commit()
t.wcsync()
f.assertCache([1,1,0,1])
# f @head is opened again -> cache must not be lost
f.assertCache([1,1,1,1])
f_ = t.open(zf)
f_.assertCache([1,1,1,1])
f_.assertCache([1,1,0,1])
f_.close()
f.assertCache([1,1,0,1])
# f @head
f.assertData ([b'',b'',b'hello kitty',b'alpha'], mtime=t.head)
# f @at2
f2.assertCache([0,0,1,0])
f2.assertData ([b'',b'',b'hello 123ld',b'alpha']) # XXX mtime=at2
# f @at1
f1.assertCache([1,1,1])
f1.assertData ([b'',b'',b'hello world']) # XXX + mtime=at1?
# >>> f close / open again -> cache must not be lost
# XXX bit flaky since OS can evict whole f cache under pressure
f.assertCache([1,1,1,1])
f.close()
# XXX os.sync?
f = t.open(zf)
assert f.cached() != [0,0,0,0]
def test_wcfs_invproto():
......
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