Bug 1919778 - Flag EnumeratedArray variable from dom/media/ipc/RemoteDecoderManagerCh...
[gecko.git] / testing / web-platform / mach_commands_base.py
blob05271c1d7ee3cc8e05c254b4c8f28f0e13c03842
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 import sys
8 def create_parser_wpt():
9 from wptrunner import wptcommandline
11 result = wptcommandline.create_parser()
13 result.add_argument(
14 "--no-install",
15 action="store_true",
16 default=False,
17 help="Do not install test runner application",
19 return result
22 class WebPlatformTestsRunner(object):
23 """Run web platform tests."""
25 def __init__(self, setup):
26 self.setup = setup
28 def setup_logging(self, **kwargs):
29 from tools.wpt import run
31 return run.setup_logging(
32 kwargs,
33 {self.setup.default_log_type: sys.stdout},
34 formatter_defaults={"screenshot": True},
37 def run(self, logger, **kwargs):
38 from mozbuild.base import BinaryNotFoundException
39 from wptrunner import wptrunner
41 if kwargs["manifest_update"] is not False:
42 self.update_manifest(logger)
43 kwargs["manifest_update"] = False
45 if kwargs["product"] == "firefox":
46 try:
47 kwargs = self.setup.kwargs_firefox(kwargs)
48 except BinaryNotFoundException as e:
49 logger.error(e)
50 logger.info(e.help())
51 return 1
52 elif kwargs["product"] == "firefox_android":
53 kwargs = self.setup.kwargs_firefox_android(kwargs)
54 else:
55 kwargs = self.setup.kwargs_wptrun(kwargs)
57 result = wptrunner.start(**kwargs)
58 return int(result)
60 def update_manifest(self, logger, **kwargs):
61 import manifestupdate
63 return manifestupdate.run(
64 logger=logger,
65 src_root=self.setup.topsrcdir,
66 obj_root=self.setup.topobjdir,
67 **kwargs