Bug 1543073 - Add mach wpt-serve for running the wpt server, r=ahal
authorJames Graham <james@hoppipolla.co.uk>
Thu, 11 Apr 2019 16:47:58 +0000
changeset 469267 6b039311ee97a426700db0d7dd96e5d6b0c36ed0
parent 469266 2e0165dcfdb1c104551d75c5ff4833cd064e6405
child 469268 7a209bab1bfe826dc163bedcf78493f0a8098ac2
push id112776
push usershindli@mozilla.com
push dateFri, 12 Apr 2019 16:20:17 +0000
treeherdermozilla-inbound@b4501ced5619 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1543073
milestone68.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 1543073 - Add mach wpt-serve for running the wpt server, r=ahal Differential Revision: https://phabricator.services.mozilla.com/D26705
testing/web-platform/mach_commands.py
--- a/testing/web-platform/mach_commands.py
+++ b/testing/web-platform/mach_commands.py
@@ -191,17 +191,16 @@ class WebPlatformTestsUpdater(MozbuildOb
             update.run_update(logger, **kwargs)
         except Exception:
             import pdb
             import traceback
             traceback.print_exc()
 #            pdb.post_mortem()
 
 
-
 def create_parser_update():
     from update import updatecommandline
     return updatecommandline.create_parser()
 
 
 def create_parser_create():
     import argparse
     p = argparse.ArgumentParser()
@@ -228,16 +227,23 @@ def create_parser_manifest_update():
     return manifestupdate.create_parser()
 
 
 def create_parser_metadata_summary():
     import metasummary
     return metasummary.create_parser()
 
 
+def create_parser_serve():
+    sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),
+                                                    "tests", "tools")))
+    import serve
+    return serve.serve.get_parser()
+
+
 @CommandProvider
 class MachCommands(MachCommandBase):
     def setup(self):
         self._activate_virtualenv()
 
     @Command("web-platform-tests",
              category="testing",
              conditions=[conditions.is_firefox_or_android],
@@ -298,18 +304,32 @@ class MachCommands(MachCommandBase):
              category="testing",
              description="Update web-platform-test manifests.",
              parser=create_parser_manifest_update)
     def wpt_manifest_update(self, **params):
         self.setup()
         wpt_setup = self._spawn(WebPlatformTestsRunnerSetup)
         wpt_runner = WebPlatformTestsRunner(wpt_setup)
         logger = wpt_runner.setup_logging(**params)
+        logger.warning("The wpt manifest is now automatically updated, "
+                       "so running this command is usually unnecessary")
         return 0 if wpt_runner.update_manifest(logger, **params) else 1
 
+    @Command("wpt-serve",
+             category="testing",
+             description="Run the wpt server",
+             parser=create_parser_serve)
+    def wpt_manifest_serve(self, **params):
+        self.setup()
+        import logging
+        logger = logging.getLogger("web-platform-tests")
+        logger.addHandler(logging.StreamHandler(sys.stdout))
+        import serve
+        return 0 if serve.serve.run(**params) else 1
+
     @Command("wpt-metadata-summary",
              category="testing",
              description="Create a json summary of the wpt metadata",
              parser=create_parser_metadata_summary)
     def wpt_summary(self, **params):
         import metasummary
         wpt_setup = self._spawn(WebPlatformTestsRunnerSetup)
         return metasummary.run(wpt_setup.topsrcdir, wpt_setup.topobjdir, **params)