Commit da4814f6 authored by ben's avatar ben

Added tests for --windows-mode and high bit permissions.


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@181 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent f4c657b5
...@@ -211,6 +211,36 @@ class Final(PathSetter): ...@@ -211,6 +211,36 @@ class Final(PathSetter):
self.set_connections(None, None, "test2/tmp/", "../../") self.set_connections(None, None, "test2/tmp/", "../../")
self.exec_rb(None, '../../../../../../proc', 'testfiles/procoutput') self.exec_rb(None, '../../../../../../proc', 'testfiles/procoutput')
def testWindowsMode(self):
"""Test backup with the --windows-mode option"""
old_schema = self.rb_schema
self.rb_schema = old_schema + " --windows-mode "
self.set_connections(None, None, None, None)
self.delete_tmpdirs()
# Back up increment2, this contains a file with colons
self.exec_rb(20000, 'testfiles/increment2', 'testfiles/output')
time.sleep(1)
# Back up increment3
self.exec_rb(30000, 'testfiles/increment3', 'testfiles/output')
Globals.time_separator = "_"
inc_paths = self.getinc_paths("increments.",
"testfiles/output/rdiff-backup-data")
Globals.time_separator = ":"
assert len(inc_paths) == 1
# Restore increment2
self.exec_rb(None, inc_paths[0], 'testfiles/restoretarget2')
assert CompareRecursive(Local.inc2rp, Local.rpout2)
# Now check to make sure no ":" in output directory
popen_fp = os.popen("find testfiles/output -name '*:*' | wc")
wc_output = popen_fp.read()
popen_fp.close()
assert wc_output.split() == ["0", "0", "0"], wc_output
class FinalSelection(PathSetter): class FinalSelection(PathSetter):
"""Test selection options""" """Test selection options"""
......
...@@ -18,6 +18,7 @@ class LibrsyncTest(unittest.TestCase): ...@@ -18,6 +18,7 @@ class LibrsyncTest(unittest.TestCase):
new = RPath(Globals.local_connection, "testfiles/new") new = RPath(Globals.local_connection, "testfiles/new")
new2 = RPath(Globals.local_connection, "testfiles/new2") new2 = RPath(Globals.local_connection, "testfiles/new2")
sig = RPath(Globals.local_connection, "testfiles/signature") sig = RPath(Globals.local_connection, "testfiles/signature")
sig2 = RPath(Globals.local_connection, "testfiles/signature2")
delta = RPath(Globals.local_connection, "testfiles/delta") delta = RPath(Globals.local_connection, "testfiles/delta")
def testSigFile(self): def testSigFile(self):
"""Make sure SigFile generates same data as rdiff""" """Make sure SigFile generates same data as rdiff"""
...@@ -37,6 +38,26 @@ class LibrsyncTest(unittest.TestCase): ...@@ -37,6 +38,26 @@ class LibrsyncTest(unittest.TestCase):
assert rdiff_sig == librsync_sig, \ assert rdiff_sig == librsync_sig, \
(len(rdiff_sig), len(librsync_sig)) (len(rdiff_sig), len(librsync_sig))
def testSigGenerator(self):
"""Test SigGenerator, make sure it's same as SigFile"""
for i in range(5):
MakeRandomFile(self.basis.path)
sf = librsync.SigFile(self.basis.open("rb"))
sigfile_string = sf.read()
sf.close()
sig_gen = librsync.SigGenerator()
infile = self.basis.open("rb")
while 1:
buf = infile.read(1000)
if not buf: break
sig_gen.update(buf)
siggen_string = sig_gen.getsig()
assert sigfile_string == siggen_string, \
(len(sigfile_string), len(siggen_string))
def OldtestDelta(self): def OldtestDelta(self):
"""Test delta generation against Rdiff""" """Test delta generation against Rdiff"""
MakeRandomFile(self.basis.path) MakeRandomFile(self.basis.path)
......
...@@ -67,6 +67,11 @@ class CheckPerms(RPathTest): ...@@ -67,6 +67,11 @@ class CheckPerms(RPathTest):
assert self.rp_prefix.append('executable').getperms() == 0755 assert self.rp_prefix.append('executable').getperms() == 0755
assert self.rp_prefix.append('executable2').getperms() == 0700 assert self.rp_prefix.append('executable2').getperms() == 0700
def testhighbits(self):
"""Test reporting of highbit permissions"""
p = RPath(self.lc, "testfiles/rpath2/foobar").getperms()
assert p == 04100, p
def testOrdinaryReport(self): def testOrdinaryReport(self):
"""Ordinary file permissions...""" """Ordinary file permissions..."""
assert self.rp_prefix.append("regular_file").getperms() == 0644 assert self.rp_prefix.append("regular_file").getperms() == 0644
......
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