Bug 1301473 - Add a wpt-manifest-update command, r=Ms2ger
This updates the manifest without loading any of the test-running
infrastructure, or requiring a build.
MozReview-Commit-ID: HJko5gUB3ov
--- a/testing/web-platform/README.md
+++ b/testing/web-platform/README.md
@@ -35,17 +35,18 @@ FAQ
behaviour even if we don't yet pass, get proper review, and have a
commit message that makes sense outside of the Mozilla
context. If you are writing tests that should not be upstreamed yet
for some reason they must be located under
`testing/web-platform/mozilla/tests`.
It is important to note that in order for the tests to run the
manifest file must be updated; this should not be done by hand, but
- by running `mach web-platform-tests --manifest-update`.
+ by running `mach wpt-manifest-update` (or `mach web-platform-tests
+ --manifest-update`, if you also wish to run some tests).
`mach web-platform-tests-create <path>` is a helper script designed
to help create new web-platform-tests. It opens a locally configured
editor at `<path>` with web-platform-tests boilerplate filled in,
and in the background runs `mach web-platform-tests
--manifest-update <path>`, so the test being developed is added to
the manifest and opened for interactive development.
--- a/testing/web-platform/mach_commands.py
+++ b/testing/web-platform/mach_commands.py
@@ -231,16 +231,37 @@ testing/web-platform/tests for tests tha
p = create_parser_wpt()
wpt_kwargs = vars(p.parse_args(["--manifest-update", path]))
context.commands.dispatch("web-platform-tests", context, **wpt_kwargs)
if proc:
proc.wait()
+class WPTManifestUpdater(MozbuildObject):
+ def run_update(self):
+ import imp
+ from wptrunner import wptlogging
+ from wptrunner.wptcommandline import get_test_paths, set_from_config
+ from wptrunner.testloader import ManifestLoader
+
+ wpt_dir = os.path.abspath(os.path.join(self.topsrcdir, 'testing', 'web-platform'))
+
+ localpaths = imp.load_source("localpaths",
+ os.path.join(wpt_dir, "tests", "tools", "localpaths.py"))
+ kwargs = {"config": os.path.join(wpt_dir, "wptrunner.ini"),
+ "tests_root": None,
+ "metadata_root": None}
+
+ wptlogging.setup({}, {"mach": sys.stdout})
+ set_from_config(kwargs)
+ test_paths = get_test_paths(kwargs["config"])
+ ManifestLoader(test_paths, force_manifest_update=True).load()
+
+
def create_parser_wpt():
from wptrunner import wptcommandline
return wptcommandline.create_parser(["firefox"])
def create_parser_update():
from update import updatecommandline
return updatecommandline.create_parser()
@@ -317,8 +338,15 @@ class MachCommands(MachCommandBase):
@Command("web-platform-tests-create",
category="testing",
conditions=[conditions.is_firefox],
parser=create_parser_create)
def create_web_platform_test(self, **params):
self.setup()
wpt_creator = self._spawn(WebPlatformTestsCreator)
wpt_creator.run_create(self._mach_context, **params)
+
+ @Command("wpt-manifest-update",
+ category="testing")
+ def wpt_manifest_update(self, **parms):
+ self.setup()
+ wpt_manifest_updater = self._spawn(WPTManifestUpdater)
+ wpt_manifest_updater.run_update()