2017-06-19 21:20:41 +03:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2018-12-05 00:53:27 +03:00
|
|
|
import os
|
2017-06-19 21:20:41 +03:00
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
def create_parser_wpt():
|
|
|
|
from wptrunner import wptcommandline
|
2019-07-09 21:10:03 +03:00
|
|
|
return wptcommandline.create_parser(["firefox", "firefox_android", "chrome", "edge", "servo"])
|
2017-06-19 21:20:41 +03:00
|
|
|
|
|
|
|
|
|
|
|
class WebPlatformTestsRunner(object):
|
|
|
|
"""Run web platform tests."""
|
|
|
|
|
|
|
|
def __init__(self, setup):
|
|
|
|
self.setup = setup
|
|
|
|
|
2018-09-29 17:51:44 +03:00
|
|
|
def setup_logging(self, **kwargs):
|
2018-12-05 00:53:27 +03:00
|
|
|
from tools.wpt import run
|
|
|
|
return run.setup_logging(kwargs, {self.setup.default_log_type: sys.stdout})
|
2018-09-29 17:51:44 +03:00
|
|
|
|
|
|
|
def run(self, logger, **kwargs):
|
2017-06-19 21:20:41 +03:00
|
|
|
from wptrunner import wptrunner
|
2018-10-02 18:46:42 +03:00
|
|
|
|
|
|
|
if kwargs["manifest_update"] is not False:
|
|
|
|
self.update_manifest(logger)
|
|
|
|
kwargs["manifest_update"] = False
|
|
|
|
|
2017-06-19 21:20:41 +03:00
|
|
|
if kwargs["product"] in ["firefox", None]:
|
2017-08-16 17:42:30 +03:00
|
|
|
kwargs = self.setup.kwargs_firefox(kwargs)
|
2019-07-09 21:10:03 +03:00
|
|
|
elif kwargs["product"] == "firefox_android":
|
2018-06-15 19:30:58 +03:00
|
|
|
from wptrunner import wptcommandline
|
|
|
|
kwargs = wptcommandline.check_args(self.setup.kwargs_common(kwargs))
|
2017-06-19 21:20:41 +03:00
|
|
|
elif kwargs["product"] in ("chrome", "edge", "servo"):
|
2017-08-16 17:42:30 +03:00
|
|
|
kwargs = self.setup.kwargs_wptrun(kwargs)
|
2017-06-19 21:20:41 +03:00
|
|
|
else:
|
|
|
|
raise ValueError("Unknown product %s" % kwargs["product"])
|
|
|
|
result = wptrunner.start(**kwargs)
|
2019-09-09 17:48:21 +03:00
|
|
|
return int(result)
|
2018-10-02 18:46:42 +03:00
|
|
|
|
|
|
|
def update_manifest(self, logger, **kwargs):
|
|
|
|
import manifestupdate
|
|
|
|
return manifestupdate.run(logger=logger,
|
|
|
|
src_root=self.setup.topsrcdir,
|
|
|
|
obj_root=self.setup.topobjdir,
|
|
|
|
**kwargs)
|