Bug 1700051: part 50) Add `aRange` to `mozInlineSpellStatus`'s constructor. r=smaug
[gecko.git] / testing / web-platform / mach_commands_base.py
blob24fb41fd8b165ff84f85b5ff25f94d884e1e06a8
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(
12 ["firefox", "firefox_android", "chrome", "edge", "servo"]
14 result.add_argument(
15 "--no-install",
16 action="store_true",
17 default=False,
18 help="Do not install test runner application",
20 return result
23 class WebPlatformTestsRunner(object):
24 """Run web platform tests."""
26 def __init__(self, setup):
27 self.setup = setup
29 def setup_logging(self, **kwargs):
30 from tools.wpt import run
32 return run.setup_logging(
33 kwargs,
34 {self.setup.default_log_type: sys.stdout},
35 formatter_defaults={"screenshot": True},
38 def run(self, logger, **kwargs):
39 from wptrunner import wptrunner
40 from mozbuild.base import BinaryNotFoundException
42 if kwargs["manifest_update"] is not False:
43 self.update_manifest(logger)
44 kwargs["manifest_update"] = False
46 if kwargs["product"] == "firefox":
47 try:
48 kwargs = self.setup.kwargs_firefox(kwargs)
49 except BinaryNotFoundException as e:
50 logger.error(e)
51 logger.info(e.help())
52 return 1
53 elif kwargs["product"] == "firefox_android":
54 from wptrunner import wptcommandline
56 kwargs = wptcommandline.check_args(self.setup.kwargs_common(kwargs))
57 elif kwargs["product"] in ("chrome", "edge", "servo"):
58 kwargs = self.setup.kwargs_wptrun(kwargs)
59 else:
60 raise ValueError("Unknown product %s" % kwargs["product"])
61 result = wptrunner.start(**kwargs)
62 return int(result)
64 def update_manifest(self, logger, **kwargs):
65 import manifestupdate
67 return manifestupdate.run(
68 logger=logger,
69 src_root=self.setup.topsrcdir,
70 obj_root=self.setup.topobjdir,
71 **kwargs