author | Andrew Halberstadt <ahalberstadt@mozilla.com> |
Wed, 13 Jul 2016 10:57:22 -0400 | |
changeset 304959 | 683bf5d3c1cdd76799d7da01d3a0cd2dbb42e8f9 |
parent 304958 | 3e6f9e3a99a1419bed34c396c0e30eb67f870a1e |
child 304960 | 82ae790de9889e8531cbc4d82b76259a1fd8d14d |
child 305002 | 676b7df970b6b2f9432e421f9151e80346ee42ab |
push id | 30603 |
push user | ahalberstadt@mozilla.com |
push date | Thu, 14 Jul 2016 15:53:42 +0000 |
treeherder | autoland@683bf5d3c1cd [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | armenzg |
bugs | 1278890 |
milestone | 50.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
new file mode 100644 --- /dev/null +++ b/layout/tools/reftest/mach_test_package_commands.py @@ -0,0 +1,53 @@ +# 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/. + +from __future__ import unicode_literals + +import os +from functools import partial + +from mach.decorators import ( + CommandProvider, + Command, +) + + +def run_reftest(context, **kwargs): + kwargs['certPath'] = context.certs_dir + kwargs['utilityPath'] = context.bin_dir + kwargs['extraProfileFiles'].append(os.path.join(context.bin_dir, 'plugins')) + + if not kwargs['app']: + # This could still return None in which case --appname must be used + # to specify the firefox binary. + kwargs['app'] = context.find_firefox() + + if not kwargs['tests']: + kwargs['tests'] = [os.path.join('layout', 'reftests', 'reftest.list')] + + test_root = os.path.join(context.package_root, 'reftest', 'tests') + normalize = partial(context.normalize_test_path, test_root) + kwargs['tests'] = map(normalize, kwargs['tests']) + + from runreftest import run as run_test_harness + return run_test_harness(**kwargs) + + +def setup_argument_parser(): + from reftestcommandline import DesktopArgumentsParser + return DesktopArgumentsParser() + + +@CommandProvider +class ReftestCommands(object): + + def __init__(self, context): + self.context = context + + @Command('reftest', category='testing', + description='Run the reftest harness.', + parser=setup_argument_parser) + def reftest(self, **kwargs): + kwargs['suite'] = 'reftest' + return run_reftest(self.context, **kwargs)
--- a/layout/tools/reftest/moz.build +++ b/layout/tools/reftest/moz.build @@ -17,16 +17,17 @@ GENERATED_FILES += ['automation.py'] TEST_HARNESS_FILES.reftest += [ '!automation.py', '/build/mobile/b2gautomation.py', '/build/mobile/remoteautomation.py', '/build/pgo/server-locations.txt', '/testing/mochitest/server.js', 'b2g_start_script.js', 'gaia_lock_screen.js', + 'mach_test_package_commands.py', 'output.py', 'reftest-preferences.js', 'reftestcommandline.py', 'remotereftest.py', 'runreftest.py', 'runreftestb2g.py', 'runreftestmulet.py', ]
--- a/layout/tools/reftest/reftestcommandline.py +++ b/layout/tools/reftest/reftestcommandline.py @@ -367,28 +367,16 @@ class DesktopArgumentsParser(ReftestArgu if options.app is None: bin_dir = (self.build_obj.get_binary_path() if self.build_obj and self.build_obj.substs[ 'MOZ_BUILD_APP'] != 'mobile/android' else None) if bin_dir: options.app = bin_dir - else: - self.error( - "could not find the application path, --appname must be specified") - - options.app = reftest.getFullPath(options.app) - if not os.path.exists(options.app): - self.error("""Error: Path %(app)s doesn't exist. - Are you executing $objdir/_tests/reftest/runreftest.py?""" - % {"app": options.app}) - - if options.xrePath is None: - options.xrePath = os.path.dirname(options.app) if options.symbolsPath and len(urlparse(options.symbolsPath).scheme) < 2: options.symbolsPath = reftest.getFullPath(options.symbolsPath) options.utilityPath = reftest.getFullPath(options.utilityPath) class B2GArgumentParser(ReftestArgumentsParser):
--- a/layout/tools/reftest/runreftest.py +++ b/layout/tools/reftest/runreftest.py @@ -32,18 +32,21 @@ import mozprocess import mozprofile import mozrunner from mozrunner.utils import get_stack_fixer_function, test_environment from mozscreenshot import printstatus, dump_screen try: from marionette import Marionette from marionette_driver.addons import Addons -except ImportError: - Marionette=None +except ImportError, e: + # Defer ImportError until attempt to use Marionette + def reraise(*args, **kwargs): + raise(e) + Marionette = reraise from output import OutputHandler, ReftestFormatter import reftestcommandline here = os.path.abspath(os.path.dirname(__file__)) try: from mozbuild.base import MozbuildObject @@ -720,13 +723,27 @@ def run(**kwargs): if 'tests' in kwargs: options = parser.parse_args(kwargs["tests"]) else: options = parser.parse_args() reftest = RefTest() parser.validate(options, reftest) + # We have to validate options.app here for the case when the mach + # command is able to find it after argument parsing. This can happen + # when running from a tests.zip. + if not options.app: + parser.error("could not find the application path, --appname must be specified") + + options.app = reftest.getFullPath(options.app) + if not os.path.exists(options.app): + parser.error("Error: Path %(app)s doesn't exist. Are you executing " + "$objdir/_tests/reftest/runreftest.py?" % {"app": options.app}) + + if options.xrePath is None: + options.xrePath = os.path.dirname(options.app) + return reftest.runTests(options.tests, options) if __name__ == "__main__": sys.exit(run())
--- a/testing/tools/mach_test_package_bootstrap.py +++ b/testing/tools/mach_test_package_bootstrap.py @@ -29,24 +29,26 @@ SEARCH_PATHS = [ 'mozbase/moznetwork', 'mozbase/mozprocess', 'mozbase/mozprofile', 'mozbase/mozrunner', 'mozbase/mozscreenshot', 'mozbase/mozsystemmonitor', 'mozbase/moztest', 'mozbase/mozversion', + 'reftest', 'tools/mach', 'tools/wptserve', 'xpcshell', ] # Individual files providing mach commands. MACH_MODULES = [ 'mochitest/mach_test_package_commands.py', + 'reftest/mach_test_package_commands.py', 'tools/mach/mach/commands/commandinfo.py', 'xpcshell/mach_test_package_commands.py', ] CATEGORIES = { 'testing': { 'short': 'Testing',