Bug 1399956 - Add headless flag for mochitests. r?jmaher
MozReview-Commit-ID: Kqk0sw4ykEm
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -469,16 +469,22 @@ class MochitestArguments(ArgumentContain
"for storing the screenshots."
}],
[["--quiet"],
{"action": "store_true",
"dest": "quiet",
"default": False,
"help": "Do not print test log lines unless a failure occurs.",
}],
+ [["--headless"],
+ {"action": "store_true",
+ "dest": "headless",
+ "default": False,
+ "help": "Run tests in headless mode.",
+ }],
[["--pidfile"],
{"dest": "pidFile",
"default": "",
"help": "Name of the pidfile to generate.",
"suppress": True,
}],
[["--use-test-media-devices"],
{"action": "store_true",
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -1608,16 +1608,19 @@ toolbar#nav-bar {
lsanPath=lsanPath,
ubsanPath=ubsanPath)
if hasattr(options, "topsrcdir"):
browserEnv["MOZ_DEVELOPER_REPO_DIR"] = options.topsrcdir
if hasattr(options, "topobjdir"):
browserEnv["MOZ_DEVELOPER_OBJ_DIR"] = options.topobjdir
+ if options.headless:
+ browserEnv["MOZ_HEADLESS"] = '1'
+
# These variables are necessary for correct application startup; change
# via the commandline at your own risk.
browserEnv["XPCOM_DEBUG_BREAK"] = "stack"
# interpolate environment passed with options
try:
browserEnv.update(
dict(
@@ -2402,16 +2405,17 @@ toolbar#nav-bar {
def runTests(self, options):
""" Prepare, configure, run tests and cleanup """
# a11y and chrome tests don't run with e10s enabled in CI. Need to set
# this here since |mach mochitest| sets the flavor after argument parsing.
if options.flavor in ('a11y', 'chrome'):
options.e10s = False
mozinfo.update({"e10s": options.e10s}) # for test manifest parsing.
+ mozinfo.update({"headless": options.headless}) # for test manifest parsing.
if options.jscov_dir_prefix is not None:
mozinfo.update({'coverage': True})
self.setTestRoot(options)
# Despite our efforts to clean up servers started by this script, in practice
# we still see infrequent cases where a process is orphaned and interferes