Commit b810da3c authored by Jeremy Hylton's avatar Jeremy Hylton

Fix use of RecordIterator() in fsrecover and add trivial test case.

parent 58488067
......@@ -24,7 +24,7 @@ of critical data were lost.
Options:
-f
Force output to putput file even if it exists
Force output to output file even if it exists
-v level
......@@ -50,8 +50,8 @@ Options:
option is used, then t should be 0.
Important note: The ZODB package must be imporable. You may need
to adjust the Python path accordingly.
Important note: The ZODB package must be imporatble. You may need
to adjust PYTHONPATH accordingly.
"""
......@@ -139,13 +139,8 @@ def read_transaction_header(file, pos, file_size):
except: e={}
else: e={}
result=RecordIterator(
tid, status, user, description, e,
pos, (tend, file, seek, read,
tpos,
)
)
result = RecordIterator(tid, status, user, description, e, pos, tend,
file, tpos)
pos=tend
# Read the (intentionally redundant) transaction length
......
......@@ -16,8 +16,11 @@ from __future__ import nested_scopes
import ZODB.FileStorage
import sys, os, unittest
import errno
import filecmp
import StringIO
from ZODB.Transaction import Transaction
from ZODB import POSException
from ZODB.fsrecover import recover
from ZODB.tests import StorageTestBase, BasicStorage, \
TransactionalUndoStorage, VersionStorage, \
......@@ -167,6 +170,25 @@ class FileStorageTests(
self.failUnless(self._storage._records_before_save > 20)
def checkfsrecover(self):
# an absolutely minimal test of fsrecover
# Verify that calling recover on a small, correct storage
# produces a duplicate of the original.
for i in range(5):
oid = self._storage.new_oid()
revid = None
for j in range(5):
revid = self._dostore(oid, revid=revid)
temp = sys.stdout
sys.stdout = StringIO.StringIO()
try:
recover(["", "FileStorageTests.fs", "fsrecover.fs"])
finally:
sys.stdout = temp
self.assert_(filecmp.cmp("FileStorageTests.fs", "fsrecover.fs"))
StorageTestBase.removefs("fsrecover.fs")
def checkPackVersionsInPast(self):
# FileStorage can't cope with backpointers to objects
# created in versions. Must fix.
......
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