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/.
8 def create_parser_wpt():
9 from wptrunner
import wptcommandline
11 result
= wptcommandline
.create_parser(
12 ["firefox", "firefox_android", "chrome", "edge", "servo"]
18 help="Do not install test runner application",
23 class WebPlatformTestsRunner(object):
24 """Run web platform tests."""
26 def __init__(self
, setup
):
29 def setup_logging(self
, **kwargs
):
30 from tools
.wpt
import run
32 return run
.setup_logging(
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":
48 kwargs
= self
.setup
.kwargs_firefox(kwargs
)
49 except BinaryNotFoundException
as e
:
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
)
60 raise ValueError("Unknown product %s" % kwargs
["product"])
61 result
= wptrunner
.start(**kwargs
)
64 def update_manifest(self
, logger
, **kwargs
):
67 return manifestupdate
.run(
69 src_root
=self
.setup
.topsrcdir
,
70 obj_root
=self
.setup
.topobjdir
,