Backed out 10 changesets (bug 1803810) for xpcshell failures on test_import_global...
[gecko.git] / testing / web-platform / mach_commands_base.py
blob8935e1638a77fa52fbdf323f8797001f171b1600
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 from wptrunner import wptcommandline
55 kwargs = wptcommandline.check_args(self.setup.kwargs_common(kwargs))
56 else:
57 kwargs = self.setup.kwargs_wptrun(kwargs)
59 result = wptrunner.start(**kwargs)
60 return int(result)
62 def update_manifest(self, logger, **kwargs):
63 import manifestupdate
65 return manifestupdate.run(
66 logger=logger,
67 src_root=self.setup.topsrcdir,
68 obj_root=self.setup.topobjdir,
69 **kwargs