mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-07 10:56:49 +00:00
fuse/runtests: added a --web-open option
similar to the --debug-wait option which causes the test harness to pause at various stages of the process to facilitate debugging, this option simplifies that debugging by automatically opening a web browser to the root dir of that implementation's tests when tests are commenced. in addition, if --web-open is specfied but --debug-wait is not, the harness will still pause after running tests but before tearing down the tahoe grid - this allows all tests to run to completion, but provide a debugging hook to investigate the end state of the grid's contents thereafter.
This commit is contained in:
parent
236c52bf8b
commit
8b9a267920
@ -24,7 +24,7 @@ Unit and system tests for tahoe-fuse.
|
||||
# using the grid fs).
|
||||
|
||||
import sys, os, shutil, unittest, subprocess
|
||||
import tempfile, re, time, random, httplib
|
||||
import tempfile, re, time, random, httplib, urllib
|
||||
|
||||
from twisted.python import usage
|
||||
|
||||
@ -95,6 +95,8 @@ class FuseTestsOptions(usage.Options):
|
||||
optFlags = [
|
||||
["debug-wait", None,
|
||||
"Causes the test system to pause at various points, to facilitate debugging"],
|
||||
["web-open", None,
|
||||
"Opens a web browser to the web ui at the start of each impl's tests"],
|
||||
]
|
||||
|
||||
def postOptions(self):
|
||||
@ -181,11 +183,19 @@ class SystemTest (object):
|
||||
print sfail
|
||||
print '\n*** System Tests were not successfully completed.'
|
||||
|
||||
def maybe_wait(self, msg='waiting'):
|
||||
if self.config['debug-wait']:
|
||||
def maybe_wait(self, msg='waiting', or_if_webopen=False):
|
||||
if self.config['debug-wait'] or or_if_webopen and self.config['web-open']:
|
||||
print msg
|
||||
raw_input()
|
||||
|
||||
def maybe_webopen(self, where=None):
|
||||
if self.config['web-open']:
|
||||
import webbrowser
|
||||
url = self.weburl
|
||||
if where is not None:
|
||||
url += urllib.quote(where)
|
||||
webbrowser.open(url)
|
||||
|
||||
def init_cli_layer(self):
|
||||
'''This layer finds the appropriate tahoe executable.'''
|
||||
#self.cliexec = os.path.join('.', 'bin', 'tahoe')
|
||||
@ -243,7 +253,7 @@ class SystemTest (object):
|
||||
if clientnum >= self.TotalClientsNeeded:
|
||||
self.maybe_wait('waiting (launched clients)')
|
||||
ret = self.create_test_dirnode_layer()
|
||||
self.maybe_wait('waiting (ran tests)')
|
||||
self.maybe_wait('waiting (ran tests)', or_if_webopen=True)
|
||||
return ret
|
||||
|
||||
tmpl = 'Launching client %d of %d.'
|
||||
@ -264,7 +274,8 @@ class SystemTest (object):
|
||||
f = open(webportpath, 'w')
|
||||
f.write('tcp:%d:interface=127.0.0.1\n' % self.port)
|
||||
f.close()
|
||||
print "http://127.0.0.1:%d/" % (self.port,)
|
||||
self.weburl = "http://127.0.0.1:%d/" % (self.port,)
|
||||
print self.weburl
|
||||
else:
|
||||
os.remove(webportpath)
|
||||
|
||||
@ -324,6 +335,7 @@ class SystemTest (object):
|
||||
return results
|
||||
|
||||
def run_test_layer(self, root_uri, iman):
|
||||
self.maybe_webopen('uri/'+root_uri)
|
||||
failures = 0
|
||||
testnum = 0
|
||||
numtests = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user