summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-08-25 17:06:56 +0100
committerLars Wirzenius <liw@liw.fi>2011-08-25 17:06:56 +0100
commitdd4b21565c9491bc2ac53e549292aad25fcded67 (patch)
tree7f9e8627088dc794eeb3f4d267ea0cea7d937551
parent7d4279343b9aeee28bd56041c28a8be5bbb66c91 (diff)
parent1db2f64f5b93ca0f5c31228fa28d6c3dece4070c (diff)
downloadseivot-dd4b21565c9491bc2ac53e549292aad25fcded67.tar.gz
Add --verify option.
-rw-r--r--NEWS4
-rw-r--r--debian/changelog7
-rw-r--r--debian/control1
-rwxr-xr-xseivot29
4 files changed, 41 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index a864ba1..673bd7b 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,10 @@ NEWS for seivot, a backup benchmarking program
Version 1.13, released UNRELEASED
---------------------------------
+* `seivot` can now optionally verify that data is restored correctly:
+ see the `--verify` option. This is slow-ish, so it's not enabled
+ by default. You need the `summain` program installed for this
+ feature.
* `seivots-summary` now has a manual page.
Version 1.12, released 2011-08-24
diff --git a/debian/changelog b/debian/changelog
index 768bd16..fdf563c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+seivot (1.13-1) unstable; urgency=low
+
+ * New upstream release.
+ * Suggest summain, for the --verify option.
+
+ -- Lars Wirzenius <liw@liw.fi> Thu, 25 Aug 2011 17:05:48 +0100
+
seivot (1.12-1) unstable; urgency=low
* New upstream release.
diff --git a/debian/control b/debian/control
index 2da51cb..35306a2 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,7 @@ Package: seivot
Architecture: all
Depends: ${shlibs:Depends}, ${python:Depends}, ${misc:Depends},
python-cliapp (>= 0.15)
+Suggests: summain
Description: benchmark program for backup software
seivot generates synthetic test data and backs it up using the
desired backup tool. It then modifies the test data, and makes
diff --git a/seivot b/seivot
index 75c151d..14a7ca8 100755
--- a/seivot
+++ b/seivot
@@ -370,6 +370,8 @@ class Seivot(cliapp.Application):
'access backup repository over the '
'network via sftp')
+ self.settings.boolean(['verify'], 'verifyt restored data')
+
def process_args(self, args):
progname = self.settings['program']
logging.info('Benchmarking: %s' % progname)
@@ -406,11 +408,15 @@ class Seivot(cliapp.Application):
else:
amount = self.settings['initial-data']
self.generate_live_data(self.live_data, amount)
+ if self.settings['verify']:
+ self.summain(self.live_data, 'backup-0.summain')
self.measure(prog.backup, 0, amount)
for i in range(1, generations):
self.generate_live_data(self.live_data,
self.settings['incremental-data'])
+ if self.settings['verify']:
+ self.summain(self.live_data, 'backup-%d.summain' % i)
self.measure(prog.backup, i, self.settings['incremental-data'])
for i in range(generations):
@@ -420,6 +426,7 @@ class Seivot(cliapp.Application):
target_dir = os.path.join(self.tempdir, 'restored')
os.mkdir(target_dir)
self.measure(prog.restore, i, 0, target_dir=target_dir)
+ self.verify(target_dir, i)
shutil.rmtree(target_dir)
for i in range(generations):
@@ -436,6 +443,28 @@ class Seivot(cliapp.Application):
runcmd(['genbackupdata', where, '--create', str(size),
'--file-size', str(self.settings['file-size'])])
+ def summain(self, dirname, basename):
+ '''Remember state of dirname at this time.
+
+ This runs the summain(1) utility against dirname and stores
+ the result in a file called basename in the temporary directory.
+
+ '''
+
+ # We exclude mtime from summain output, because there are very
+ # small time differences that I choose to ignore at this time.
+ self.runcmd(['summain', '--relative', '--exclude=mtime', '--output',
+ os.path.join(self.tempdir, basename), dirname])
+
+ def verify(self, dirname, generation):
+ '''Verify that the generation was restored correctly.'''
+
+ root = os.path.join(dirname, './' + self.live_data)
+ self.summain(root, 'restored-%d.summain' % generation)
+ orig = os.path.join(self.tempdir, 'backup-%d.summain' % generation)
+ rest = os.path.join(self.tempdir, 'restored-%d.summain' % generation)
+ self.runcmd(['diff', '-u', orig, rest])
+
def file_sizes(self, dirname):
bytes = 0
for dirname, subdirs, basenames in os.walk(dirname):