Commit 13af218c authored by bescoto's avatar bescoto

Added most of FinalMisc set from 0.13.x


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@448 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent c79d2ad5
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()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment