Commit 5f7b946e authored by Tim Peters's avatar Tim Peters

populate(): A number in a comment was off by a factor of 10.

testNoDamage():  Verify that the recovered .fs is in fact identical
to the original .fs.
parent 4ad9da64
...@@ -55,8 +55,7 @@ class RecoverTest(unittest.TestCase): ...@@ -55,8 +55,7 @@ class RecoverTest(unittest.TestCase):
cn = db.open() cn = db.open()
rt = cn.root() rt = cn.root()
# create a whole bunch of objects, # Create a bunch of objects; the Data.fs is about 100KB.
# looks like a Data.fs > 1MB
for i in range(50): for i in range(50):
d = rt[i] = PersistentMapping() d = rt[i] = PersistentMapping()
transaction.commit() transaction.commit()
...@@ -85,7 +84,7 @@ class RecoverTest(unittest.TestCase): ...@@ -85,7 +84,7 @@ class RecoverTest(unittest.TestCase):
sys.stdout = faux_stdout sys.stdout = faux_stdout
try: try:
recover(self.path, self.dest, recover(self.path, self.dest,
verbose=0, partial=1, force=0, pack=1) verbose=0, partial=True, force=False, pack=1)
except SystemExit: except SystemExit:
raise RuntimeError, "recover tried to exit" raise RuntimeError, "recover tried to exit"
finally: finally:
...@@ -103,6 +102,18 @@ class RecoverTest(unittest.TestCase): ...@@ -103,6 +102,18 @@ class RecoverTest(unittest.TestCase):
self.assert_('error' not in output, output) self.assert_('error' not in output, output)
self.assert_('\n0 bytes removed during recovery' in output, output) self.assert_('\n0 bytes removed during recovery' in output, output)
# Verify that the recovered database is identical to the original.
before = file(self.path, 'rb')
before_guts = before.read()
before.close()
after = file(self.dest, 'rb')
after_guts = after.read()
after.close()
self.assertEqual(before_guts, after_guts,
"recovery changed a non-damaged .fs file")
def testOneBlock(self): def testOneBlock(self):
for i in range(self.ITERATIONS): for i in range(self.ITERATIONS):
self.damage(1, 1024) self.damage(1, 1024)
......
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