summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-03-23 21:31:47 +0000
committerLars Wirzenius <liw@liw.fi>2012-03-23 21:31:47 +0000
commit24583169d9c973bde1190820f782e7b0ae12691c (patch)
treee00d3a386d1606273b65d51d7a7be875dfb8aa2b
parentf7d2e4731db1a4558567d607414f8145ac98e4f3 (diff)
downloadobnam-24583169d9c973bde1190820f782e7b0ae12691c.tar.gz
Add more crash points
-rw-r--r--obnamlib/vfs_local.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/obnamlib/vfs_local.py b/obnamlib/vfs_local.py
index c7225fac..7b191174 100644
--- a/obnamlib/vfs_local.py
+++ b/obnamlib/vfs_local.py
@@ -59,7 +59,6 @@ class LocalFS(obnamlib.VirtualFileSystem):
# For testing purposes, allow setting a limit on write operations
# after which an exception gets raised. If set to None, no crash.
- # The write_file and overwrite_file methods obey this.
self.crash_limit = None
self.crash_counter = 0
@@ -121,10 +120,12 @@ class LocalFS(obnamlib.VirtualFileSystem):
def remove(self, pathname):
tracing.trace('remove %s', pathname)
os.remove(self.join(pathname))
+ self.maybe_crash()
def rename(self, old, new):
tracing.trace('rename %s %s', old, new)
os.rename(self.join(old), self.join(new))
+ self.maybe_crash()
def lstat(self, pathname):
(ret, dev, ino, mode, nlink, uid, gid, rdev, size, blksize, blocks,
@@ -198,6 +199,7 @@ class LocalFS(obnamlib.VirtualFileSystem):
tracing.trace('existing=%s', existing)
tracing.trace('new=%s', new)
os.link(self.join(existing), self.join(new))
+ self.maybe_crash()
def readlink(self, pathname):
return os.readlink(self.join(pathname))
@@ -206,6 +208,7 @@ class LocalFS(obnamlib.VirtualFileSystem):
tracing.trace('existing=%s', existing)
tracing.trace('new=%s', new)
os.symlink(existing, self.join(new))
+ self.maybe_crash()
def open(self, pathname, mode):
tracing.trace('pathname=%s', pathname)
@@ -236,14 +239,17 @@ class LocalFS(obnamlib.VirtualFileSystem):
def mkdir(self, pathname):
tracing.trace('mkdir %s', pathname)
os.mkdir(self.join(pathname))
+ self.maybe_crash()
def makedirs(self, pathname):
tracing.trace('makedirs %s', pathname)
os.makedirs(self.join(pathname))
+ self.maybe_crash()
def rmdir(self, pathname):
tracing.trace('rmdir %s', pathname)
os.rmdir(self.join(pathname))
+ self.maybe_crash()
def cat(self, pathname):
pathname = self.join(pathname)