From: nejucomo Date: Wed, 30 Jan 2008 09:57:54 +0000 (-0700) Subject: tahoe_fuse: system test: Create a separate directory for each test and pass the cap... X-Git-Tag: allmydata-tahoe-0.8.0~163 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri//%22%22?a=commitdiff_plain;h=7240021d1c47d58c88309e79beb23c013b2d51a4;p=tahoe-lafs%2Ftahoe-lafs.git tahoe_fuse: system test: Create a separate directory for each test and pass the cap and local path to each test. Add two basic sanity tests for empty directories. --- diff --git a/contrib/fuse/runtests.py b/contrib/fuse/runtests.py index 22bd8120..35b8ca00 100644 --- a/contrib/fuse/runtests.py +++ b/contrib/fuse/runtests.py @@ -199,7 +199,7 @@ class SystemTest (object): return self.mount_fuse_layer(cap) - def mount_fuse_layer(self): + def mount_fuse_layer(self, fusebasecap, fusepause=2.0): print 'Mounting fuse interface.' mp = os.path.join(self.testroot, 'mountpoint') @@ -229,15 +229,18 @@ class SystemTest (object): print 'Waiting for the fuse interface to exit.' proc.wait() - def run_test_layer(self, mountpoint): + def run_test_layer(self, fbcap, mountpoint): total = failures = 0 for name in sorted(dir(self)): if name.startswith('test_'): total += 1 print '\n*** Running test #%d: %s' % (total, name) try: + testcap = self.create_dirnode() + self.attach_node(fbcap, testcap, name) + method = getattr(self, name) - method(mountpoint) + method(testcap, testdir = os.path.join(mountpoint, name)) print 'Test succeeded.' except self.TestFailure, f: print f @@ -250,8 +253,12 @@ class SystemTest (object): # Tests: - def test_00_empty_directory_listing(self, mountpoint): - listing = os.listdir(mountpoint) + def test_directory_existence(self, testcap, testdir): + if not os.path.isdir(testdir): + raise self.TestFailure('Attached test directory not found: %r', testdir) + + def test_empty_directory_listing(self, testcap, testdir): + listing = os.listdir(testdir) if listing: raise self.TestFailure('Expected empty directory, found: %r' % (listing,))