]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
tahoe_fuse: system test: Launch the fuse interface.
authornejucomo <nejucomo@gmail.com>
Mon, 21 Jan 2008 00:55:51 +0000 (17:55 -0700)
committernejucomo <nejucomo@gmail.com>
Mon, 21 Jan 2008 00:55:51 +0000 (17:55 -0700)
contrib/fuse/runtests.py

index 41ec4a34d175bad7c3784e438a7b5603db5f4345..4a32f095a5f25ba566ee3014c3aeea324c6e6e67 100644 (file)
@@ -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: