Commit a252e8ca authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e2a40b50
...@@ -1731,6 +1731,7 @@ class tMapping(object): ...@@ -1731,6 +1731,7 @@ class tMapping(object):
# XXX assertData # XXX assertData
# test_wcfspy_virtmem verifies wcfs.py integration with virtmem. # test_wcfspy_virtmem verifies wcfs.py integration with virtmem.
@func @func
def test_wcfspy_virtmem(): def test_wcfspy_virtmem():
...@@ -1756,38 +1757,46 @@ def test_wcfspy_virtmem(): ...@@ -1756,38 +1757,46 @@ def test_wcfspy_virtmem():
tm1 = tMapping(m1) tm1 = tMapping(m1)
# pinned returns fh.pinned with rev wrapped into tAt.
# XXX better wrap FileH into tFileH and do this automatically in .pinned ?
def pinned(fh):
p = fh.pinned.copy()
for blk in p:
p[blk] = tAt(t, p[blk])
return p
#assertCache(m1, [0,0,0]) #assertCache(m1, [0,0,0])
assert fh.pinned == {} assert pinned(fh) == {}
# verify initial data reads # verify initial data reads
tm1.assertBlk(2, 'c1') tm1.assertBlk(2, 'c1')
assert fh.pinned == {2:at1} assert pinned(fh) == {2:at1}
tm1.assertBlk(3, 'd1') tm1.assertBlk(3, 'd1')
assert fh.pinned == {2:at1} assert pinned(fh) == {2:at1}
tm1.assertBlk(4, '') tm1.assertBlk(4, '')
assert fh.pinned == {2:at1} assert pinned(fh) == {2:at1}
# commit with growing file size -> verify data read as the same, #3 pinned. # commit with growing file size -> verify data read as the same, #3 pinned.
# (#4 is not yet pinned because it was not accessed) # (#4 is not yet pinned because it was not accessed)
at3 = t.commit(zf, {3:'d3', 4:'e3'}) at3 = t.commit(zf, {3:'d3', 4:'e3'})
assert fh.pinned == {2:at1} assert pinned(fh) == {2:at1}
tm1.assertBlk(2, 'c1') tm1.assertBlk(2, 'c1')
assert fh.pinned == {2:at1} assert pinned(fh) == {2:at1}
tm1.assertBlk(3, 'd1') tm1.assertBlk(3, 'd1')
assert fh.pinned == {2:at1, 3:at1} assert pinned(fh) == {2:at1, 3:at1}
tm1.assertBlk(4, '') tm1.assertBlk(4, '')
assert fh.pinned == {2:at1, 3:at1} assert pinned(fh) == {2:at1, 3:at1}
# resync at1 -> at2: #2 must unpin to @head; #4 must stay as zero # resync at1 -> at2: #2 must unpin to @head; #4 must stay as zero
wconn.resync(at2) wconn.resync(at2)
assert fh.pinned == {3:at1} assert pinned(fh) == {3:at1}
tm1.assertBlk(2, 'c2') tm1.assertBlk(2, 'c2')
tm1.assertBlk(3, 'd1') tm1.assertBlk(3, 'd1')
tm1.assertBlk(4, '') tm1.assertBlk(4, '')
# resync at2 -> at3: #3 must unpin to @head; #4 - start to read with data # resync at2 -> at3: #3 must unpin to @head; #4 - start to read with data
wconn.resync(at3) wconn.resync(at3)
assert fh.pinned == {} assert pinned(fh) == {}
tm1.assertBlk(2, 'c2') tm1.assertBlk(2, 'c2')
tm1.assertBlk(3, 'd3') tm1.assertBlk(3, 'd3')
tm1.assertBlk(4, 'e3') tm1.assertBlk(4, 'e3')
......
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