Commit 28cf516f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 54192026
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"""test wcfs filesystem from outside as python client process""" """test wcfs filesystem from outside as python client process"""
from wendelin.lib.testing import getTestDB from wendelin.lib.testing import getTestDB
from wendelin.lib.mem import memcpy
from wendelin.bigfile.file_zodb import ZBigFile from wendelin.bigfile.file_zodb import ZBigFile
from wendelin.bigfile.tests.test_filezodb import blksize from wendelin.bigfile.tests.test_filezodb import blksize
from wendelin import wcfs from wendelin import wcfs
...@@ -158,6 +159,37 @@ def test_bigfile_empty(): ...@@ -158,6 +159,37 @@ def test_bigfile_empty():
assert readfile(fpath + "/head/at") == tid2.encode('hex') assert readfile(fpath + "/head/at") == tid2.encode('hex')
# TODO check head/at syncs to later non-bigfile commits # TODO check head/at syncs to later non-bigfile commits
# commit data to f and make sure we can see it on wcfs
fh = f.fileh_open()
vma = fh.mmap(10, 1) # 1 page at offset=10
s = b"hello world"
memcpy(vma, s)
last._p_changed = 1
transaction.commit()
tidlast = last._p_serial
# XXX force sync of wcfs - how?
fsize = 10*blksize + len(s) # trailing \0 not counted XXX ok?
"""
st = os.stat(fpath + "/head/data")
assert st.st_size == fsize
assert st.st_mtime == tidtime(tidlast)
assert readfile(fpath + "/head/at") == tidlast.encode("hex")
"""
data = readfile(fpath + "/head/data")
assert len(data) == fsize
for i in range(10):
assert data[i*blksize:(i+1)*blksize] == b'\0'*blksize
assert data[10*blksize:] == s
wc.close() wc.close()
......
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