Bug 1161702 - Add --startup-timeout arg for Marionette; add in-tree config for luciddream, r=ahal

This commit is contained in:
Jonathan Griffin 2015-07-07 12:26:54 -07:00
parent 87a000a955
commit c09d5ad15d
4 changed files with 39 additions and 7 deletions

View File

@ -23,6 +23,25 @@ config = {
"run_filename": "jit_test.py",
"testsdir": "jit-test/jit-test"
},
"luciddream-emulator": {
"options": [
"--startup-timeout=300",
"--log-raw=%(raw_log_file)s",
"--browser-path=%(browser_path)s",
"--b2gpath=%(emulator_path)s",
"%(test_manifest)s"
],
},
"luciddream-b2gdt": {
"options": [
"--startup-timeout=300",
"--log-raw=%(raw_log_file)s",
"--browser-path=%(browser_path)s",
"--b2g-desktop-path=%(fxos_desktop_path)s",
"--gaia-profile=%(gaia_profile)s",
"%(test_manifest)s"
],
},
"mochitest": {
"options": [
"--appname=%(binary_path)s",

View File

@ -55,6 +55,9 @@ def parse_args(in_args):
help='path to Firefox binary')
parser.add_argument('--gaia-profile', dest='gaia_profile', action='store',
help='path to Gaia profile')
parser.add_argument('--startup-timeout', dest='startup_timeout', action='store',
default=60, type=int,
help='max time to wait for Marionette to be available after launching binary')
parser.add_argument('manifest', metavar='MANIFEST', action='store',
help='path to manifest of tests to run')
structured.commandline.add_logging_group(parser)
@ -76,7 +79,7 @@ class LucidDreamTestRunner(BaseMarionetteTestRunner):
self.test_handlers = [LucidDreamTestCase]
def start_browser(browser_path, app_args):
def start_browser(browser_path, app_args, startup_timeout):
'''
Start a Firefox browser and return a Marionette instance that
can talk to it.
@ -87,7 +90,8 @@ def start_browser(browser_path, app_args):
# on each others' toes.
port=2929,
app_args=app_args,
gecko_log="firefox.log"
gecko_log="firefox.log",
startup_timeout=startup_timeout
)
runner = marionette.runner
if runner:
@ -100,14 +104,16 @@ def start_browser(browser_path, app_args):
#TODO: make marionette/client/marionette/runtests.py importable so we can
# just use cli from there. A lot of this is copy/paste from that function.
def run(browser_path=None, b2g_desktop_path=None, emulator_path=None, emulator_arch=None, gaia_profile=None, manifest=None, browser_args=None, **kwargs):
def run(browser_path=None, b2g_desktop_path=None, emulator_path=None,
emulator_arch=None, gaia_profile=None, manifest=None, browser_args=None,
**kwargs):
# It's sort of debatable here whether the marionette instance managed
# by the test runner should be the browser or the emulator. Right now
# it's the emulator because it feels like there's more fiddly setup around
# that, but longer-term if we want to run tests against different
# (non-B2G) targets this won't match up very well, so maybe it ought to
# be the browser?
browser = start_browser(browser_path, browser_args)
browser = start_browser(browser_path, browser_args, kwargs['startup_timeout'])
kwargs["browser"] = browser
if not "logger" in kwargs:

View File

@ -360,6 +360,11 @@ class BaseMarionetteOptions(OptionParser):
dest='timeout',
type=int,
help='if a --timeout value is given, it will set the default page load timeout, search timeout and script timeout to the given value. If not passed in, it will use the default values of 30000ms for page load, 0ms for search timeout and 10000ms for script timeout')
self.add_option('--startup-timeout',
dest='startup_timeout',
type=int,
default=60,
help='the max number of seconds to wait for a Marionette connection after launching a binary')
self.add_option('--shuffle',
action='store_true',
dest='shuffle',
@ -506,7 +511,7 @@ class BaseMarionetteTestRunner(object):
server_root=None, gecko_log=None, result_callbacks=None,
adb_host=None, adb_port=None, prefs=None, test_tags=None,
socket_timeout=BaseMarionetteOptions.socket_timeout_default,
**kwargs):
startup_timeout=None, **kwargs):
self.address = address
self.emulator = emulator
self.emulator_binary = emulator_binary
@ -551,6 +556,7 @@ class BaseMarionetteTestRunner(object):
self._adb_port = adb_port
self.prefs = prefs or {}
self.test_tags = test_tags
self.startup_timeout = startup_timeout
def gather_debug(test, status):
rv = {}
@ -650,6 +656,7 @@ class BaseMarionetteTestRunner(object):
'adb_host': self._adb_host,
'adb_port': self._adb_port,
'prefs': self.prefs,
'startup_timeout': self.startup_timeout,
}
if self.bin:
kwargs.update({

View File

@ -550,7 +550,7 @@ class Marionette(object):
gecko_log=None, homedir=None, baseurl=None, no_window=False, logdir=None,
busybox=None, symbols_path=None, timeout=None, socket_timeout=360,
device_serial=None, adb_path=None, process_args=None,
adb_host=None, adb_port=None, prefs=None):
adb_host=None, adb_port=None, prefs=None, startup_timeout=60):
self.host = host
self.port = self.local_port = port
self.bin = bin
@ -599,7 +599,7 @@ class Marionette(object):
app_args=app_args, symbols_path=symbols_path,
gecko_log=gecko_log, prefs=prefs)
self.instance.start()
assert(self.wait_for_port()), "Timed out waiting for port!"
assert(self.wait_for_port(timeout=startup_timeout)), "Timed out waiting for port!"
if emulator:
self.runner = B2GEmulatorRunner(b2g_home=homedir,