Bug 1301473 - Add a wpt-manifest-update command, r=Ms2ger
authorJames Graham <james@hoppipolla.co.uk>
Mon, 12 Sep 2016 15:06:32 +0100
changeset 313818 b2166c12cbbe850f8f903e40ffa1f85efc5d8bdd
parent 313817 99183448b819dc701ea6c314b937ae38160c5ca4
child 313819 f909c2ba941de08569849f4ad453d1ba000c207d
push id30698
push usercbook@mozilla.com
push dateWed, 14 Sep 2016 10:07:43 +0000
treeherdermozilla-central@501e27643a52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs1301473
milestone51.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
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
testing/web-platform/README.md
testing/web-platform/mach_commands.py
--- 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()