Bug 1425317 - Hook geckodriver up to mach's test command. r?ahal
This removes the subcommands for "./mach geckodriver", reverting
it back to have the meaning of running the geckodriver binary.
The build- and test commands are now integrated with mach, which
means you can run "./mach build testing/geckodriver" and "./mach
test testing/geckodriver" to run tests. This is backed by a new
top-level "./mach geckodriver-test" command, which we will not be
announcing.
MozReview-Commit-ID: CiQsfNqrvIp
--- a/testing/geckodriver/CONTRIBUTING.md
+++ b/testing/geckodriver/CONTRIBUTING.md
@@ -119,22 +119,21 @@ Whilst geckodriver lives in the same sou
and is built in the [Firefox CI], is _is not_ built if you build
Firefox locally. To enable building of geckodriver locally, ensure
you put this in your [mozconfig]:
ac_add_options --enable-geckodriver
When you have, you are ready to start off your first build:
- % ./mach geckodriver build
+ % ./mach build testing/geckodriver
-The geckodriver executable will appear in `${objdir}/dist/bin/geckodriver`
-alongside firefox-bin. To run it you can use mach:
+To run the executable from the objdir:
- % ./mach geckodriver run -- --version
+ % ./mach geckodriver -- --version
0:00.27 /home/ato/src/gecko/obj-x86_64-pc-linux-gnu/dist/bin/geckodriver --version --binary /home/ato/src/gecko/obj-x86_64-pc-linux-gnu/dist/bin/firefox
geckodriver 0.19.0 (f3e939a81ee1169f9501ad96eb43bbf4bf4a1bde 2017-10-11)
[Rust]: https://www.rust-lang.org/
[webdriver crate]: ../webdriver/README.md
[commands]: https://docs.rs/webdriver/newest/webdriver/command/index.html
[responses]: https://docs.rs/webdriver/newest/webdriver/response/index.html
[errors]: https://docs.rs/webdriver/newest/webdriver/error/enum.ErrorStatus.html
@@ -150,19 +149,19 @@ Running the tests
We verify and test geckodriver in a couple of different ways.
Since it is an implementation of the WebDriver web standard, we share
a set of conformance tests with other browser vendors through the
[Web Platform Tests] (WPT) initiative. This lets us ensure web
compatibility between _different_ WebDriver implementations for
different browsers.
In addition to the WPT tests, geckodriver and webdriver have unit tests.
-You can also use the mach geckodriver command to run geckodriver tests:
+You can use a mach command to run them:
- % ./mach geckodriver test
+ % ./mach test testing/geckodriver
The webdriver crate tests are unfortunately not yet runnable through mach.
Work to make this possible is tracked in [[https://bugzil.la/1424369]].
For the moment you must run them manually through `cargo`:
% cd testing/webdriver
% cargo test
--- a/testing/geckodriver/README.md
+++ b/testing/geckodriver/README.md
@@ -570,24 +570,19 @@ and [errors] to the [Marionette protocol
[WebDriver] and [Marionette].
geckodriver is built in the [Firefox CI] by default but _not_ if you
build Firefox locally. To enable building of geckodriver locally,
ensure you put this in your [mozconfig]:
ac_add_options --enable-geckodriver
-The _geckodriver_ binary will appear in `${objdir}/dist/bin/geckodriver`
-alongside _firefox-bin_.
-
-The following self-explanatory targets are available through mach:
-
- * `./mach geckodriver build`
- * `./mach geckodriver test`
- * `./mach geckodriver run`
+You build geckodriver with the `./mach build testing/geckodriver`
+command, run tests with `./mach test testing/geckodriver`, and run
+the built executable with `./mach geckodriver -- --other --flags`.
[Rust]: https://www.rust-lang.org/
[Mozilla]: https://www.mozilla.org/en-US/
[webdriver crate]: https://github.com/mozilla/webdriver-rust
[commands]: https://docs.rs/webdriver/0.25.0/webdriver/command/index.html
[responses]: https://docs.rs/webdriver/0.25.0/webdriver/response/index.html
[errors]: https://docs.rs/webdriver/0.25.0/webdriver/error/enum.ErrorStatus.html
[Marionette protocol]: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/Protocol
--- a/testing/geckodriver/mach_commands.py
+++ b/testing/geckodriver/mach_commands.py
@@ -17,27 +17,21 @@ from mach.decorators import (
from mozbuild.base import (
MachCommandBase,
MachCommandConditions as conditions,
)
@CommandProvider
-class GeckoDriver(MachCommandBase):
+class GeckoDriover(MachCommandBase):
@Command("geckodriver",
category="post-build",
- description="WebDriver implementation for Gecko",
- conditions=[conditions.is_firefox])
- def geckodriver(self):
- pass
-
- @SubCommand("geckodriver", "run",
- description="Run geckodriver.")
+ description="Run the WebDriver implementation for Gecko.")
@CommandArgument("--binary", type=str,
help="Firefox binary (defaults to the local build).")
@CommandArgument("params", nargs="...",
help="Flags to be passed through to geckodriver.")
@CommandArgumentGroup("debugging")
@CommandArgument("--debug", action="store_true", group="debugging",
help="Enable the debugger. Not specifying a --debugger option will result in the default debugger being used.")
@CommandArgument("--debugger", default=None, type=str, group="debugging",
@@ -93,36 +87,26 @@ class GeckoDriver(MachCommandBase):
return 1
# Prepend the debugger args.
args = [self.debuggerInfo.path] + self.debuggerInfo.args + args
return self.run_process(args=args, ensure_exit_code=False,
pass_thru=True)
- @SubCommand("geckodriver", "build",
- description="Build geckodriver.")
- @CommandArgument("-v", "--verbose", action="store_true",
- help="Verbose output for what commands the build is running.")
- def build(self, verbose=False):
- from mozbuild.controller.building import BuildDriver
- self.log_manager.enable_all_structured_loggers()
+@CommandProvider
+class GeckoDriverTest(MachCommandBase):
- driver = self._spawn(BuildDriver)
- return driver.build(
- what=["testing/geckodriver"],
- verbose=verbose,
- mach_context=self._mach_context)
-
- @SubCommand("geckodriver", "test",
+ @Command("geckodriver-test",
+ category="post-build",
description="Run geckodriver unit tests.")
@CommandArgument("-v", "--verbose", action="store_true",
help="Verbose output for what commands the build is running.")
- def test(self, verbose=False):
+ def test(self, verbose=False, **kwargs):
from mozbuild.controller.building import BuildDriver
self.log_manager.enable_all_structured_loggers()
driver = self._spawn(BuildDriver)
return driver.build(
what=["testing/geckodriver/check"],
verbose=verbose,
--- a/testing/mozbase/moztest/moztest/resolve.py
+++ b/testing/mozbase/moztest/moztest/resolve.py
@@ -43,16 +43,22 @@ TEST_SUITES = {
'mach_command': 'firefox-ui-update',
'kwargs': {},
},
'check-spidermonkey': {
'aliases': ('Sm', 'sm'),
'mach_command': 'check-spidermonkey',
'kwargs': {'valgrind': False},
},
+ # TODO(ato): integrate geckodriver tests with moz.build
+ 'geckodriver': {
+ 'mach_command': 'geckodriver-test',
+ 'aliases': ('testing/geckodriver',),
+ 'kwargs': {},
+ },
'mochitest-a11y': {
'mach_command': 'mochitest',
'kwargs': {'flavor': 'a11y', 'test_paths': None},
},
'mochitest-browser': {
'aliases': ('bc', 'BC', 'Bc'),
'mach_command': 'mochitest',
'kwargs': {'flavor': 'browser-chrome', 'test_paths': None},
@@ -128,22 +134,22 @@ TEST_FLAVORS = {
'kwargs': {'flavor': 'mochitest', 'test_paths': []},
},
'python': {
'mach_command': 'python-test',
'kwargs': {},
},
'reftest': {
'mach_command': 'reftest',
- 'kwargs': {'tests': []}
+ 'kwargs': {'tests': []},
},
'steeplechase': {},
'web-platform-tests': {
'mach_command': 'web-platform-tests',
- 'kwargs': {'include': []}
+ 'kwargs': {'include': []},
},
'xpcshell': {
'mach_command': 'xpcshell-test',
'kwargs': {'test_paths': []},
},
}
for i in range(1, MOCHITEST_TOTAL_CHUNKS + 1):