From a679c7ea455a250ede89879cff91a4cc169489a4 Mon Sep 17 00:00:00 2001 From: bescoto Date: Wed, 24 Sep 2003 19:45:57 +0000 Subject: Added most of FinalMisc set from 0.13.x git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r0-12@448 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/testing/finaltest.py | 71 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/rdiff-backup/testing/finaltest.py b/rdiff-backup/testing/finaltest.py index a20a2f0..2c6c13a 100644 --- a/rdiff-backup/testing/finaltest.py +++ b/rdiff-backup/testing/finaltest.py @@ -1,3 +1,4 @@ +from __future__ import generators import unittest, os, re, sys, time from commontest import * from rdiff_backup import Globals, log, rpath, robust, FilenameMapping @@ -456,5 +457,75 @@ class FinalCorrupt(PathSetter): self.exec_rb_restore(10000, 'testfiles/output', 'testfiles/restoretarget1') + +class FinalMisc(PathSetter): + """Test miscellaneous operations like list-increments, etc. + + Many of these just run and make sure there were no errors; they + don't verify the output. + + """ + def testListIncrementsLocal(self): + """Test --list-increments switch. Assumes restoretest3 valid rd dir""" + self.set_connections(None, None, None, None) + self.exec_rb_extra_args(None, "--list-increments", + "testfiles/restoretest3") + + def testListIncrementsRemote(self): + """Test --list-increments mode remotely. Uses restoretest3""" + self.set_connections('test1', '../', None, None) + self.exec_rb_extra_args(None, "--list-increments", + "testfiles/restoretest3") + + def testListChangeSinceLocal(self): + """Test --list-changed-since mode locally. Uses restoretest3""" + self.set_connections(None, None, None, None) + self.exec_rb_extra_args(None, '--list-changed-since 10000', + 'testfiles/restoretest3') + self.exec_rb_extra_args(None, '--list-changed-since 2D', + 'testfiles/restoretest3') + + def testListChangeSinceRemote(self): + """Test --list-changed-since mode remotely. Uses restoretest3""" + self.set_connections('test1', '../', None, None) + self.exec_rb_extra_args(None, '--list-changed-since 10000', + 'testfiles/restoretest3') + + def testListAtTimeLocal(self): + """Test --list-at-time mode locally. Uses restoretest3""" + self.set_connections(None, None, None, None) + self.exec_rb_extra_args(None, '--list-at-time 20000', + 'testfiles/restoretest3') + + def testListAtTimeRemote(self): + """Test --list-at-time mode locally. Uses restoretest3""" + self.set_connections('test1', '../', None, None) + self.exec_rb_extra_args(None, '--list-at-time 20000', + 'testfiles/restoretest3') + + def get_all_increments(self, rp): + """Iterate all increments at or below given directory""" + assert rp.isdir() + dirlist = rp.listdir() + dirlist.sort() + for filename in dirlist: + subrp = rp.append(filename) + if subrp.isincfile(): yield subrp + elif subrp.isdir(): + for subsubrp in self.get_all_increments(subrp): + yield subsubrp + + def testRemoveOlderThan(self): + """Test --remove-older-than. Uses restoretest3""" + Myrm("testfiles/output") + assert not os.system("cp -a testfiles/restoretest3 testfiles/output") + self.set_connections(None, None, None, None) + self.exec_rb_extra_args(None, "--remove-older-than 20000", + "testfiles/output") + rbdir = rpath.RPath(Globals.local_connection, + "testfiles/output/rdiff-backup-data") + for inc in self.get_all_increments(rbdir): + assert inc.getinctime() >= 20000 + if __name__ == "__main__": unittest.main() -- cgit v1.2.1