diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-03-17 21:46:53 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-03-17 21:46:53 +0000 |
commit | 6609b22da1f299c08dbb6dd43362bf398ef53a29 (patch) | |
tree | a9e2113f4a1a73342214b7eceeccc0b2b549232e | |
parent | 34d44ccb4e5d36b89daea5553c3770af7e28d677 (diff) | |
download | obnam-6609b22da1f299c08dbb6dd43362bf398ef53a29.tar.gz |
Add --crash-limit option
-rw-r--r-- | obnamlib/app.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/obnamlib/app.py b/obnamlib/app.py index 4bfded83..d428c612 100644 --- a/obnamlib/app.py +++ b/obnamlib/app.py @@ -91,6 +91,14 @@ class App(cliapp.Application): metavar='TIMEOUT', default=60) + self.settings.integer(['crash-limit'], + 'artificially crash the program after COUNTER ' + 'files written to the repository; this is ' + 'useful for crash testing the application, ' + 'and should not be enabled for real use; ' + 'set to 0 to disable (disabled by default)', + metavar='COUNTER') + # The following needs to be done here, because it needs # to be done before option processing. This is a bit ugly, # but the best we can do with the current cliapp structure. @@ -165,6 +173,8 @@ class App(cliapp.Application): logging.debug('opening repository (create=%s)' % create) repopath = self.settings['repository'] repofs = self.fsf.new(repopath, create=create) + if self.settings['crash-after'] > 0: + repofs.crash_limit = self.settings['crash-limit'] repofs.connect() return obnamlib.Repository(repofs, self.settings['node-size'], |