tahoe_fuse: cmdline args & system test: Allow nonstandard client basedirs to be specified and update the system tests to use this feature...

The commandline option handling of the version of python-fuse I use is arcane.  This is an ugly hack.
This commit is contained in:
nejucomo 2008-01-20 20:56:27 -07:00
parent 57da456dc9
commit de022b2115
2 changed files with 20 additions and 8 deletions

View File

@ -229,17 +229,19 @@ class SystemTest (object):
self.mount_fuse_layer() self.mount_fuse_layer()
def mount_fuse_layer(self): def mount_fuse_layer(self):
# FIXME - tahoe_fuse.py: This probably currently fails because
# tahoe_fuse looks in ~/.tahoe.
print 'Mounting fuse interface.' print 'Mounting fuse interface.'
client = self.get_interface_client()
self.mountpoint = tempfile.mkdtemp(prefix='tahoe_fuse_mp_') self.mountpoint = tempfile.mkdtemp(prefix='tahoe_fuse_mp_')
try: try:
thispath = os.path.abspath(sys.argv[0]) thispath = os.path.abspath(sys.argv[0])
thisdir = os.path.dirname(thispath) thisdir = os.path.dirname(thispath)
fusescript = os.path.join(thisdir, 'tahoe_fuse.py') fusescript = os.path.join(thisdir, 'tahoe_fuse.py')
try: try:
proc = subprocess.Popen([fusescript, self.mountpoint, '-f']) proc = subprocess.Popen([fusescript,
self.mountpoint,
'-f',
'--basedir', client.base])
# FIXME: Verify the mount somehow? # FIXME: Verify the mount somehow?
self.run_test_layer() self.run_test_layer()

View File

@ -68,10 +68,20 @@ MagicDevNumber = 42
UnknownSize = -1 UnknownSize = -1
def main(args = sys.argv[1:]): def main():
if not args: basedir = os.path.expanduser(TahoeConfigDir)
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)) 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() fs.main()