Commit a189bd99 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 97d98934
...@@ -39,8 +39,12 @@ cpdef enum: ...@@ -39,8 +39,12 @@ cpdef enum:
# #
# mem start must be page-aligned. # mem start must be page-aligned.
def incore(const unsigned char[::1] mem not None) -> bytearray: def incore(const unsigned char[::1] mem not None) -> bytearray:
cdef size_t size = mem.shape[0]
if size == 0:
# XXX ok? or pass addr, 0 to mincore?
# XXX if size==0 &mem[0] raises out-of-bounds
return bytearray()
cdef const void *addr = &mem[0] cdef const void *addr = &mem[0]
cdef size_t size = mem.shape[0]
# size in pages; rounded up # size in pages; rounded up
cdef size_t pgsize = (size + (PAGE_SIZE-1)) // PAGE_SIZE cdef size_t pgsize = (size + (PAGE_SIZE-1)) // PAGE_SIZE
......
...@@ -397,7 +397,7 @@ def test_wcfs(): ...@@ -397,7 +397,7 @@ def test_wcfs():
t.wcsync() t.wcsync()
# f @head # f @head
f.assertCache([1,1,0,0]) f.assertCache([1,1,0,0]) # XXX fails here (.size changed)
f.assertData ([b'',b'', s1+b'ld', s2], mtime=t.head) f.assertData ([b'',b'', s1+b'ld', s2], mtime=t.head)
# f @tcommit1 # f @tcommit1
...@@ -406,9 +406,6 @@ def test_wcfs(): ...@@ -406,9 +406,6 @@ def test_wcfs():
f1.assertData ([b'',b'',s]) # XXX + mtime=tcommit1? f1.assertData ([b'',b'',s]) # XXX + mtime=tcommit1?
# TODO pagecache state after loading (via mincore)
# TODO pagecahce state after .size change
def test_wcfs_invproto(): def test_wcfs_invproto():
# XXX # XXX
pass pass
......
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