summaryrefslogtreecommitdiff
path: root/rdiff-backup/testing/finaltest.py
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-08-31 21:03:53 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-08-31 21:03:53 +0000
commit98a31c8656bb61659e1eea4f649d51a214ce806d (patch)
tree0eaefd821a87b34fc5af6f588acdb83bd46c0928 /rdiff-backup/testing/finaltest.py
parent4e1720ac15bc0579b9701231b2e4a3f196bc9b7b (diff)
downloadrdiff-backup-98a31c8656bb61659e1eea4f649d51a214ce806d.tar.gz
Added session number like '3B' to general time specification
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@415 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing/finaltest.py')
-rw-r--r--rdiff-backup/testing/finaltest.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/rdiff-backup/testing/finaltest.py b/rdiff-backup/testing/finaltest.py
index 85f3378..5608220 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
@@ -333,6 +334,8 @@ class FinalMisc(PathSetter):
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 2B',
+ 'testfiles/restoretest3')
def testListChangeSinceRemote(self):
"""Test --list-changed-since mode remotely. Uses restoretest3"""
@@ -364,6 +367,42 @@ class FinalMisc(PathSetter):
self.exec_rb_extra_args(None, "--list-increment-sizes",
"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
+
+ def testRemoveOlderThan2(self):
+ """Test --remove-older-than, but '1B'. 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 1B --force",
+ "testfiles/output")
+ rbdir = rpath.RPath(Globals.local_connection,
+ "testfiles/output/rdiff-backup-data")
+ for inc in self.get_all_increments(rbdir):
+ assert inc.getinctime() >= 30000
+
class FinalSelection(PathSetter):
"""Test selection options"""