, RescueCorruptHoleTest \
, RescueCorruptHoleGZTest \
, RescueCorruptHoleGZAESTest \
- , GenIndexIntactTest \
- , GenIndexIntactGZTest \
- , GenIndexIntactGZAESTest
+ , GenIndexIntactSingleTest \
+ , GenIndexIntactSingleGZTest \
+ , GenIndexIntactSingleGZAESTest \
+ , GenIndexIntactMultiTest \
+ , GenIndexIntactMultiGZTest \
+ , GenIndexIntactMultiGZAESTest
from testing.test_rescue_tar import RescueTarTest
from testing.test_encryption import EncryptionTest
from testing.test_deltatar import (DeltaTarTest, DeltaTar2Test,
, RescueCorruptHoleTest
, RescueCorruptHoleGZTest
, RescueCorruptHoleGZAESTest
- , GenIndexIntactTest
- , GenIndexIntactGZTest
- , GenIndexIntactGZAESTest
+ , GenIndexIntactSingleTest
+ , GenIndexIntactSingleGZTest
+ , GenIndexIntactSingleGZAESTest
+ , GenIndexIntactMultiTest
+ , GenIndexIntactMultiGZTest
+ , GenIndexIntactMultiGZAESTest
]:
try:
t = group (n)
return bak_path, backup_file, backup_full, index_file
+ def gen_multivol (self, nvol):
+ # add n files for one nth the volume size each, corrected
+ # for metadata and tar block overhead
+ fsiz = int ( ( TEST_VOLSIZ
+ / (TEST_FILESPERVOL * VOLUME_OVERHEAD))
+ * 1024 * 1024)
+ fcnt = (self.VOLUMES - 1) * TEST_FILESPERVOL
+ for i in range (fcnt):
+ nvol, invol = divmod(i, TEST_FILESPERVOL)
+ f = "dummy_vol_%d_n_%0.2d" % (nvol, invol)
+ self.hash [f] = self.create_file ("%s/%s"
+ % (self.src_path, f),
+ fsiz,
+ random=True)
+
+
class RecoverTest (DefectiveTest):
"""
Recover: restore corrupt backups from index file information.
self.gen_file_names (self.COMPRESSION, self.PASSWORD)
if self.VOLUMES > 1:
- # add n files for one nth the volume size each, corrected
- # for metadata and tar block overhead
- fsiz = int ( ( TEST_VOLSIZ
- / (TEST_FILESPERVOL * VOLUME_OVERHEAD))
- * 1024 * 1024)
- fcnt = (self.VOLUMES - 1) * TEST_FILESPERVOL
- for i in range (fcnt):
- nvol, invol = divmod(i, TEST_FILESPERVOL)
- f = "dummy_vol_%d_n_%0.2d" % (nvol, invol)
- self.hash [f] = self.create_file ("%s/%s"
- % (self.src_path, f),
- fsiz,
- random=True)
+ self.gen_multivol (self.VOLUMES)
vname = partial (self.default_volume_name, backup_file)
dtar = deltatar.DeltaTar (mode=mode,
self.gen_file_names (self.COMPRESSION, self.PASSWORD)
if self.VOLUMES > 1:
- # add n files for one nth the volume size each, corrected
- # for metadata and tar block overhead
- fsiz = int ( ( TEST_VOLSIZ
- / (TEST_FILESPERVOL * VOLUME_OVERHEAD))
- * 1024 * 1024)
- fcnt = (self.VOLUMES - 1) * TEST_FILESPERVOL
- for i in range (fcnt):
- nvol, invol = divmod(i, TEST_FILESPERVOL)
- f = "dummy_vol_%d_n_%0.2d" % (nvol, invol)
- self.hash [f] = self.create_file ("%s/%s"
- % (self.src_path, f),
- fsiz,
- random=True)
+ self.gen_multivol (self.VOLUMES)
vname = partial (self.default_volume_name, backup_file)
dtar = deltatar.DeltaTar (mode=mode,
bak_path, backup_file, backup_full, index_file = \
self.gen_file_names (self.COMPRESSION, self.PASSWORD)
+ if self.VOLUMES > 1:
+ self.gen_multivol (self.VOLUMES)
+
vname = partial (self.default_volume_name, backup_file)
dtar = deltatar.DeltaTar (mode=mode,
logger=None,
mode,
password=self.PASSWORD)
- assert len (psidx) == len (self.hash)
+ # correct for objects spanning volumes: these are treated as separate
+ # in the index!
+ assert len (psidx) - self.VOLUMES + 1 == len (self.hash)
###############################################################################
VOLUMES = 1
MISMATCHES = 1
+class GenIndexIntactSingleTest (GenIndexIntactBaseTest):
+ pass
+
+class GenIndexIntactSingleGZTest (GenIndexIntactBaseTest):
+ COMPRESSION = "#gz"
+ MISSING = 2
+
+class GenIndexIntactSingleGZAESTest (GenIndexIntactBaseTest):
+ COMPRESSION = "#gz"
+ PASSWORD = TEST_PASSWORD
+ MISSING = 2
-class GenIndexIntactTest (GenIndexIntactBaseTest):
+class GenIndexIntactMultiTest (GenIndexIntactBaseTest):
+ VOLUMES = 3
pass
-class GenIndexIntactGZTest (GenIndexIntactBaseTest):
+class GenIndexIntactMultiGZTest (GenIndexIntactBaseTest):
+ VOLUMES = 3
COMPRESSION = "#gz"
MISSING = 2
-class GenIndexIntactGZAESTest (GenIndexIntactBaseTest):
+class GenIndexIntactMultiGZAESTest (GenIndexIntactBaseTest):
+ VOLUMES = 3
COMPRESSION = "#gz"
PASSWORD = TEST_PASSWORD
MISSING = 2