summaryrefslogtreecommitdiff
path: root/rdiff-backup/testing
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-06-21 01:29:18 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-06-21 01:29:18 +0000
commit5015e6c7a84243200c00c467d892b1b2105ee9bb (patch)
tree46a6533237dbe77d60c46ac319730b80c0dd7d79 /rdiff-backup/testing
parentf4da6ca2f3034ae3d5cd08062bb5d964f63789af (diff)
downloadrdiff-backup-5015e6c7a84243200c00c467d892b1b2105ee9bb.tar.gz
Fixed quoted hardlinks, added --windows-restore, fixed a couple tests
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@320 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing')
-rw-r--r--rdiff-backup/testing/finaltest.py29
-rw-r--r--rdiff-backup/testing/regressiontest.py23
2 files changed, 48 insertions, 4 deletions
diff --git a/rdiff-backup/testing/finaltest.py b/rdiff-backup/testing/finaltest.py
index 301bb1e..9837437 100644
--- a/rdiff-backup/testing/finaltest.py
+++ b/rdiff-backup/testing/finaltest.py
@@ -37,6 +37,9 @@ class Local:
timbar_in = get_local_rp('increment1/timbar.pyc')
timbar_out = get_local_rp('../timbar.pyc') # in cur directory
+ wininc2 = get_local_rp('win-increment2')
+ wininc3 = get_local_rp('win-increment3')
+
class PathSetter(unittest.TestCase):
def setUp(self):
self.reset_schema()
@@ -239,7 +242,23 @@ class Final(PathSetter):
self.exec_rb(None, '../../../../../../proc', 'testfiles/procoutput')
def testWindowsMode(self):
- """Test backup with the --windows-mode option"""
+ """Test backup with the --windows-mode option
+
+ We need to delete from the increment? directories long file
+ names, because quoting adds too many extra letters.
+
+ """
+ def delete_long(base_rp, length = 100):
+ """Delete filenames longer than length given"""
+ for rp in selection.Select(base_rp).set_iter():
+ if len(rp.dirsplit()[1]) > length: rp.delete()
+
+ if not Local.wininc2.lstat() or not Local.wininc3.lstat():
+ os.system("cp -a testfiles/increment2 testfiles/win-increment2")
+ os.system("cp -a testfiles/increment3 testfiles/win-increment3")
+ delete_long(Local.wininc2)
+ delete_long(Local.wininc3)
+
old_schema = self.rb_schema
self.rb_schema = old_schema + " --windows-mode "
self.set_connections(None, None, None, None)
@@ -247,12 +266,14 @@ class Final(PathSetter):
self.delete_tmpdirs()
# Back up increment2, this contains a file with colons
- self.exec_rb(20000, 'testfiles/increment2', 'testfiles/output')
+ self.exec_rb(20000, 'testfiles/win-increment2', 'testfiles/output')
time.sleep(1)
# Back up increment3
- self.exec_rb(30000, 'testfiles/increment3', 'testfiles/output')
+ self.exec_rb(30000, 'testfiles/win-increment3', 'testfiles/output')
+ # Start restore
+ self.rb_schema = old_schema + ' --windows-restore '
Globals.time_separator = "_"
inc_paths = self.getinc_paths("increments.",
"testfiles/output/rdiff-backup-data", 1)
@@ -260,7 +281,7 @@ class Final(PathSetter):
assert len(inc_paths) == 1, inc_paths
# Restore increment2
self.exec_rb(None, inc_paths[0], 'testfiles/restoretarget2')
- assert CompareRecursive(Local.inc2rp, Local.rpout2,
+ assert CompareRecursive(Local.wininc2, Local.rpout2,
compare_hardlinks = 0)
# Now check to make sure no ":" in output directory
diff --git a/rdiff-backup/testing/regressiontest.py b/rdiff-backup/testing/regressiontest.py
index 90b9d66..b2192c1 100644
--- a/rdiff-backup/testing/regressiontest.py
+++ b/rdiff-backup/testing/regressiontest.py
@@ -158,6 +158,29 @@ class IncrementTest1(unittest.TestCase):
InternalBackup(1, 1, "testfiles/longfilenames1", Local.rpout.path, 100)
InternalBackup(1, 1, "testfiles/longfilenames2", Local.rpout.path, 200)
+ def test_quoted_hardlinks(self):
+ """Test backing up a directory with quoted hardlinks in it"""
+ hldir = rpath.RPath(Globals.local_connection,
+ "testfiles/quoted_hardlinks")
+ if hldir.lstat():
+ Myrm(hldir.path)
+ hldir.setdata()
+ hldir.mkdir()
+ hl1 = hldir.append("HardLink1")
+ hl1.touch()
+ hl2 = hldir.append("HardLink2")
+ hl2.hardlink(hl1.path)
+
+ Myrm(Local.rpout.path)
+ old_settings = (Globals.quoting_enabled, Globals.chars_to_quote,
+ Globals.quoting_char)
+ Globals.quoting_enabled = 1
+ Globals.chars_to_quote = 'A-Z'
+ Globals.quoting_char = ';'
+ InternalBackup(1, 1, hldir.path, Local.rpout.path, current_time = 1)
+ InternalBackup(1, 1, "testfiles/empty", Local.rpout.path,
+ current_time = 10000)
+
def test_long_socket(self):
"""Test backing up a directory with long sockets in them