Bug 1379906 - Assertion and crash during startup when running Marionette tests. r?gps
Set MOZ_DEVELOPER_SRC_DIR and MOZ_DEVELOPER_OBJ_DIR environment variables when launching the browser.
MozReview-Commit-ID: 5C4W9qYSmM7
--- a/testing/firefox-ui/mach_commands.py
+++ b/testing/firefox-ui/mach_commands.py
@@ -29,17 +29,17 @@ def setup_argument_parser_functional():
def setup_argument_parser_update():
from firefox_ui_harness.arguments.update import UpdateArguments
from mozlog.structured import commandline
parser = UpdateArguments()
commandline.add_logging_group(parser)
return parser
-def run_firefox_ui_test(testtype=None, topsrcdir=None, **kwargs):
+def run_firefox_ui_test(testtype=None, topsrcdir=None, topobjdir=None, **kwargs):
from mozlog.structured import commandline
from argparse import Namespace
import firefox_ui_harness
if testtype == 'functional':
parser = setup_argument_parser_functional()
else:
parser = setup_argument_parser_update()
@@ -75,16 +75,19 @@ def run_firefox_ui_test(testtype=None, t
elif not kwargs.get('tests'):
# If no tests have been selected, set default ones
kwargs['tests'] = [os.path.join(fxui_dir, 'tests', test)
for test in test_types[testtype]['default_tests']]
kwargs['logger'] = commandline.setup_logging('Firefox UI - {} Tests'.format(testtype),
{"mach": sys.stdout})
+ kwargs['topsrcdir'] = topsrcdir
+ kwargs['topobjdir'] = topobjdir
+
args = Namespace()
for k, v in kwargs.iteritems():
setattr(args, k, v)
parser.verify_usage(args)
failed = test_types[testtype]['cli_module'].cli(args=vars(args))
@@ -102,19 +105,21 @@ class MachCommands(MachCommandBase):
@Command('firefox-ui-functional', category='testing',
conditions=[conditions.is_firefox],
description='Run the functional test suite of Firefox UI tests.',
parser=setup_argument_parser_functional,
)
def run_firefox_ui_functional(self, **kwargs):
kwargs['binary'] = kwargs['binary'] or self.get_binary_path('app')
return run_firefox_ui_test(testtype='functional',
- topsrcdir=self.topsrcdir, **kwargs)
+ topsrcdir=self.topsrcdir,
+ topobjdir=self.topobjdir, **kwargs)
@Command('firefox-ui-update', category='testing',
conditions=[conditions.is_firefox],
description='Run the update test suite of Firefox UI tests.',
parser=setup_argument_parser_update,
)
def run_firefox_ui_update(self, **kwargs):
kwargs['binary'] = kwargs['binary'] or self.get_binary_path('app')
return run_firefox_ui_test(testtype='update',
- topsrcdir=self.topsrcdir, **kwargs)
+ topsrcdir=self.topsrcdir,
+ topobjdir=self.topobjdir, **kwargs)
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -109,17 +109,18 @@ class GeckoInstance(object):
"toolkit.telemetry.server": "https://%(server)s/dummy/telemetry/",
# Enabling the support for File object creation in the content process.
"dom.file.createInChild": True,
}
def __init__(self, host=None, port=None, bin=None, profile=None, addons=None,
app_args=None, symbols_path=None, gecko_log=None, prefs=None,
- workspace=None, verbose=0, headless=False):
+ workspace=None, verbose=0, headless=False, topsrcdir=None,
+ topobjdir=None):
self.runner_class = Runner
self.app_args = app_args or []
self.runner = None
self.symbols_path = symbols_path
self.binary = bin
self.marionette_host = host
self.marionette_port = port
@@ -136,16 +137,18 @@ class GeckoInstance(object):
self.required_prefs = deepcopy(self.required_prefs)
if prefs:
self.required_prefs.update(prefs)
self._gecko_log_option = gecko_log
self._gecko_log = None
self.verbose = verbose
self.headless = headless
+ self.topsrcdir = topsrcdir
+ self.topobjdir = topobjdir
@property
def gecko_log(self):
if self._gecko_log:
return self._gecko_log
path = self._gecko_log_option
if path != "-":
@@ -230,16 +233,21 @@ class GeckoInstance(object):
process_args["logfile"] = self.gecko_log
env = os.environ.copy()
if self.headless:
env["MOZ_HEADLESS"] = "1"
env["DISPLAY"] = "77" # Set a fake display.
+ if self.topsrcdir is not None:
+ env["MOZ_DEVELOPER_REPO_DIR"] = self.topsrcdir
+ if self.topobjdir is not None:
+ env["MOZ_DEVELOPER_OBJ_DIR"] = self.topobjdir
+
# environment variables needed for crashreporting
# https://developer.mozilla.org/docs/Environment_variables_affecting_crash_reporting
env.update({"MOZ_CRASHREPORTER": "1",
"MOZ_CRASHREPORTER_NO_REPORT": "1",
"MOZ_CRASHREPORTER_SHUTDOWN": "1",
})
return {
--- a/testing/marionette/harness/marionette_harness/runner/base.py
+++ b/testing/marionette/harness/marionette_harness/runner/base.py
@@ -514,17 +514,18 @@ class BaseMarionetteTestRunner(object):
testvars=None,
symbols_path=None,
shuffle=False, shuffle_seed=random.randint(0, sys.maxint), this_chunk=1,
total_chunks=1,
server_root=None, gecko_log=None, result_callbacks=None,
prefs=None, test_tags=None,
socket_timeout=BaseMarionetteArguments.socket_timeout_default,
startup_timeout=None, addons=None, workspace=None,
- verbose=0, e10s=True, emulator=False, headless=False, **kwargs):
+ verbose=0, e10s=True, emulator=False, headless=False,
+ topsrcdir=None, topobjdir=None, **kwargs):
self._appName = None
self._capabilities = None
self._filename_pattern = None
self._version_info = {}
self.fixture_servers = {}
self.fixtures = Fixtures()
self.extra_kwargs = kwargs
@@ -556,16 +557,18 @@ class BaseMarionetteTestRunner(object):
self.test_tags = test_tags
self.startup_timeout = startup_timeout
self.workspace = workspace
# If no workspace is set, default location for gecko.log is .
# and default location for profile is TMP
self.workspace_path = workspace or os.getcwd()
self.verbose = verbose
self.headless = headless
+ self.topsrcdir = topsrcdir
+ self.topobjdir = topobjdir
# self.e10s stores the desired configuration, whereas
# self._e10s_from_browser is the cached value from querying e10s
# in self.is_e10s
self.e10s = e10s
self._e10s_from_browser = None
if self.e10s:
self.prefs.update({
@@ -720,16 +723,18 @@ class BaseMarionetteTestRunner(object):
os.mkdir(self.logdir)
kwargs = {
'socket_timeout': self.socket_timeout,
'prefs': self.prefs,
'startup_timeout': self.startup_timeout,
'verbose': self.verbose,
'symbols_path': self.symbols_path,
+ 'topsrcdir': self.topsrcdir,
+ 'topobjdir': self.topobjdir,
}
if self.bin or self.emulator:
kwargs.update({
'host': 'localhost',
'port': 2828,
'app': self.app,
'app_args': self.app_args,
'profile': self.profile,
--- a/testing/marionette/mach_commands.py
+++ b/testing/marionette/mach_commands.py
@@ -25,30 +25,33 @@ def is_firefox_or_android(cls):
def setup_marionette_argument_parser():
from marionette_harness.runtests import MarionetteArguments
from mozlog.structured import commandline
parser = MarionetteArguments()
commandline.add_logging_group(parser)
return parser
-def run_marionette(tests, binary=None, topsrcdir=None, **kwargs):
+def run_marionette(tests, binary=None, topsrcdir=None, topobjdir=None, **kwargs):
from mozlog.structured import commandline
from marionette_harness.runtests import (
MarionetteTestRunner,
MarionetteHarness
)
parser = setup_marionette_argument_parser()
if not tests:
tests = [os.path.join(topsrcdir,
'testing/marionette/harness/marionette_harness/tests/unit-tests.ini')]
+ kwargs['topsrcdir'] = topsrcdir
+ kwargs['topobjdir'] = topobjdir
+
args = argparse.Namespace(tests=tests)
args.binary = binary
for k, v in kwargs.iteritems():
setattr(args, k, v)
parser.verify_usage(args)
@@ -73,9 +76,10 @@ class MachCommands(MachCommandBase):
if 'test_objects' in kwargs:
tests = []
for obj in kwargs['test_objects']:
tests.append(obj['file_relpath'])
del kwargs['test_objects']
if not kwargs.get('binary') and conditions.is_firefox(self):
kwargs['binary'] = self.get_binary_path('app')
- return run_marionette(tests, topsrcdir=self.topsrcdir, **kwargs)
+ return run_marionette(tests, topsrcdir=self.topsrcdir,
+ topobjdir=self.topobjdir, **kwargs)