diff --git a/build/mach_bootstrap.py b/build/mach_bootstrap.py index 7c9b796573d..4f7365ba2ea 100644 --- a/build/mach_bootstrap.py +++ b/build/mach_bootstrap.py @@ -66,19 +66,14 @@ SEARCH_PATHS = [ 'dom/bindings/parser', 'layout/tools/reftest', 'other-licenses/ply', - 'xpcom/idl-parser', 'testing', - 'testing/tools/autotry', - 'testing/taskcluster', - 'testing/xpcshell', - 'testing/web-platform', - 'testing/web-platform/harness', - 'testing/web-platform/tests/tools/wptserve', + 'testing/firefox-ui/harness', + 'testing/firefox-ui/tests', + 'testing/luciddream', 'testing/marionette/client', 'testing/marionette/client/marionette/runner/mixins/browsermob-proxy-py', 'testing/marionette/transport', 'testing/marionette/driver', - 'testing/luciddream', 'testing/mozbase/mozcrash', 'testing/mozbase/mozdebug', 'testing/mozbase/mozdevice', @@ -97,6 +92,13 @@ SEARCH_PATHS = [ 'testing/mozbase/moztest', 'testing/mozbase/mozversion', 'testing/mozbase/manifestparser', + 'testing/puppeteer/firefox', + 'testing/taskcluster', + 'testing/tools/autotry', + 'testing/web-platform', + 'testing/web-platform/harness', + 'testing/web-platform/tests/tools/wptserve', + 'testing/xpcshell', 'xpcom/idl-parser', ] @@ -115,14 +117,14 @@ MACH_MODULES = [ 'python/mozbuild/mozbuild/compilation/codecomplete.py', 'python/mozbuild/mozbuild/frontend/mach_commands.py', 'services/common/tests/mach_commands.py', + 'testing/firefox-ui/mach_commands.py', 'testing/luciddream/mach_commands.py', 'testing/mach_commands.py', - 'testing/taskcluster/mach_commands.py', 'testing/marionette/mach_commands.py', 'testing/mochitest/mach_commands.py', 'testing/mozharness/mach_commands.py', - 'testing/xpcshell/mach_commands.py', 'testing/talos/mach_commands.py', + 'testing/taskcluster/mach_commands.py', 'testing/web-platform/mach_commands.py', 'testing/xpcshell/mach_commands.py', 'tools/docs/mach_commands.py', diff --git a/testing/firefox-ui/mach_commands.py b/testing/firefox-ui/mach_commands.py new file mode 100644 index 00000000000..efd19e83e60 --- /dev/null +++ b/testing/firefox-ui/mach_commands.py @@ -0,0 +1,68 @@ +# 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 absolute_import, unicode_literals + +import os +import sys + +from mozbuild.base import ( + MachCommandBase, + MachCommandConditions as conditions, +) + +from mach.decorators import ( + CommandProvider, + Command, +) + + +def setup_argument_parser(): + from firefox_ui_harness.arguments.base import FirefoxUIArguments + return FirefoxUIArguments() + + +def run_firefox_ui_test(tests, testtype=None, + binary=None, topsrcdir=None, **kwargs): + from mozlog.structured import commandline + from firefox_ui_harness import cli_functional + from firefox_ui_harness.arguments import FirefoxUIArguments + + parser = FirefoxUIArguments() + commandline.add_logging_group(parser) + args = parser.parse_args() + + if not tests: + tests = [os.path.join(topsrcdir, + 'testing/firefox-ui/tests/firefox_ui_tests/manifest.ini')] + args.tests = tests + + args.binary = binary + path, exe = os.path.split(args.binary) + + for k, v in kwargs.iteritems(): + setattr(args, k, v) + + parser.verify_usage(args) + + args.logger = commandline.setup_logging("Firefox UI - Functional Tests", + args, + {"mach": sys.stdout}) + failed = cli_functional.mn_cli(cli_functional.FirefoxUITestRunner, args=args) + if failed > 0: + return 1 + else: + return 0 + + +@CommandProvider +class MachCommands(MachCommandBase): + @Command('firefox-ui-test', category='testing', + description='Run Firefox UI functional tests.', + conditions=[conditions.is_firefox], + parser=setup_argument_parser, + ) + def run_firefox_ui_test(self, tests, **kwargs): + kwargs['binary'] = self.get_binary_path('app') + return run_firefox_ui_test(tests, topsrcdir=self.topsrcdir, **kwargs) diff --git a/testing/marionette/client/marionette/runtests.py b/testing/marionette/client/marionette/runtests.py index c9b7877b2bd..a498c3ec75d 100644 --- a/testing/marionette/client/marionette/runtests.py +++ b/testing/marionette/client/marionette/runtests.py @@ -77,7 +77,7 @@ class MarionetteHarness(object): def cli(runner_class=MarionetteTestRunner, parser_class=MarionetteArguments, - harness_class=MarionetteHarness): + harness_class=MarionetteHarness, args=None): """ Call the harness to parse args and run tests. @@ -88,7 +88,7 @@ def cli(runner_class=MarionetteTestRunner, parser_class=MarionetteArguments, """ logger = mozlog.commandline.setup_logging('Marionette test runner', {}) try: - failed = harness_class(runner_class, parser_class).run() + failed = harness_class(runner_class, parser_class, args=args).run() if failed > 0: sys.exit(10) except Exception: