summaryrefslogtreecommitdiff
path: root/rdiff-backup/testing
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-02-18 08:18:45 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-02-18 08:18:45 +0000
commit716fa96b9cbf2570e381de0abb475d341487c2d6 (patch)
tree5704e34ef06a6750e39522fe051cd1dd7047dde2 /rdiff-backup/testing
parent0ad90ffd146e3ed6c920772c4a9542198d8059bc (diff)
downloadrdiff-backup-716fa96b9cbf2570e381de0abb475d341487c2d6.tar.gz
Various modifications to backup, restore, and regress systems.
This version passes many tests but not all of them. The backup patch system was copied to restore.py. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@281 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing')
-rw-r--r--rdiff-backup/testing/commontest.py9
-rw-r--r--rdiff-backup/testing/regresstest.py70
2 files changed, 73 insertions, 6 deletions
diff --git a/rdiff-backup/testing/commontest.py b/rdiff-backup/testing/commontest.py
index 57aad7b..c527e83 100644
--- a/rdiff-backup/testing/commontest.py
+++ b/rdiff-backup/testing/commontest.py
@@ -5,6 +5,7 @@ from rdiff_backup.rpath import RPath
from rdiff_backup import Globals, Hardlink, SetConnections, Main, \
selection, lazy, Time, rpath
+RBBin = "../rdiff-backup"
SourceDir = "../rdiff_backup"
AbsCurdir = os.getcwd() # Absolute path name of current directory
AbsTFdir = AbsCurdir+"/testfiles"
@@ -56,12 +57,14 @@ def rdiff_backup(source_local, dest_local, src_dir, dest_dir,
dest_dir = ("test2/tmp; ../../%s/rdiff-backup --server::../../%s" %
(SourceDir, dest_dir))
- cmdargs = [SourceDir + "/rdiff-backup", extra_options]
+ cmdargs = [RBBin, extra_options]
if not (source_local and dest_local): cmdargs.append("--remote-schema %s")
if current_time: cmdargs.append("--current-time %s" % current_time)
-
- os.system(" ".join(cmdargs))
+ cmdargs.extend([src_dir, dest_dir])
+ cmdline = " ".join(cmdargs)
+ print "Executing: ", cmdline
+ assert not os.system(cmdline)
def cmd_schemas2rps(schema_list, remote_schema):
"""Input list of file descriptions and the remote schema, return rps
diff --git a/rdiff-backup/testing/regresstest.py b/rdiff-backup/testing/regresstest.py
index 8a24958..cb13765 100644
--- a/rdiff-backup/testing/regresstest.py
+++ b/rdiff-backup/testing/regresstest.py
@@ -1,11 +1,75 @@
-"""regresstest - test the regress module. Not to be confused with the
-regression tests."""
+"""regresstest - test the regress module.
+
+Not to be confused with the regression tests.
+
+"""
import unittest
from commontest import *
+from rdiff_backup import regress
+
+Log.setverbosity(7)
class RegressTest(unittest.TestCase):
- XXX
+ 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):
+ """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)
if __name__ == "__main__": unittest.main()