From 1295c1e4ecb0f9f6a8f59efa0ed51108c0dda5bf Mon Sep 17 00:00:00 2001 From: nejucomo Date: Sun, 20 Jan 2008 17:55:51 -0700 Subject: [PATCH] tahoe_fuse: system test: Launch the fuse interface. --- contrib/fuse/runtests.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/contrib/fuse/runtests.py b/contrib/fuse/runtests.py index 41ec4a34..4a32f095 100644 --- a/contrib/fuse/runtests.py +++ b/contrib/fuse/runtests.py @@ -6,7 +6,7 @@ Note: The API design of the python-fuse library makes unit testing much of tahoe-fuse.py tricky business. ''' -import sys, os, shutil, unittest, subprocess, tempfile, re, time +import sys, os, shutil, unittest, subprocess, tempfile, re, time, signal import tahoe_fuse @@ -48,6 +48,7 @@ class SystemTest (object): self.cliexec = None self.introbase = None self.clientbase = None + self.mountpoint = None ## Top-level flow control: # These "*_layer" methods call eachother in a linear fashion, using @@ -181,8 +182,25 @@ class SystemTest (object): print 'Ignoring cleanup exception: %r' % (e,) def mount_fuse_layer(self): - # XXX not implemented. - pass + print 'Mounting fuse interface.' + self.mountpoint = tempfile.mkdtemp(prefix='tahoe_fuse_mp_') + try: + thispath = os.path.abspath(sys.argv[0]) + thisdir = os.path.dirname(thispath) + fusescript = os.path.join(thisdir, 'tahoe_fuse.py') + try: + proc = subprocess.Popen([fusescript, self.mountpoint, '-f']) + # FIXME: Verify the mount somehow? + # FIXME: Now do tests! + finally: + if proc.poll() is None: + print 'Killing fuse interface.' + os.kill(proc.pid, signal.SIGTERM) + print 'Waiting for the fuse interface to exit.' + proc.wait() + finally: + self.cleanup_dir(self.mountpoint) + # Utilities: -- 2.45.2