Commit afdba282 authored by Kirill Smelkov's avatar Kirill Smelkov

bigfile/zodb/tests: Factor out code to reclaim all pages

We'll need it in other places in the next patch.
parent 1eeb0324
...@@ -50,6 +50,16 @@ def teardown_module(): ...@@ -50,6 +50,16 @@ def teardown_module():
testdb.teardown() testdb.teardown()
# reclaim all pages
def ram_reclaim_all():
reclaimed = 0
while 1:
n = ram_reclaim() # TODO + ram
if n == 0:
break
reclaimed += n
return reclaimed
# like db.cacheDetail(), but {} instead of [] # like db.cacheDetail(), but {} instead of []
def cacheInfo(db): def cacheInfo(db):
...@@ -258,12 +268,7 @@ def test_bigfile_filezodb(): ...@@ -258,12 +268,7 @@ def test_bigfile_filezodb():
# evict all loaded pages and test loading them again # evict all loaded pages and test loading them again
# (verifies ZBlk.loadblkdata() & loadblk logic when loading data the second time) # (verifies ZBlk.loadblkdata() & loadblk logic when loading data the second time)
reclaimed = 0 reclaimed = ram_reclaim_all()
while 1:
n = ram_reclaim() # TODO + ram
if n == 0:
break
reclaimed += n
assert reclaimed >= blen # XXX assumes pagesize=blksize assert reclaimed >= blen # XXX assumes pagesize=blksize
for i in xrange(blen): for i in xrange(blen):
......
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