2013-07-29 10:01:54 -07:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
from abc import ABCMeta, abstractmethod, abstractproperty
|
|
|
|
from argparse import ArgumentParser, SUPPRESS
|
2015-08-06 14:40:54 -07:00
|
|
|
from distutils.util import strtobool
|
2014-11-04 16:59:40 -08:00
|
|
|
from urlparse import urlparse
|
2015-08-22 18:57:19 -07:00
|
|
|
import json
|
2013-07-26 11:40:04 -07:00
|
|
|
import os
|
|
|
|
import tempfile
|
|
|
|
|
2016-02-11 13:09:45 -08:00
|
|
|
from mozdevice import DroidADB, DroidSUT
|
2013-07-26 11:40:04 -07:00
|
|
|
from mozprofile import DEFAULT_PORTS
|
2015-03-24 14:42:24 -07:00
|
|
|
import mozinfo
|
2015-07-16 07:38:40 -07:00
|
|
|
import mozlog
|
2015-03-24 14:42:24 -07:00
|
|
|
import moznetwork
|
|
|
|
|
2013-07-26 11:40:04 -07:00
|
|
|
|
2013-08-26 14:17:51 -07:00
|
|
|
here = os.path.abspath(os.path.dirname(__file__))
|
2013-08-22 12:24:40 -07:00
|
|
|
|
2013-07-26 11:40:04 -07:00
|
|
|
try:
|
2015-04-30 10:47:01 -07:00
|
|
|
from mozbuild.base import (
|
|
|
|
MozbuildObject,
|
|
|
|
MachCommandConditions as conditions,
|
|
|
|
)
|
2013-08-22 12:24:40 -07:00
|
|
|
build_obj = MozbuildObject.from_environment(cwd=here)
|
2013-07-26 11:40:04 -07:00
|
|
|
except ImportError:
|
|
|
|
build_obj = None
|
2015-04-30 10:47:01 -07:00
|
|
|
conditions = None
|
2013-07-26 11:40:04 -07:00
|
|
|
|
|
|
|
|
2015-09-28 03:01:42 -07:00
|
|
|
def get_default_valgrind_suppression_files():
|
|
|
|
# We are trying to locate files in the source tree. So if we
|
|
|
|
# don't know where the source tree is, we must give up.
|
2016-02-03 09:43:05 -08:00
|
|
|
#
|
|
|
|
# When this is being run by |mach mochitest --valgrind ...|, it is
|
|
|
|
# expected that |build_obj| is not None, and so the logic below will
|
|
|
|
# select the correct suppression files.
|
|
|
|
#
|
|
|
|
# When this is run from mozharness, |build_obj| is None, and we expect
|
|
|
|
# that testing/mozharness/configs/unittests/linux_unittests.py will
|
|
|
|
# select the correct suppression files (and paths to them) and
|
|
|
|
# will specify them using the --valgrind-supp-files= flag. Hence this
|
|
|
|
# function will not get called when running from mozharness.
|
|
|
|
#
|
|
|
|
# Note: keep these Valgrind .sup file names consistent with those
|
|
|
|
# in testing/mozharness/configs/unittests/linux_unittest.py.
|
2015-09-28 03:01:42 -07:00
|
|
|
if build_obj is None or build_obj.topsrcdir is None:
|
|
|
|
return []
|
|
|
|
|
|
|
|
supps_path = os.path.join(build_obj.topsrcdir, "build", "valgrind")
|
|
|
|
|
|
|
|
rv = []
|
|
|
|
if mozinfo.os == "linux":
|
|
|
|
if mozinfo.processor == "x86_64":
|
|
|
|
rv.append(os.path.join(supps_path, "x86_64-redhat-linux-gnu.sup"))
|
|
|
|
rv.append(os.path.join(supps_path, "cross-architecture.sup"))
|
|
|
|
elif mozinfo.processor == "x86":
|
|
|
|
rv.append(os.path.join(supps_path, "i386-redhat-linux-gnu.sup"))
|
|
|
|
rv.append(os.path.join(supps_path, "cross-architecture.sup"))
|
|
|
|
|
|
|
|
return rv
|
|
|
|
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
class ArgumentContainer():
|
|
|
|
__metaclass__ = ABCMeta
|
|
|
|
|
|
|
|
@abstractproperty
|
|
|
|
def args(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractproperty
|
|
|
|
def defaults(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def validate(self, parser, args, context):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def get_full_path(self, path, cwd):
|
|
|
|
"""Get an absolute path relative to cwd."""
|
|
|
|
return os.path.normpath(os.path.join(cwd, os.path.expanduser(path)))
|
|
|
|
|
|
|
|
|
|
|
|
class MochitestArguments(ArgumentContainer):
|
|
|
|
"""General mochitest arguments."""
|
2013-07-26 11:40:04 -07:00
|
|
|
|
|
|
|
LOG_LEVELS = ("DEBUG", "INFO", "WARNING", "ERROR", "FATAL")
|
|
|
|
LEVEL_STRING = ", ".join(LOG_LEVELS)
|
2015-04-30 10:47:01 -07:00
|
|
|
|
|
|
|
args = [
|
2015-06-05 10:28:29 -07:00
|
|
|
[["test_paths"],
|
|
|
|
{"nargs": "*",
|
|
|
|
"metavar": "TEST",
|
|
|
|
"default": [],
|
|
|
|
"help": "Test to run. Can be a single test file or a directory of tests "
|
|
|
|
"(to run recursively). If omitted, the entire suite is run.",
|
|
|
|
}],
|
2015-04-30 10:47:01 -07:00
|
|
|
[["--keep-open"],
|
2015-08-06 14:40:54 -07:00
|
|
|
{"nargs": "?",
|
|
|
|
"type": strtobool,
|
|
|
|
"const": "true",
|
|
|
|
"default": None,
|
|
|
|
"help": "Always keep the browser open after tests complete. Or always close the "
|
|
|
|
"browser with --keep-open=false",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--appname"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "app",
|
2013-07-31 13:45:54 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Override the default binary used to run tests with the path provided, e.g "
|
|
|
|
"/usr/bin/firefox. If you have run ./mach package beforehand, you can "
|
|
|
|
"specify 'dist' to run tests against the distribution bundle's binary.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--utility-path"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "utilityPath",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": build_obj.bindir if build_obj is not None else None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "absolute path to directory containing utility programs "
|
|
|
|
"(xpcshell, ssltunnel, certutil)",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--certificate-path"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "certPath",
|
2015-04-30 10:47:01 -07:00
|
|
|
"default": None,
|
2013-07-26 11:40:04 -07:00
|
|
|
"help": "absolute path to directory containing certificate store to use testing profile",
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2015-04-30 10:47:01 -07:00
|
|
|
[["--no-autorun"],
|
|
|
|
{"action": "store_false",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "autorun",
|
2015-04-30 10:47:01 -07:00
|
|
|
"default": True,
|
|
|
|
"help": "Do not start running tests automatically.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--timeout"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"type": int,
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "The per-test timeout in seconds (default: 60 seconds).",
|
|
|
|
}],
|
|
|
|
[["--max-timeouts"],
|
|
|
|
{"type": int,
|
|
|
|
"dest": "maxTimeouts",
|
|
|
|
"default": None,
|
|
|
|
"help": "The maximum number of timeouts permitted before halting testing.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--total-chunks"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"type": int,
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "totalChunks",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Total number of chunks to split tests into.",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--this-chunk"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"type": int,
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "thisChunk",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "If running tests by chunks, the chunk number to run.",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2015-03-26 12:21:45 -07:00
|
|
|
[["--chunk-by-runtime"],
|
|
|
|
{"action": "store_true",
|
|
|
|
"dest": "chunkByRuntime",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Group tests such that each chunk has roughly the same runtime.",
|
2015-03-26 12:21:45 -07:00
|
|
|
"default": False,
|
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--chunk-by-dir"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"type": int,
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "chunkByDir",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Group tests together in the same chunk that are in the same top "
|
|
|
|
"chunkByDir directories.",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": 0,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-06-03 08:19:28 -07:00
|
|
|
[["--run-by-dir"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2014-06-03 08:19:28 -07:00
|
|
|
"dest": "runByDir",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Run each directory in a single browser instance with a fresh profile.",
|
2014-06-03 08:19:28 -07:00
|
|
|
"default": False,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--shuffle"],
|
2015-04-30 10:47:01 -07:00
|
|
|
{"action": "store_true",
|
|
|
|
"help": "Shuffle execution order of tests.",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": False,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--console-level"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "consoleLevel",
|
2013-07-26 11:40:04 -07:00
|
|
|
"choices": LOG_LEVELS,
|
2015-04-30 10:47:01 -07:00
|
|
|
"default": "INFO",
|
|
|
|
"help": "One of %s to determine the level of console logging." % LEVEL_STRING,
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--chrome"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Run chrome mochitests.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-07-04 04:55:00 -07:00
|
|
|
[["--bisect-chunk"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "bisectChunk",
|
2014-07-04 04:55:00 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Specify the failing test name to find the previous tests that may be "
|
|
|
|
"causing the failure.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-10-28 12:24:55 -07:00
|
|
|
[["--start-at"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "startAt",
|
2013-10-28 12:24:55 -07:00
|
|
|
"default": "",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Start running the test sequence at this test.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-10-28 12:24:55 -07:00
|
|
|
[["--end-at"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "endAt",
|
2013-10-28 12:24:55 -07:00
|
|
|
"default": "",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Stop running the test sequence at this test.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--browser-chrome"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "browserChrome",
|
2015-05-04 18:28:16 -07:00
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "run browser chrome Mochitests",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-03-25 09:52:53 -07:00
|
|
|
[["--subsuite"],
|
2015-04-30 10:47:01 -07:00
|
|
|
{"default": None,
|
|
|
|
"help": "Subsuite of tests to run. Unlike tags, subsuites also remove tests from "
|
|
|
|
"the default set. Only one can be specified at once.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-09-22 11:08:06 -07:00
|
|
|
[["--jetpack-package"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2014-09-22 11:08:06 -07:00
|
|
|
"dest": "jetpackPackage",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Run jetpack package tests.",
|
2014-09-22 11:08:06 -07:00
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-09-22 11:08:06 -07:00
|
|
|
[["--jetpack-addon"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2014-09-22 11:08:06 -07:00
|
|
|
"dest": "jetpackAddon",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Run jetpack addon tests.",
|
2014-09-22 11:08:06 -07:00
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--webapprt-content"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "webapprtContent",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Run WebappRT content tests.",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--webapprt-chrome"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "webapprtChrome",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Run WebappRT chrome tests.",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--a11y"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Run accessibility Mochitests.",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--setenv"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "append",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "environment",
|
|
|
|
"metavar": "NAME=VALUE",
|
|
|
|
"default": [],
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Sets the given variable in the application's environment.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--exclude-extension"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "append",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "extensionsToExclude",
|
|
|
|
"default": [],
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Excludes the given extension from being installed in the test profile.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--browser-arg"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "append",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "browserArgs",
|
|
|
|
"default": [],
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Provides an argument to the test application (e.g Firefox).",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--leak-threshold"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"type": int,
|
2014-09-30 09:54:25 -07:00
|
|
|
"dest": "defaultLeakThreshold",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": 0,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Fail if the number of bytes leaked in default processes through "
|
|
|
|
"refcounted objects (or bytes in classes with MOZ_COUNT_CTOR and "
|
|
|
|
"MOZ_COUNT_DTOR) is greater than the given number.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--fatal-assertions"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "fatalAssertions",
|
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Abort testing whenever an assertion is hit (requires a debug build to "
|
|
|
|
"be effective).",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--extra-profile-file"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "append",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "extraProfileFiles",
|
|
|
|
"default": [],
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Copy specified files/dirs to testing profile. Can be specified more "
|
|
|
|
"than once.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--install-extension"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "append",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "extensionsToInstall",
|
|
|
|
"default": [],
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Install the specified extension in the testing profile. Can be a path "
|
|
|
|
"to a .xpi file.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--profile-path"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "profilePath",
|
2014-06-17 15:38:13 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Directory where the profile will be stored. This directory will be "
|
|
|
|
"deleted after the tests are finished.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--testing-modules-dir"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "testingModulesDir",
|
2015-05-04 18:28:16 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Directory where testing-only JS modules are located.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--repeat"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"type": int,
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": 0,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Repeat the tests the given number of times.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--run-until-failure"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "runUntilFailure",
|
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Run tests repeatedly but stop the first time a test fails. Default cap "
|
|
|
|
"is 30 runs, which can be overridden with the --repeat parameter.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-08-02 05:48:06 -07:00
|
|
|
[["--manifest"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "manifestFile",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Path to a manifestparser (.ini formatted) manifest of tests to run.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2015-08-22 18:57:19 -07:00
|
|
|
[["--extra-mozinfo-json"],
|
|
|
|
{"dest": "extra_mozinfo_json",
|
|
|
|
"default": None,
|
|
|
|
"help": "Filter tests based on a given mozinfo file.",
|
|
|
|
"suppress": True,
|
|
|
|
}],
|
2014-12-14 18:18:39 -08:00
|
|
|
[["--testrun-manifest-file"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "testRunManifestFile",
|
2014-12-14 18:18:39 -08:00
|
|
|
"default": 'tests.json',
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Overrides the default filename of the tests.json manifest file that is "
|
|
|
|
"generated by the harness and used by SimpleTest. Only useful when running "
|
|
|
|
"multiple test runs simulatenously on the same machine.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2015-08-21 17:16:11 -07:00
|
|
|
[["--dump-tests"],
|
|
|
|
{"dest": "dump_tests",
|
|
|
|
"default": None,
|
|
|
|
"help": "Specify path to a filename to dump all the tests that will be run",
|
|
|
|
"suppress": True,
|
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--failure-file"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "failureFile",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Filename of the output file where we can store a .json list of failures "
|
|
|
|
"to be run in the future with --run-only-tests.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--run-slower"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "runSlower",
|
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Delay execution between tests.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--metro-immersive"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "immersiveMode",
|
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Launches tests in an immersive browser.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--httpd-path"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "httpdPath",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Path to the httpd.js file.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--setpref"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "append",
|
2015-04-30 10:47:01 -07:00
|
|
|
"metavar": "PREF=VALUE",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": [],
|
|
|
|
"dest": "extraPrefs",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Defines an extra user preference.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-10-21 09:12:12 -07:00
|
|
|
[["--jsdebugger"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-10-21 09:12:12 -07:00
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Start the browser JS debugger before running the test. Implies --no-autorun.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-11-01 12:23:34 -07:00
|
|
|
[["--debug-on-failure"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-11-01 12:23:34 -07:00
|
|
|
"default": False,
|
|
|
|
"dest": "debugOnFailure",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Breaks execution and enters the JS debugger on a test failure. Should "
|
|
|
|
"be used together with --jsdebugger."
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-11-03 15:07:49 -08:00
|
|
|
[["--e10s"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-11-03 15:07:49 -08:00
|
|
|
"default": False,
|
|
|
|
"help": "Run tests with electrolysis preferences and test filtering enabled.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2015-11-13 16:14:40 -08:00
|
|
|
[["--store-chrome-manifest"],
|
|
|
|
{"action": "store",
|
|
|
|
"help": "Destination path to write a copy of any chrome manifest "
|
|
|
|
"written by the harness.",
|
|
|
|
"default": None,
|
|
|
|
"suppress": True,
|
|
|
|
}],
|
2015-12-23 14:04:49 -08:00
|
|
|
[["--jscov-dir-prefix"],
|
|
|
|
{"action": "store",
|
|
|
|
"help": "Directory to store per-test line coverage data as json "
|
|
|
|
"(browser-chrome only). To emit lcov formatted data, set "
|
|
|
|
"JS_CODE_COVERAGE_OUTPUT_DIR in the environment.",
|
|
|
|
"default": None,
|
|
|
|
"suppress": True,
|
|
|
|
}],
|
2014-12-10 01:34:03 -08:00
|
|
|
[["--strict-content-sandbox"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2014-12-10 01:34:03 -08:00
|
|
|
"default": False,
|
|
|
|
"dest": "strictContentSandbox",
|
|
|
|
"help": "Run tests with a more strict content sandbox (Windows only).",
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": not mozinfo.isWin,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2015-01-12 17:07:00 -08:00
|
|
|
[["--nested_oop"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2015-01-12 17:07:00 -08:00
|
|
|
"default": False,
|
|
|
|
"help": "Run tests with nested_oop preferences and test filtering enabled.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2015-04-30 10:47:01 -07:00
|
|
|
[["--dmd"],
|
|
|
|
{"action": "store_true",
|
|
|
|
"default": False,
|
|
|
|
"help": "Run tests with DMD active.",
|
|
|
|
}],
|
2013-11-13 11:48:10 -08:00
|
|
|
[["--dmd-path"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"default": None,
|
2015-02-13 11:42:02 -08:00
|
|
|
"dest": "dmdPath",
|
|
|
|
"help": "Specifies the path to the directory containing the shared library for DMD.",
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-11-21 08:33:43 -08:00
|
|
|
[["--dump-output-directory"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"default": None,
|
2015-02-13 11:42:02 -08:00
|
|
|
"dest": "dumpOutputDirectory",
|
|
|
|
"help": "Specifies the directory in which to place dumped memory reports.",
|
|
|
|
}],
|
2013-11-21 08:33:43 -08:00
|
|
|
[["--dump-about-memory-after-test"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
|
|
|
"default": False,
|
|
|
|
"dest": "dumpAboutMemoryAfterTest",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Dump an about:memory log after each test in the directory specified "
|
|
|
|
"by --dump-output-directory.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-11-21 08:33:43 -08:00
|
|
|
[["--dump-dmd-after-test"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
|
|
|
"default": False,
|
|
|
|
"dest": "dumpDMDAfterTest",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Dump a DMD log after each test in the directory specified "
|
|
|
|
"by --dump-output-directory.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-02-12 07:54:11 -08:00
|
|
|
[["--slowscript"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
|
|
|
"default": False,
|
|
|
|
"help": "Do not set the JS_DISABLE_SLOW_SCRIPT_SIGNALS env variable; "
|
2015-04-30 10:47:01 -07:00
|
|
|
"when not set, recoverable but misleading SIGSEGV instances "
|
|
|
|
"may occur in Ion/Odin JIT code.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-04-11 19:23:00 -07:00
|
|
|
[["--screenshot-on-fail"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
|
|
|
"default": False,
|
|
|
|
"dest": "screenshotOnFail",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Take screenshots on all test failures. Set $MOZ_UPLOAD_DIR to a directory "
|
|
|
|
"for storing the screenshots."
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-03-07 08:42:07 -08:00
|
|
|
[["--quiet"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2015-05-04 18:28:16 -07:00
|
|
|
"dest": "quiet",
|
2015-04-30 10:47:01 -07:00
|
|
|
"default": False,
|
|
|
|
"help": "Do not print test log lines unless a failure occurs.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-03-14 11:25:41 -07:00
|
|
|
[["--pidfile"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "pidFile",
|
2014-03-14 11:25:41 -07:00
|
|
|
"default": "",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Name of the pidfile to generate.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-05-01 04:18:00 -07:00
|
|
|
[["--use-test-media-devices"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2014-05-01 04:18:00 -07:00
|
|
|
"default": False,
|
|
|
|
"dest": "useTestMediaDevices",
|
|
|
|
"help": "Use test media device drivers for media testing.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-08-22 07:28:04 -07:00
|
|
|
[["--gmp-path"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"default": None,
|
2014-08-22 07:28:04 -07:00
|
|
|
"help": "Path to fake GMP plugin. Will be deduced from the binary if not passed.",
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-11-19 12:31:45 -08:00
|
|
|
[["--xre-path"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "xrePath",
|
2014-11-19 12:31:45 -08:00
|
|
|
"default": None, # individual scripts will set a sane default
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Absolute path to directory containing XRE (probably xulrunner).",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-11-19 12:31:45 -08:00
|
|
|
[["--symbols-path"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "symbolsPath",
|
2014-11-19 12:31:45 -08:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Absolute path to directory containing breakpad symbols, or the URL of a "
|
|
|
|
"zip file containing symbols",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-11-19 12:31:45 -08:00
|
|
|
[["--debugger"],
|
2015-04-30 10:47:01 -07:00
|
|
|
{"default": None,
|
|
|
|
"help": "Debugger binary to run tests in. Program name or path.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-11-19 12:31:45 -08:00
|
|
|
[["--debugger-args"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "debuggerArgs",
|
2015-04-30 10:47:01 -07:00
|
|
|
"default": None,
|
|
|
|
"help": "Arguments to pass to the debugger.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2015-09-28 03:01:42 -07:00
|
|
|
[["--valgrind"],
|
|
|
|
{"default": None,
|
|
|
|
"help": "Valgrind binary to run tests with. Program name or path.",
|
|
|
|
}],
|
|
|
|
[["--valgrind-args"],
|
|
|
|
{"dest": "valgrindArgs",
|
|
|
|
"default": None,
|
2016-02-09 05:38:55 -08:00
|
|
|
"help": "Comma-separated list of extra arguments to pass to Valgrind.",
|
2015-09-28 03:01:42 -07:00
|
|
|
}],
|
|
|
|
[["--valgrind-supp-files"],
|
|
|
|
{"dest": "valgrindSuppFiles",
|
|
|
|
"default": None,
|
|
|
|
"help": "Comma-separated list of suppression files to pass to Valgrind.",
|
|
|
|
}],
|
2014-11-19 12:31:45 -08:00
|
|
|
[["--debugger-interactive"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2014-11-19 12:31:45 -08:00
|
|
|
"dest": "debuggerInteractive",
|
2015-03-24 14:42:24 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Prevents the test harness from redirecting stdout and stderr for "
|
|
|
|
"interactive debuggers.",
|
|
|
|
"suppress": True,
|
2015-03-24 14:42:24 -07:00
|
|
|
}],
|
2015-03-19 13:15:33 -07:00
|
|
|
[["--tag"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"action": "append",
|
|
|
|
"dest": "test_tags",
|
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Filter out tests that don't have the given tag. Can be used multiple "
|
|
|
|
"times in which case the test must contain at least one of the given tags.",
|
2015-03-24 14:42:24 -07:00
|
|
|
}],
|
2015-04-10 10:45:22 -07:00
|
|
|
[["--enable-cpow-warnings"],
|
|
|
|
{"action": "store_true",
|
|
|
|
"dest": "enableCPOWWarnings",
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Enable logging of unsafe CPOW usage, which is disabled by default for tests",
|
|
|
|
"suppress": True,
|
2015-04-10 10:45:22 -07:00
|
|
|
}],
|
2016-01-25 06:55:57 -08:00
|
|
|
[["--marionette"],
|
|
|
|
{"default": None,
|
|
|
|
"help": "host:port to use when connecting to Marionette",
|
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
]
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
defaults = {
|
|
|
|
# Bug 1065098 - The geckomediaplugin process fails to produce a leak
|
|
|
|
# log for some reason.
|
|
|
|
'ignoreMissingLeaks': ["geckomediaplugin"],
|
2016-01-25 06:55:57 -08:00
|
|
|
'extensionsToExclude': ['specialpowers'],
|
2015-04-30 10:47:01 -07:00
|
|
|
# Set server information on the args object
|
|
|
|
'webServer': '127.0.0.1',
|
|
|
|
'httpPort': DEFAULT_PORTS['http'],
|
|
|
|
'sslPort': DEFAULT_PORTS['https'],
|
|
|
|
'webSocketPort': '9988',
|
|
|
|
# The default websocket port is incorrect in mozprofile; it is
|
|
|
|
# set to the SSL proxy setting. See:
|
|
|
|
# see https://bugzilla.mozilla.org/show_bug.cgi?id=916517
|
|
|
|
# args.webSocketPort = DEFAULT_PORTS['ws']
|
|
|
|
}
|
2013-07-26 11:40:04 -07:00
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
def validate(self, parser, options, context):
|
|
|
|
"""Validate generic options."""
|
2013-07-26 11:40:04 -07:00
|
|
|
|
2015-02-13 11:42:02 -08:00
|
|
|
# for test manifest parsing.
|
|
|
|
mozinfo.update({"strictContentSandbox": options.strictContentSandbox})
|
|
|
|
# for test manifest parsing.
|
|
|
|
mozinfo.update({"nested_oop": options.nested_oop})
|
2014-03-18 08:03:51 -07:00
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
# b2g and android don't use 'app' the same way, so skip validation
|
|
|
|
if parser.app not in ('b2g', 'android'):
|
|
|
|
if options.app is None:
|
|
|
|
if build_obj:
|
|
|
|
options.app = build_obj.get_binary_path()
|
|
|
|
else:
|
|
|
|
parser.error(
|
|
|
|
"could not find the application path, --appname must be specified")
|
|
|
|
elif options.app == "dist" and build_obj:
|
|
|
|
options.app = build_obj.get_binary_path(where='staged-package')
|
|
|
|
|
|
|
|
options.app = self.get_full_path(options.app, parser.oldcwd)
|
|
|
|
if not os.path.exists(options.app):
|
|
|
|
parser.error("Error: Path {} doesn't exist. Are you executing "
|
|
|
|
"$objdir/_tests/testing/mochitest/runtests.py?".format(
|
|
|
|
options.app))
|
|
|
|
|
|
|
|
if options.gmp_path is None and options.app and build_obj:
|
|
|
|
# Need to fix the location of gmp_fake which might not be shipped in the binary
|
|
|
|
gmp_modules = (
|
|
|
|
('gmp-fake', '1.0'),
|
|
|
|
('gmp-clearkey', '0.1'),
|
|
|
|
('gmp-fakeopenh264', '1.0')
|
|
|
|
)
|
|
|
|
options.gmp_path = os.pathsep.join(
|
|
|
|
os.path.join(build_obj.bindir, *p) for p in gmp_modules)
|
2013-07-31 13:45:54 -07:00
|
|
|
|
2013-07-26 11:40:04 -07:00
|
|
|
if options.totalChunks is not None and options.thisChunk is None:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
2015-02-13 11:42:02 -08:00
|
|
|
"thisChunk must be specified when totalChunks is specified")
|
2013-07-26 11:40:04 -07:00
|
|
|
|
2015-08-22 18:57:19 -07:00
|
|
|
if options.extra_mozinfo_json:
|
|
|
|
if not os.path.isfile(options.extra_mozinfo_json):
|
2015-11-18 10:35:38 -08:00
|
|
|
parser.error("Error: couldn't find mozinfo.json at '%s'."
|
2015-08-22 18:57:19 -07:00
|
|
|
% options.extra_mozinfo_json)
|
|
|
|
|
|
|
|
options.extra_mozinfo_json = json.load(open(options.extra_mozinfo_json))
|
|
|
|
|
2013-07-26 11:40:04 -07:00
|
|
|
if options.totalChunks:
|
|
|
|
if not 1 <= options.thisChunk <= options.totalChunks:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error("thisChunk must be between 1 and totalChunks")
|
2013-07-26 11:40:04 -07:00
|
|
|
|
2015-03-26 12:21:45 -07:00
|
|
|
if options.chunkByDir and options.chunkByRuntime:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
2015-03-26 12:21:45 -07:00
|
|
|
"can only use one of --chunk-by-dir or --chunk-by-runtime")
|
|
|
|
|
2013-07-26 11:40:04 -07:00
|
|
|
if options.xrePath is None:
|
|
|
|
# default xrePath to the app path if not provided
|
|
|
|
# but only if an app path was explicitly provided
|
2015-04-30 10:47:01 -07:00
|
|
|
if options.app != parser.get_default('app'):
|
2013-07-26 11:40:04 -07:00
|
|
|
options.xrePath = os.path.dirname(options.app)
|
2014-09-29 11:51:25 -07:00
|
|
|
if mozinfo.isMac:
|
2015-02-13 11:42:02 -08:00
|
|
|
options.xrePath = os.path.join(
|
|
|
|
os.path.dirname(
|
|
|
|
options.xrePath),
|
|
|
|
"Resources")
|
2013-07-26 11:40:04 -07:00
|
|
|
elif build_obj is not None:
|
|
|
|
# otherwise default to dist/bin
|
|
|
|
options.xrePath = build_obj.bindir
|
|
|
|
else:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
2015-02-13 11:42:02 -08:00
|
|
|
"could not find xre directory, --xre-path must be specified")
|
2013-07-26 11:40:04 -07:00
|
|
|
|
|
|
|
# allow relative paths
|
2015-05-26 07:12:51 -07:00
|
|
|
if options.xrePath:
|
|
|
|
options.xrePath = self.get_full_path(options.xrePath, parser.oldcwd)
|
|
|
|
|
2014-06-23 02:24:00 -07:00
|
|
|
if options.profilePath:
|
2015-04-30 10:47:01 -07:00
|
|
|
options.profilePath = self.get_full_path(options.profilePath, parser.oldcwd)
|
|
|
|
|
|
|
|
if options.dmdPath:
|
|
|
|
options.dmdPath = self.get_full_path(options.dmdPath, parser.oldcwd)
|
|
|
|
|
|
|
|
if options.dmd and not options.dmdPath:
|
|
|
|
if build_obj:
|
|
|
|
options.dmdPath = build_obj.bin_dir
|
|
|
|
else:
|
|
|
|
parser.error(
|
|
|
|
"could not find dmd libraries, specify them with --dmd-path")
|
2013-07-26 11:40:04 -07:00
|
|
|
|
|
|
|
if options.utilityPath:
|
2015-04-30 10:47:01 -07:00
|
|
|
options.utilityPath = self.get_full_path(options.utilityPath, parser.oldcwd)
|
2013-07-26 11:40:04 -07:00
|
|
|
|
|
|
|
if options.certPath:
|
2015-04-30 10:47:01 -07:00
|
|
|
options.certPath = self.get_full_path(options.certPath, parser.oldcwd)
|
|
|
|
elif build_obj:
|
|
|
|
options.certPath = os.path.join(build_obj.topsrcdir, 'build', 'pgo', 'certs')
|
|
|
|
|
|
|
|
if options.symbolsPath and len(urlparse(options.symbolsPath).scheme) < 2:
|
|
|
|
options.symbolsPath = self.get_full_path(options.symbolsPath, parser.oldcwd)
|
|
|
|
elif not options.symbolsPath and build_obj:
|
|
|
|
options.symbolsPath = os.path.join(build_obj.distdir, 'crashreporter-symbols')
|
2013-07-26 11:40:04 -07:00
|
|
|
|
|
|
|
if options.webapprtContent and options.webapprtChrome:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
2015-02-13 11:42:02 -08:00
|
|
|
"Only one of --webapprt-content and --webapprt-chrome may be given.")
|
2013-07-26 11:40:04 -07:00
|
|
|
|
2013-10-21 09:12:12 -07:00
|
|
|
if options.jsdebugger:
|
|
|
|
options.extraPrefs += [
|
|
|
|
"devtools.debugger.remote-enabled=true",
|
|
|
|
"devtools.chrome.enabled=true",
|
|
|
|
"devtools.debugger.prompt-connection=false"
|
|
|
|
]
|
|
|
|
options.autorun = False
|
|
|
|
|
2013-11-01 12:23:34 -07:00
|
|
|
if options.debugOnFailure and not options.jsdebugger:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
|
|
|
"--debug-on-failure requires --jsdebugger.")
|
|
|
|
|
|
|
|
if options.debuggerArgs and not options.debugger:
|
|
|
|
parser.error(
|
|
|
|
"--debugger-args requires --debugger.")
|
|
|
|
|
2015-11-13 16:14:40 -08:00
|
|
|
if options.store_chrome_manifest:
|
|
|
|
options.store_chrome_manifest = os.path.abspath(options.store_chrome_manifest)
|
|
|
|
if not os.path.isdir(os.path.dirname(options.store_chrome_manifest)):
|
|
|
|
parser.error(
|
|
|
|
"directory for %s does not exist as a destination to copy a "
|
|
|
|
"chrome manifest." % options.store_chrome_manifest)
|
|
|
|
|
2015-12-23 14:04:49 -08:00
|
|
|
if options.jscov_dir_prefix:
|
|
|
|
options.jscov_dir_prefix = os.path.abspath(options.jscov_dir_prefix)
|
|
|
|
if not os.path.isdir(options.jscov_dir_prefix):
|
|
|
|
parser.error(
|
|
|
|
"directory %s does not exist as a destination for coverage "
|
|
|
|
"data." % options.jscov_dir_prefix)
|
|
|
|
|
2013-07-26 11:40:04 -07:00
|
|
|
if options.testingModulesDir is None:
|
2015-04-30 10:47:01 -07:00
|
|
|
if build_obj:
|
|
|
|
options.testingModulesDir = os.path.join(
|
|
|
|
build_obj.topobjdir, '_tests', 'modules')
|
|
|
|
else:
|
|
|
|
# Try to guess the testing modules directory.
|
|
|
|
# This somewhat grotesque hack allows the buildbot machines to find the
|
|
|
|
# modules directory without having to configure the buildbot hosts. This
|
|
|
|
# code should never be executed in local runs because the build system
|
|
|
|
# should always set the flag that populates this variable. If buildbot ever
|
|
|
|
# passes this argument, this code can be deleted.
|
|
|
|
possible = os.path.join(here, os.path.pardir, 'modules')
|
|
|
|
|
|
|
|
if os.path.isdir(possible):
|
|
|
|
options.testingModulesDir = possible
|
2013-07-26 11:40:04 -07:00
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
if build_obj:
|
2015-05-07 11:38:43 -07:00
|
|
|
plugins_dir = os.path.join(build_obj.distdir, 'plugins')
|
|
|
|
if plugins_dir not in options.extraProfileFiles:
|
|
|
|
options.extraProfileFiles.append(plugins_dir)
|
2013-07-26 11:40:04 -07:00
|
|
|
|
|
|
|
# Even if buildbot is updated, we still want this, as the path we pass in
|
|
|
|
# to the app must be absolute and have proper slashes.
|
|
|
|
if options.testingModulesDir is not None:
|
2015-02-13 11:42:02 -08:00
|
|
|
options.testingModulesDir = os.path.normpath(
|
|
|
|
options.testingModulesDir)
|
2013-07-26 11:40:04 -07:00
|
|
|
|
|
|
|
if not os.path.isabs(options.testingModulesDir):
|
2015-02-13 11:42:02 -08:00
|
|
|
options.testingModulesDir = os.path.abspath(
|
|
|
|
options.testingModulesDir)
|
2013-07-26 11:40:04 -07:00
|
|
|
|
|
|
|
if not os.path.isdir(options.testingModulesDir):
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error('--testing-modules-dir not a directory: %s' %
|
|
|
|
options.testingModulesDir)
|
2013-07-26 11:40:04 -07:00
|
|
|
|
2015-02-13 11:42:02 -08:00
|
|
|
options.testingModulesDir = options.testingModulesDir.replace(
|
|
|
|
'\\',
|
|
|
|
'/')
|
2013-07-26 11:40:04 -07:00
|
|
|
if options.testingModulesDir[-1] != '/':
|
|
|
|
options.testingModulesDir += '/'
|
|
|
|
|
|
|
|
if options.immersiveMode:
|
2013-09-23 07:47:48 -07:00
|
|
|
if not mozinfo.isWin:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error("immersive is only supported on Windows 8 and up.")
|
|
|
|
options.immersiveHelperPath = os.path.join(
|
2013-07-26 11:40:04 -07:00
|
|
|
options.utilityPath, "metrotestharness.exe")
|
2015-04-30 10:47:01 -07:00
|
|
|
if not os.path.exists(options.immersiveHelperPath):
|
|
|
|
parser.error("%s not found, cannot launch immersive tests." %
|
|
|
|
options.immersiveHelperPath)
|
2013-07-26 11:40:04 -07:00
|
|
|
|
|
|
|
if options.runUntilFailure:
|
|
|
|
if not options.repeat:
|
|
|
|
options.repeat = 29
|
2013-08-02 05:48:06 -07:00
|
|
|
|
2013-11-21 08:33:43 -08:00
|
|
|
if options.dumpOutputDirectory is None:
|
|
|
|
options.dumpOutputDirectory = tempfile.gettempdir()
|
|
|
|
|
|
|
|
if options.dumpAboutMemoryAfterTest or options.dumpDMDAfterTest:
|
|
|
|
if not os.path.isdir(options.dumpOutputDirectory):
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error('--dump-output-directory not a directory: %s' %
|
|
|
|
options.dumpOutputDirectory)
|
2013-11-21 08:33:43 -08:00
|
|
|
|
2014-05-01 04:18:00 -07:00
|
|
|
if options.useTestMediaDevices:
|
|
|
|
if not mozinfo.isLinux:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
2015-02-13 11:42:02 -08:00
|
|
|
'--use-test-media-devices is only supported on Linux currently')
|
2014-05-01 04:18:00 -07:00
|
|
|
for f in ['/usr/bin/gst-launch-0.10', '/usr/bin/pactl']:
|
|
|
|
if not os.path.isfile(f):
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
2015-03-04 17:54:08 -08:00
|
|
|
'Missing binary %s required for '
|
|
|
|
'--use-test-media-devices' % f)
|
2014-05-01 04:18:00 -07:00
|
|
|
|
2015-01-12 17:07:00 -08:00
|
|
|
if options.nested_oop:
|
2015-02-13 11:42:02 -08:00
|
|
|
if not options.e10s:
|
|
|
|
options.e10s = True
|
2015-04-08 17:03:00 -07:00
|
|
|
mozinfo.update({"e10s": options.e10s}) # for test manifest parsing.
|
2015-01-12 17:07:00 -08:00
|
|
|
|
2014-09-30 09:54:25 -07:00
|
|
|
options.leakThresholds = {
|
|
|
|
"default": options.defaultLeakThreshold,
|
2015-08-31 23:38:07 -07:00
|
|
|
"tab": 10000, # See dependencies of bug 1051230.
|
2015-02-13 11:42:02 -08:00
|
|
|
# GMP rarely gets a log, but when it does, it leaks a little.
|
|
|
|
"geckomediaplugin": 20000,
|
2014-09-30 09:54:25 -07:00
|
|
|
}
|
|
|
|
|
2015-06-05 10:28:29 -07:00
|
|
|
# XXX We can't normalize test_paths in the non build_obj case here,
|
|
|
|
# because testRoot depends on the flavor, which is determined by the
|
|
|
|
# mach command and therefore not finalized yet. Conversely, test paths
|
|
|
|
# need to be normalized here for the mach case.
|
|
|
|
if options.test_paths and build_obj:
|
|
|
|
# Normalize test paths so they are relative to test root
|
|
|
|
options.test_paths = [build_obj._wrap_path_argument(p).relpath()
|
2015-11-18 10:35:38 -08:00
|
|
|
for p in options.test_paths]
|
2015-06-05 10:28:29 -07:00
|
|
|
|
2013-07-26 11:40:04 -07:00
|
|
|
return options
|
|
|
|
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
class B2GArguments(ArgumentContainer):
|
|
|
|
"""B2G specific arguments."""
|
|
|
|
|
|
|
|
args = [
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--b2gpath"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "b2gPath",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Path to B2G repo or QEMU directory.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--emulator"],
|
2015-04-30 10:47:01 -07:00
|
|
|
{"default": None,
|
|
|
|
"help": "Architecture of emulator to use, x86 or arm",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-01-31 10:22:51 -08:00
|
|
|
[["--wifi"],
|
2015-04-30 10:47:01 -07:00
|
|
|
{"default": False,
|
2014-01-31 10:22:51 -08:00
|
|
|
"help": "Devine wifi configuration for on device mochitest",
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--sdcard"],
|
2015-04-30 10:47:01 -07:00
|
|
|
{"default": "10MB",
|
2013-07-26 11:40:04 -07:00
|
|
|
"help": "Define size of sdcard: 1MB, 50MB...etc",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--no-window"],
|
2015-02-13 11:42:02 -08:00
|
|
|
{"action": "store_true",
|
2013-07-26 11:40:04 -07:00
|
|
|
"dest": "noWindow",
|
2015-05-04 18:28:16 -07:00
|
|
|
"default": False,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Pass --no-window to the emulator",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--adbpath"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "adbPath",
|
2015-10-05 04:11:52 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Path to adb binary.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--deviceIP"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "deviceIP",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "IP address of remote device to test.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--devicePort"],
|
2015-04-30 10:47:01 -07:00
|
|
|
{"default": 20701,
|
2013-07-26 11:40:04 -07:00
|
|
|
"help": "port of remote device to test",
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--remote-logfile"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "remoteLogFile",
|
2015-02-13 11:42:02 -08:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Name of log file on the device relative to the device root. "
|
|
|
|
"PLEASE ONLY USE A FILENAME.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--remote-webserver"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "remoteWebServer",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "IP address where the remote web server is hosted.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--http-port"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "httpPort",
|
|
|
|
"default": DEFAULT_PORTS['http'],
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Port used for http on the remote web server.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--ssl-port"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "sslPort",
|
|
|
|
"default": DEFAULT_PORTS['https'],
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Port used for https on the remote web server.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[["--gecko-path"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "geckoPath",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "The path to a gecko distribution that should be installed on the emulator "
|
|
|
|
"prior to test.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2014-06-19 11:17:26 -07:00
|
|
|
[["--logdir"],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": "logdir",
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Directory to store log files.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[['--busybox'],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": 'busybox',
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": None,
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Path to busybox binary to install on device.",
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
[['--profile-data-dir'],
|
2015-03-24 14:42:24 -07:00
|
|
|
{"dest": 'profile_data_dir',
|
2013-07-26 11:40:04 -07:00
|
|
|
"default": os.path.join(here, 'profile_data'),
|
2015-04-30 10:47:01 -07:00
|
|
|
"help": "Path to a directory containing preference and other data to be installed "
|
|
|
|
"into the profile.",
|
|
|
|
"suppress": True,
|
2015-02-13 11:42:02 -08:00
|
|
|
}],
|
2013-07-26 11:40:04 -07:00
|
|
|
]
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
defaults = {
|
|
|
|
'logFile': 'mochitest.log',
|
2015-11-05 07:00:59 -08:00
|
|
|
# Specialpowers is integrated with marionette for b2g,
|
|
|
|
# see marionette's jar.mn.
|
2015-04-30 10:47:01 -07:00
|
|
|
'extensionsToExclude': ['specialpowers'],
|
2016-01-25 06:55:57 -08:00
|
|
|
# mochijar doesn't get installed via marionette on android
|
|
|
|
'extensionsToInstall': [os.path.join(here, 'mochijar')],
|
2014-08-05 14:11:53 -07:00
|
|
|
# See dependencies of bug 1038943.
|
2015-04-30 10:47:01 -07:00
|
|
|
'defaultLeakThreshold': 5536,
|
|
|
|
}
|
|
|
|
|
|
|
|
def validate(self, parser, options, context):
|
|
|
|
"""Validate b2g options."""
|
|
|
|
|
2015-02-13 11:42:02 -08:00
|
|
|
if options.remoteWebServer is None:
|
2013-07-26 11:40:04 -07:00
|
|
|
if os.name != "nt":
|
|
|
|
options.remoteWebServer = moznetwork.get_ip()
|
|
|
|
else:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
2015-02-13 11:42:02 -08:00
|
|
|
"You must specify a --remote-webserver=<ip address>")
|
2013-07-26 11:40:04 -07:00
|
|
|
options.webServer = options.remoteWebServer
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
if not options.b2gPath and hasattr(context, 'b2g_home'):
|
|
|
|
options.b2gPath = context.b2g_home
|
|
|
|
|
|
|
|
if hasattr(context, 'device_name') and not options.emulator:
|
|
|
|
if context.device_name.startswith('emulator'):
|
|
|
|
options.emulator = 'x86' if 'x86' in context.device_name else 'arm'
|
|
|
|
|
2013-07-26 11:40:04 -07:00
|
|
|
if options.geckoPath and not options.emulator:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
2015-02-13 11:42:02 -08:00
|
|
|
"You must specify --emulator if you specify --gecko-path")
|
2013-07-26 11:40:04 -07:00
|
|
|
|
2014-06-19 11:17:26 -07:00
|
|
|
if options.logdir and not options.emulator:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error("You must specify --emulator if you specify --logdir")
|
|
|
|
elif not options.logdir and options.emulator and build_obj:
|
|
|
|
options.logdir = os.path.join(
|
|
|
|
build_obj.topobjdir, '_tests', 'testing', 'mochitest')
|
|
|
|
|
|
|
|
if hasattr(context, 'xre_path'):
|
|
|
|
options.xrePath = context.xre_path
|
2013-07-26 11:40:04 -07:00
|
|
|
|
|
|
|
if not os.path.isdir(options.xrePath):
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error("--xre-path '%s' is not a directory" % options.xrePath)
|
|
|
|
|
2013-07-26 11:40:04 -07:00
|
|
|
xpcshell = os.path.join(options.xrePath, 'xpcshell')
|
|
|
|
if not os.access(xpcshell, os.F_OK):
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error('xpcshell not found at %s' % xpcshell)
|
2013-07-26 11:40:04 -07:00
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
if self.elf_arm(xpcshell):
|
|
|
|
parser.error('--xre-path points to an ARM version of xpcshell; it '
|
|
|
|
'should instead point to a version that can run on '
|
|
|
|
'your desktop')
|
2015-05-04 18:28:16 -07:00
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
if not options.httpdPath and build_obj:
|
|
|
|
options.httpdPath = os.path.join(
|
|
|
|
build_obj.topobjdir, '_tests', 'testing', 'mochitest')
|
2013-07-26 11:40:04 -07:00
|
|
|
|
2014-09-30 14:17:27 -07:00
|
|
|
# Bug 1071866 - B2G Mochitests do not always produce a leak log.
|
|
|
|
options.ignoreMissingLeaks.append("default")
|
|
|
|
# Bug 1070068 - Leak logging does not work for tab processes on B2G.
|
2015-01-13 12:32:35 -08:00
|
|
|
options.ignoreMissingLeaks.append("tab")
|
2014-09-30 14:17:27 -07:00
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
if options.pidFile != "":
|
|
|
|
f = open(options.pidFile, 'w')
|
|
|
|
f.write("%s" % os.getpid())
|
|
|
|
f.close()
|
|
|
|
|
2013-07-26 11:40:04 -07:00
|
|
|
return options
|
|
|
|
|
|
|
|
def elf_arm(self, filename):
|
|
|
|
data = open(filename, 'rb').read(20)
|
2015-02-13 11:42:02 -08:00
|
|
|
return data[:4] == "\x7fELF" and ord(data[18]) == 40 # EM_ARM
|
2015-03-24 14:42:24 -07:00
|
|
|
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
class AndroidArguments(ArgumentContainer):
|
|
|
|
"""Android specific arguments."""
|
|
|
|
|
|
|
|
args = [
|
2015-03-24 14:42:24 -07:00
|
|
|
[["--remote-app-path"],
|
|
|
|
{"dest": "remoteAppPath",
|
|
|
|
"help": "Path to remote executable relative to device root using \
|
|
|
|
only forward slashes. Either this or app must be specified \
|
|
|
|
but not both.",
|
|
|
|
"default": None,
|
|
|
|
}],
|
|
|
|
[["--deviceIP"],
|
|
|
|
{"dest": "deviceIP",
|
|
|
|
"help": "ip address of remote device to test",
|
|
|
|
"default": None,
|
|
|
|
}],
|
|
|
|
[["--deviceSerial"],
|
|
|
|
{"dest": "deviceSerial",
|
|
|
|
"help": "ip address of remote device to test",
|
|
|
|
"default": None,
|
|
|
|
}],
|
|
|
|
[["--dm_trans"],
|
2015-04-30 10:47:01 -07:00
|
|
|
{"choices": ["adb", "sut"],
|
|
|
|
"default": "adb",
|
|
|
|
"help": "The transport to use for communication with the device [default: adb].",
|
|
|
|
"suppress": True,
|
2015-03-24 14:42:24 -07:00
|
|
|
}],
|
|
|
|
[["--devicePort"],
|
|
|
|
{"dest": "devicePort",
|
|
|
|
"type": int,
|
|
|
|
"default": 20701,
|
|
|
|
"help": "port of remote device to test",
|
|
|
|
}],
|
|
|
|
[["--remote-product-name"],
|
|
|
|
{"dest": "remoteProductName",
|
|
|
|
"default": "fennec",
|
|
|
|
"help": "The executable's name of remote product to test - either \
|
|
|
|
fennec or firefox, defaults to fennec",
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-03-24 14:42:24 -07:00
|
|
|
}],
|
|
|
|
[["--remote-logfile"],
|
|
|
|
{"dest": "remoteLogFile",
|
|
|
|
"default": None,
|
|
|
|
"help": "Name of log file on the device relative to the device \
|
|
|
|
root. PLEASE ONLY USE A FILENAME.",
|
|
|
|
}],
|
|
|
|
[["--remote-webserver"],
|
|
|
|
{"dest": "remoteWebServer",
|
|
|
|
"default": None,
|
|
|
|
"help": "ip address where the remote web server is hosted at",
|
|
|
|
}],
|
|
|
|
[["--http-port"],
|
|
|
|
{"dest": "httpPort",
|
|
|
|
"default": DEFAULT_PORTS['http'],
|
|
|
|
"help": "http port of the remote web server",
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-03-24 14:42:24 -07:00
|
|
|
}],
|
|
|
|
[["--ssl-port"],
|
|
|
|
{"dest": "sslPort",
|
|
|
|
"default": DEFAULT_PORTS['https'],
|
|
|
|
"help": "ssl port of the remote web server",
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-03-24 14:42:24 -07:00
|
|
|
}],
|
|
|
|
[["--robocop-ini"],
|
|
|
|
{"dest": "robocopIni",
|
|
|
|
"default": "",
|
|
|
|
"help": "name of the .ini file containing the list of tests to run",
|
|
|
|
}],
|
|
|
|
[["--robocop-apk"],
|
|
|
|
{"dest": "robocopApk",
|
|
|
|
"default": "",
|
|
|
|
"help": "name of the Robocop APK to use for ADB test running",
|
|
|
|
}],
|
|
|
|
[["--remoteTestRoot"],
|
|
|
|
{"dest": "remoteTestRoot",
|
|
|
|
"default": None,
|
|
|
|
"help": "remote directory to use as test root \
|
|
|
|
(eg. /mnt/sdcard/tests or /data/local/tests)",
|
2015-04-30 10:47:01 -07:00
|
|
|
"suppress": True,
|
2015-03-24 14:42:24 -07:00
|
|
|
}],
|
|
|
|
]
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
defaults = {
|
|
|
|
'dm': None,
|
2016-01-25 06:55:57 -08:00
|
|
|
# we don't want to exclude specialpowers on android just yet
|
|
|
|
'extensionsToExclude': [],
|
|
|
|
# mochijar doesn't get installed via marionette on android
|
|
|
|
'extensionsToInstall': [os.path.join(here, 'mochijar')],
|
2015-04-30 10:47:01 -07:00
|
|
|
'logFile': 'mochitest.log',
|
|
|
|
'utilityPath': None,
|
|
|
|
}
|
|
|
|
|
|
|
|
def validate(self, parser, options, context):
|
|
|
|
"""Validate android options."""
|
|
|
|
|
|
|
|
if build_obj:
|
|
|
|
options.log_mach = '-'
|
|
|
|
|
|
|
|
if options.dm_trans == "adb":
|
|
|
|
if options.deviceIP:
|
|
|
|
options.dm = DroidADB(
|
|
|
|
options.deviceIP,
|
|
|
|
options.devicePort,
|
|
|
|
deviceRoot=options.remoteTestRoot)
|
|
|
|
elif options.deviceSerial:
|
|
|
|
options.dm = DroidADB(
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
deviceSerial=options.deviceSerial,
|
|
|
|
deviceRoot=options.remoteTestRoot)
|
|
|
|
else:
|
|
|
|
options.dm = DroidADB(deviceRoot=options.remoteTestRoot)
|
|
|
|
elif options.dm_trans == 'sut':
|
|
|
|
if options.deviceIP is None:
|
|
|
|
parser.error(
|
|
|
|
"If --dm_trans = sut, you must provide a device IP")
|
2015-05-04 18:28:16 -07:00
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
options.dm = DroidSUT(
|
|
|
|
options.deviceIP,
|
|
|
|
options.devicePort,
|
|
|
|
deviceRoot=options.remoteTestRoot)
|
2015-03-24 14:42:24 -07:00
|
|
|
|
|
|
|
if not options.remoteTestRoot:
|
2015-04-30 10:47:01 -07:00
|
|
|
options.remoteTestRoot = options.dm.deviceRoot
|
2015-03-24 14:42:24 -07:00
|
|
|
|
|
|
|
if options.remoteWebServer is None:
|
|
|
|
if os.name != "nt":
|
|
|
|
options.remoteWebServer = moznetwork.get_ip()
|
|
|
|
else:
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
2015-03-24 14:42:24 -07:00
|
|
|
"you must specify a --remote-webserver=<ip address>")
|
|
|
|
|
|
|
|
options.webServer = options.remoteWebServer
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
if options.remoteLogFile is None:
|
2015-03-24 14:42:24 -07:00
|
|
|
options.remoteLogFile = options.remoteTestRoot + \
|
|
|
|
'/logs/mochitest.log'
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
if options.remoteLogFile.count('/') < 1:
|
2015-03-24 14:42:24 -07:00
|
|
|
options.remoteLogFile = options.remoteTestRoot + \
|
|
|
|
'/' + options.remoteLogFile
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
if options.remoteAppPath and options.app:
|
|
|
|
parser.error(
|
2015-03-24 14:42:24 -07:00
|
|
|
"You cannot specify both the remoteAppPath and the app setting")
|
2015-04-30 10:47:01 -07:00
|
|
|
elif options.remoteAppPath:
|
2015-03-24 14:42:24 -07:00
|
|
|
options.app = options.remoteTestRoot + "/" + options.remoteAppPath
|
2015-04-30 10:47:01 -07:00
|
|
|
elif options.app is None:
|
|
|
|
if build_obj:
|
|
|
|
options.app = build_obj.substs['ANDROID_PACKAGE_NAME']
|
|
|
|
else:
|
|
|
|
# Neither remoteAppPath nor app are set -- error
|
|
|
|
parser.error("You must specify either appPath or app")
|
|
|
|
|
|
|
|
if build_obj and 'MOZ_HOST_BIN' in os.environ:
|
|
|
|
options.xrePath = os.environ['MOZ_HOST_BIN']
|
2015-03-24 14:42:24 -07:00
|
|
|
|
|
|
|
# Only reset the xrePath if it wasn't provided
|
2015-04-30 10:47:01 -07:00
|
|
|
if options.xrePath is None:
|
2015-03-24 14:42:24 -07:00
|
|
|
options.xrePath = options.utilityPath
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
if options.pidFile != "":
|
2015-03-24 14:42:24 -07:00
|
|
|
f = open(options.pidFile, 'w')
|
|
|
|
f.write("%s" % os.getpid())
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
# Robocop specific options
|
|
|
|
if options.robocopIni != "":
|
|
|
|
if not os.path.exists(options.robocopIni):
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
2015-03-24 14:42:24 -07:00
|
|
|
"Unable to find specified robocop .ini manifest '%s'" %
|
|
|
|
options.robocopIni)
|
|
|
|
options.robocopIni = os.path.abspath(options.robocopIni)
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
if not options.robocopApk and build_obj:
|
2015-11-09 12:55:38 -08:00
|
|
|
options.robocopApk = os.path.join(build_obj.topobjdir, 'mobile', 'android',
|
|
|
|
'tests', 'browser',
|
2015-04-30 10:47:01 -07:00
|
|
|
'robocop', 'robocop-debug.apk')
|
|
|
|
|
2015-03-24 14:42:24 -07:00
|
|
|
if options.robocopApk != "":
|
|
|
|
if not os.path.exists(options.robocopApk):
|
2015-04-30 10:47:01 -07:00
|
|
|
parser.error(
|
2015-03-24 14:42:24 -07:00
|
|
|
"Unable to find robocop APK '%s'" %
|
|
|
|
options.robocopApk)
|
|
|
|
options.robocopApk = os.path.abspath(options.robocopApk)
|
|
|
|
|
|
|
|
# allow us to keep original application around for cleanup while
|
|
|
|
# running robocop via 'am'
|
|
|
|
options.remoteappname = options.app
|
|
|
|
return options
|
|
|
|
|
|
|
|
|
2015-04-30 10:47:01 -07:00
|
|
|
container_map = {
|
|
|
|
'generic': [MochitestArguments],
|
|
|
|
'b2g': [MochitestArguments, B2GArguments],
|
|
|
|
'android': [MochitestArguments, AndroidArguments],
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class MochitestArgumentParser(ArgumentParser):
|
2015-08-07 07:19:32 -07:00
|
|
|
"""%(prog)s [options] [test paths]"""
|
2015-04-30 10:47:01 -07:00
|
|
|
|
|
|
|
_containers = None
|
|
|
|
context = {}
|
|
|
|
|
|
|
|
def __init__(self, app=None, **kwargs):
|
|
|
|
ArgumentParser.__init__(self, usage=self.__doc__, conflict_handler='resolve', **kwargs)
|
|
|
|
|
|
|
|
self.oldcwd = os.getcwd()
|
|
|
|
self.app = app
|
|
|
|
if not self.app and build_obj:
|
|
|
|
if conditions.is_android(build_obj):
|
|
|
|
self.app = 'android'
|
2015-11-18 10:35:38 -08:00
|
|
|
elif conditions.is_b2g(build_obj):
|
2015-04-30 10:47:01 -07:00
|
|
|
self.app = 'b2g'
|
|
|
|
if not self.app:
|
|
|
|
# platform can't be determined and app wasn't specified explicitly,
|
|
|
|
# so just use generic arguments and hope for the best
|
|
|
|
self.app = 'generic'
|
|
|
|
|
|
|
|
if self.app not in container_map:
|
|
|
|
self.error("Unrecognized app '{}'! Must be one of: {}".format(
|
|
|
|
self.app, ', '.join(container_map.keys())))
|
|
|
|
|
|
|
|
defaults = {}
|
|
|
|
for container in self.containers:
|
|
|
|
defaults.update(container.defaults)
|
|
|
|
group = self.add_argument_group(container.__class__.__name__, container.__doc__)
|
|
|
|
|
|
|
|
for cli, kwargs in container.args:
|
|
|
|
# Allocate new lists so references to original don't get mutated.
|
|
|
|
# allowing multiple uses within a single process.
|
|
|
|
if "default" in kwargs and isinstance(kwargs['default'], list):
|
|
|
|
kwargs["default"] = []
|
|
|
|
|
|
|
|
if 'suppress' in kwargs:
|
|
|
|
if kwargs['suppress']:
|
|
|
|
kwargs['help'] = SUPPRESS
|
|
|
|
del kwargs['suppress']
|
|
|
|
|
|
|
|
group.add_argument(*cli, **kwargs)
|
|
|
|
|
|
|
|
self.set_defaults(**defaults)
|
2015-07-16 07:38:40 -07:00
|
|
|
mozlog.commandline.add_logging_group(self)
|
2015-04-30 10:47:01 -07:00
|
|
|
|
|
|
|
@property
|
|
|
|
def containers(self):
|
|
|
|
if self._containers:
|
|
|
|
return self._containers
|
|
|
|
|
|
|
|
containers = container_map[self.app]
|
|
|
|
self._containers = [c() for c in containers]
|
|
|
|
return self._containers
|
|
|
|
|
|
|
|
def validate(self, args):
|
|
|
|
for container in self.containers:
|
|
|
|
args = container.validate(self, args, self.context)
|
|
|
|
return args
|
|
|
|
|
|
|
|
def parse_args(self, *args, **kwargs):
|
|
|
|
return self.validate(ArgumentParser.parse_args(self, *args, **kwargs))
|
|
|
|
|
|
|
|
def parse_known_args(self, *args, **kwargs):
|
|
|
|
args, remainder = ArgumentParser.parse_known_args(self, *args, **kwargs)
|
|
|
|
return (self.validate(args), remainder)
|