]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
tahoe_fuse: cmdline args & system test: Allow nonstandard client basedirs to be speci...
authornejucomo <nejucomo@gmail.com>
Mon, 21 Jan 2008 03:56:27 +0000 (20:56 -0700)
committernejucomo <nejucomo@gmail.com>
Mon, 21 Jan 2008 03:56:27 +0000 (20:56 -0700)
The commandline option handling of the version of python-fuse I use is arcane.  This is an ugly hack.

contrib/fuse/runtests.py
contrib/fuse/tahoe_fuse.py

index 275ad4aa54c6f2cea95f862cca08af4287d8ace6..e6d51468aa916276ab58aa1b45d33e0bbc247566 100644 (file)
@@ -229,17 +229,19 @@ class SystemTest (object):
         self.mount_fuse_layer()
         
     def mount_fuse_layer(self):
-        # FIXME - tahoe_fuse.py: This probably currently fails because
-        # tahoe_fuse looks in ~/.tahoe.
-        
         print 'Mounting fuse interface.'
+        client = self.get_interface_client()
+
         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'])
+                proc = subprocess.Popen([fusescript,
+                                         self.mountpoint,
+                                         '-f',
+                                         '--basedir', client.base])
                 # FIXME: Verify the mount somehow?
 
                 self.run_test_layer()
index d00806f29beb3228761c2273ce1d4943dbe3b463..f9485642b65b88ff8accd493bd10fa5566f09b20 100644 (file)
@@ -68,10 +68,20 @@ MagicDevNumber = 42
 UnknownSize = -1
 
 
-def main(args = sys.argv[1:]):
-    if not args:
-        raise SystemExit("Usage: %s MOUNTPOINT\n\nThe argument MOUNTPOINT is an empty directory where you want to mount a tahoe filesystem.\n" % (sys.argv[0],))
-    fs = TahoeFS(os.path.expanduser(TahoeConfigDir))
+def main():
+    basedir = os.path.expanduser(TahoeConfigDir)
+
+    for i, arg in enumerate(sys.argv):
+        if arg == '--basedir':
+            try:
+                basedir = sys.argv[i+1]
+                sys.argv[i:i+2] = []
+            except IndexError:
+                sys.argv = [sys.argv[0], '--help']
+                
+    print 'DEBUG:', sys.argv
+            
+    fs = TahoeFS(basedir)
     fs.main()