summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-08-14 04:15:47 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-08-14 04:15:47 +0000
commit2429ac3b577dfc3ebc9f90f27acc4d00a5ae9620 (patch)
tree43b6cf09897d0c06003689dab36ac0a7c4d3adf8
parent8a11971d5a45979b330c8e729ccf418835f324a8 (diff)
downloadrdiff-backup-2429ac3b577dfc3ebc9f90f27acc4d00a5ae9620.tar.gz
Updated inctest - before it would compare increment attributes too strictly
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@612 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/rdiff_backup/rpath.py6
-rw-r--r--rdiff-backup/testing/incrementtest.py17
2 files changed, 13 insertions, 10 deletions
diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py
index 2816c91..42ad5e9 100644
--- a/rdiff-backup/rdiff_backup/rpath.py
+++ b/rdiff-backup/rdiff_backup/rpath.py
@@ -352,7 +352,8 @@ class RORPath:
def equal_verbose(self, other, check_index = 1,
compare_inodes = 0, compare_ownership = 0,
- compare_acls = 0, compare_eas = 0, verbosity = 2):
+ compare_acls = 0, compare_eas = 0, compare_size = 1,
+ compare_type = 1, verbosity = 2):
"""Like __eq__, but log more information. Useful when testing"""
if check_index and self.index != other.index:
log.Log("Index %s != index %s" % (self.index, other.index),
@@ -364,10 +365,11 @@ class RORPath:
(self.issym() or not compare_ownership)):
# Don't compare gid/uid for symlinks, or if told not to
pass
+ elif key == 'type' and not compare_type: pass
elif key == 'atime' and not Globals.preserve_atime: pass
elif key == 'ctime': pass
elif key == 'devloc' or key == 'nlink': pass
- elif key == 'size' and not self.isreg(): pass
+ elif key == 'size' and (not self.isreg() or not compare_size): pass
elif key == 'inode' and (not self.isreg() or not compare_inodes):
pass
elif key == 'ea' and not compare_eas: pass
diff --git a/rdiff-backup/testing/incrementtest.py b/rdiff-backup/testing/incrementtest.py
index 8c56f52..cea3efb 100644
--- a/rdiff-backup/testing/incrementtest.py
+++ b/rdiff-backup/testing/incrementtest.py
@@ -55,7 +55,7 @@ class inctest(unittest.TestCase):
diffrp = increment.Increment(rf, exec1, target)
assert diffrp.isreg(), diffrp
- assert rpath.cmp_attribs(diffrp, exec1)
+ assert diffrp.equal_verbose(exec1, check_index = 0, compare_size = 0)
self.check_time(diffrp)
assert diffrp.getinctype() == 'diff', diffrp.getinctype()
diffrp.delete()
@@ -78,7 +78,7 @@ class inctest(unittest.TestCase):
snap_rp2 = increment.Increment(sym, rf, target)
self.check_time(snap_rp2)
- assert rpath.cmp_attribs(snap_rp2, rf)
+ assert snap_rp2.equal_verbose(rf, check_index = 0)
assert rpath.cmp(snap_rp2, rf)
snap_rp2.delete()
@@ -87,13 +87,13 @@ class inctest(unittest.TestCase):
Globals.compression = 1
rp = increment.Increment(rf, sym, target)
self.check_time(rp)
- assert rpath.cmp_attribs(rp, sym)
+ assert rp.equal_verbose(sym, check_index = 0, compare_size = 0)
assert rpath.cmp(rp, sym)
rp.delete()
rp = increment.Increment(sym, rf, target)
self.check_time(rp)
- assert rpath.cmp_attribs(rp, rf)
+ assert rp.equal_verbose(rf, check_index = 0, compare_size = 0)
assert rpath.cmpfileobj(rp.open("rb", 1), rf.open("rb"))
assert rp.isinccompressed()
rp.delete()
@@ -104,7 +104,8 @@ class inctest(unittest.TestCase):
self.check_time(rp)
assert rp.lstat()
assert target.isdir()
- assert rpath.cmp_attribs(dir, rp)
+ assert dir.equal_verbose(rp, check_index = 0,
+ compare_size = 0, compare_type = 0)
assert rp.isreg()
rp.delete()
target.delete()
@@ -114,7 +115,7 @@ class inctest(unittest.TestCase):
Globals.compression = None
rp = increment.Increment(rf, rf2, target)
self.check_time(rp)
- assert rpath.cmp_attribs(rp, rf2)
+ assert rp.equal_verbose(rf2, check_index = 0, compare_size = 0)
Rdiff.patch_local(rf, rp, out2)
assert rpath.cmp(rf2, out2)
rp.delete()
@@ -125,7 +126,7 @@ class inctest(unittest.TestCase):
Globals.compression = 1
rp = increment.Increment(rf, rf2, target)
self.check_time(rp)
- assert rpath.cmp_attribs(rp, rf2)
+ assert rp.equal_verbose(rf2, check_index = 0, compare_size = 0)
Rdiff.patch_local(rf, rp, out2, delta_compressed = 1)
assert rpath.cmp(rf2, out2)
rp.delete()
@@ -139,7 +140,7 @@ class inctest(unittest.TestCase):
rp = increment.Increment(rf, out_gz, target)
self.check_time(rp)
- assert rpath.cmp_attribs(rp, out_gz)
+ assert rp.equal_verbose(out_gz, check_index = 0, compare_size = 0)
Rdiff.patch_local(rf, rp, out2)
assert rpath.cmp(out_gz, out2)
rp.delete()