diff options
author | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-03-02 07:09:08 +0000 |
---|---|---|
committer | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-03-02 07:09:08 +0000 |
commit | 3f1a6c04e8ec15e9948539a4714e9e7e90c8944a (patch) | |
tree | a75563b8f1492c6fcd557676fb69af5a06322a57 /rdiff-backup/testing/regresstest.py | |
parent | 3f23be3b6e8f61de2ef2d8408c474e22df8cfeb9 (diff) | |
download | rdiff-backup-3f1a6c04e8ec15e9948539a4714e9e7e90c8944a.tar.gz |
Final check in for version 0.11.2
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@285 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing/regresstest.py')
-rw-r--r-- | rdiff-backup/testing/regresstest.py | 131 |
1 files changed, 76 insertions, 55 deletions
diff --git a/rdiff-backup/testing/regresstest.py b/rdiff-backup/testing/regresstest.py index cb13765..be02e67 100644 --- a/rdiff-backup/testing/regresstest.py +++ b/rdiff-backup/testing/regresstest.py @@ -6,70 +6,91 @@ Not to be confused with the regression tests. import unittest from commontest import * -from rdiff_backup import regress +from rdiff_backup import regress, Time -Log.setverbosity(7) +Log.setverbosity(3) class RegressTest(unittest.TestCase): - regress_rp1 = rpath.RPath(Globals.local_connection, - "testfiles/regress_output1") - regress_rp2 = rpath.RPath(Globals.local_connection, - "testfiles/regress_output2") - - def make_output(self, level): - """Set up two rdiff-backup destination dir of level and level+1 - - testfiles/regress_output1 will be a copy of - testfiles/increment1 through testfiles/increment{level} - - testfiles/regress_output2 will have all everything backed up - in testfiles/regress_output1 + testfiles/increment{level+1}. - - The time of each increment will be 10000*level. - - """ - assert 1 <= level <= 3 - if self.regress_rp1.lstat(): Myrm(self.regress_rp1.path) - if self.regress_rp2.lstat(): Myrm(self.regress_rp2.path) - - # Make regress_output1 - Log("Making %s" % (self.regress_rp1.path,), 4) - for i in range(1, level+1): - rdiff_backup(1, 1, - "testfiles/increment%s" % (i,), - self.regress_rp1.path, - current_time = 10000*i) - - # Now make regress_output2 - Log("Making %s" % (self.regress_rp2.path,), 4) - assert not os.system("cp -a %s %s" % - (self.regress_rp1.path, self.regress_rp2.path)) - rdiff_backup(1, 1, - "testfiles/increment%s" % (level+1), - self.regress_rp2.path, - current_time = 10000*(level+1)) - self.regress_rp1.setdata() - self.regress_rp2.setdata() - - def test_full(self): + output_rp = rpath.RPath(Globals.local_connection, "testfiles/output") + output_rbdir_rp = output_rp.append_path("rdiff-backup-data") + inc1_rp = rpath.RPath(Globals.local_connection, "testfiles/increment1") + inc2_rp = rpath.RPath(Globals.local_connection, "testfiles/increment2") + inc3_rp = rpath.RPath(Globals.local_connection, "testfiles/increment3") + inc4_rp = rpath.RPath(Globals.local_connection, "testfiles/increment4") + + def runtest(self, regress_function): """Test regressing a full directory to older state Make two directories, one with one more backup in it. Then regress the bigger one, and then make sure they compare the same. - """ - for level in range(1, 4): - self.make_output(level) - regress.regress_time = 10000*level - regress.unsuccessful_backup_time = 10000*(level+1) - regress.time_override_mode = 1 - Globals.rbdir = self.regress_rp2.append_path("rdiff-backup-data") - Log("######### Beginning regress ###########", 5) - regress.Regress(self.regress_rp2) - - assert CompareRecursive(self.regress_rp1, self.regress_rp2, - exclude_rbdir = 0) + Regress_function takes a time and should regress + self.output_rp back to that time. + """ + self.output_rp.setdata() + if self.output_rp.lstat(): Myrm(self.output_rp.path) + + rdiff_backup(1, 1, self.inc1_rp.path, self.output_rp.path, + current_time = 10000) + assert CompareRecursive(self.inc1_rp, self.output_rp) + + rdiff_backup(1, 1, self.inc2_rp.path, self.output_rp.path, + current_time = 20000) + assert CompareRecursive(self.inc2_rp, self.output_rp) + + rdiff_backup(1, 1, self.inc3_rp.path, self.output_rp.path, + current_time = 30000) + assert CompareRecursive(self.inc3_rp, self.output_rp) + + rdiff_backup(1, 1, self.inc4_rp.path, self.output_rp.path, + current_time = 40000) + assert CompareRecursive(self.inc4_rp, self.output_rp) + + Globals.rbdir = self.output_rbdir_rp + + regress_function(30000) + assert CompareRecursive(self.inc3_rp, self.output_rp, + compare_hardlinks = 0) + regress_function(20000) + assert CompareRecursive(self.inc2_rp, self.output_rp, + compare_hardlinks = 0) + regress_function(10000) + assert CompareRecursive(self.inc1_rp, self.output_rp, + compare_hardlinks = 0) + + def regress_to_time_local(self, time): + """Regress self.output_rp to time by running regress locally""" + self.output_rp.setdata() + self.output_rbdir_rp.setdata() + self.add_current_mirror(time) + regress.Regress(self.output_rp) + + def add_current_mirror(self, time): + """Add current_mirror marker at given time""" + cur_mirror_rp = self.output_rbdir_rp.append( + "current_mirror.%s.data" % (Time.timetostring(time),)) + cur_mirror_rp.touch() + + def regress_to_time_remote(self, time): + """Like test_full above, but run regress remotely""" + self.output_rp.setdata() + self.output_rbdir_rp.setdata() + self.add_current_mirror(time) + cmdline = (SourceDir + + "/../rdiff-backup -v3 --check-destination-dir " + "--remote-schema './chdir-wrapper2 %s' " + "test1::../" + self.output_rp.path) + print "Running:", cmdline + assert not os.system(cmdline) + + def test_local(self): + """Run regress test locally""" + self.runtest(self.regress_to_time_local) + + def test_remote(self): + """Run regress test remotely""" + self.runtest(self.regress_to_time_remote) if __name__ == "__main__": unittest.main() |