From d8a9ff981f1ce8590c5b1c5376cad0e3e07abacf Mon Sep 17 00:00:00 2001 From: ben Date: Sat, 10 Aug 2002 00:43:20 +0000 Subject: Added tests for --windows-mode and high bit permissions. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@181 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/testing/finaltest.py | 30 ++++++++++++++++++++++++++++++ rdiff-backup/testing/librsynctest.py | 21 +++++++++++++++++++++ rdiff-backup/testing/rpathtest.py | 5 +++++ 3 files changed, 56 insertions(+) diff --git a/rdiff-backup/testing/finaltest.py b/rdiff-backup/testing/finaltest.py index 31c57b8..f1a1a51 100644 --- a/rdiff-backup/testing/finaltest.py +++ b/rdiff-backup/testing/finaltest.py @@ -211,6 +211,36 @@ class Final(PathSetter): self.set_connections(None, None, "test2/tmp/", "../../") 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): """Test selection options""" diff --git a/rdiff-backup/testing/librsynctest.py b/rdiff-backup/testing/librsynctest.py index e2cdeb3..86a5c01 100644 --- a/rdiff-backup/testing/librsynctest.py +++ b/rdiff-backup/testing/librsynctest.py @@ -18,6 +18,7 @@ class LibrsyncTest(unittest.TestCase): new = RPath(Globals.local_connection, "testfiles/new") new2 = RPath(Globals.local_connection, "testfiles/new2") sig = RPath(Globals.local_connection, "testfiles/signature") + sig2 = RPath(Globals.local_connection, "testfiles/signature2") delta = RPath(Globals.local_connection, "testfiles/delta") def testSigFile(self): """Make sure SigFile generates same data as rdiff""" @@ -37,6 +38,26 @@ class LibrsyncTest(unittest.TestCase): assert rdiff_sig == 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): """Test delta generation against Rdiff""" MakeRandomFile(self.basis.path) diff --git a/rdiff-backup/testing/rpathtest.py b/rdiff-backup/testing/rpathtest.py index 46facf2..e96a4fb 100644 --- a/rdiff-backup/testing/rpathtest.py +++ b/rdiff-backup/testing/rpathtest.py @@ -67,6 +67,11 @@ class CheckPerms(RPathTest): assert self.rp_prefix.append('executable').getperms() == 0755 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): """Ordinary file permissions...""" assert self.rp_prefix.append("regular_file").getperms() == 0644 -- cgit v1.2.1