From: nejucomo Date: Sun, 1 Jun 2008 03:16:05 +0000 (-0700) Subject: fuse_a: runtests.py: The current ubuntu python-fuse ignores the -f option and always... X-Git-Tag: allmydata-tahoe-1.1.0~60 X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/%22doc.html/running.html?a=commitdiff_plain;h=7ea7fd751ee8f9cbcbb780f41cb3271b01c29d23;p=tahoe-lafs%2Ftahoe-lafs.git fuse_a: runtests.py: The current ubuntu python-fuse ignores the -f option and always forks, so this updates runtests to use fusermount for clean shutdown. --- diff --git a/contrib/fuse_a/runtests.py b/contrib/fuse_a/runtests.py index 40c5a7d9..a2548a60 100644 --- a/contrib/fuse_a/runtests.py +++ b/contrib/fuse_a/runtests.py @@ -207,7 +207,7 @@ class SystemTest (object): return self.mount_fuse_layer(cap) - def mount_fuse_layer(self, fusebasecap, fusepause=2.0): + def mount_fuse_layer(self, fusebasecap): print 'Mounting fuse interface.' mp = os.path.join(self.testroot, 'mountpoint') @@ -216,29 +216,38 @@ class SystemTest (object): thispath = os.path.abspath(sys.argv[0]) thisdir = os.path.dirname(thispath) fusescript = os.path.join(thisdir, 'tahoe_fuse.py') - proc = None - try: - proc = subprocess.Popen(['python', - fusescript, - mp, - '-f', - '--basedir', self.clientbase]) - # The mount is verified by the test_layer, but we sleep to - # avoid race conditions against the first few tests. - time.sleep(fusepause) + # Even though --help says -f means "foreground operation", + # my version (ubuntu's python-fuse 1:0.2-pre3-3) still forks to + # the background... So now we run tahoe_fuse.py and wait for + # the parent process to return. We use fusermount -u to kill + # the forked daemon and unmount the test directory. + + exitcode, output = gather_output(['python', + fusescript, + mp, + '--basedir', self.clientbase]) + + if exitcode != 0 or output: + tmpl = 'tahoe_fuse.py failed to launch:\n' + tmpl += 'Exit Status: %r\n' + tmpl += 'Output:\n%s\n' + raise self.SetupFailure(tmpl, exitcode, output) + try: return self.run_test_layer(fusebasecap, mp) finally: - print '\n*** Cleaning up system test' + print '\n*** Cleaning fuse mount and daemon process' + args = ['fusermount', '-u', mp] + ec, out = gather_output(args) + if exitcode != 0 or output: + tmpl = 'fusermount failed to unmount tahoe_fuse.py:\n' + tmpl += 'Arguments: %r\n' + tmpl += 'Exit Status: %r\n' + tmpl += 'Output:\n%s\n' + raise self.SetupFailure(tmpl, args, ec, out) - if proc is not None and proc.poll() is None: - print 'Killing fuse interface.' - os.kill(proc.pid, signal.SIGTERM) - print 'Waiting for the fuse interface to exit.' - proc.wait() - def run_test_layer(self, fbcap, mountpoint): total = failures = 0 for name in sorted(dir(self)):