Backed out 4 changesets (bug 1522790) - backout the remaining changesets. CLOSED...
[gecko.git] / testing / web-platform / mach_test_package_commands.py
blob99cdf82e6333c70dc502873946b65c96cce89f26
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 os
6 import sys
8 from mach.decorators import Command
9 from mach_commands_base import WebPlatformTestsRunner, create_parser_wpt
12 class WebPlatformTestsRunnerSetup(object):
13 default_log_type = "tbpl"
15 def __init__(self, context):
16 self.context = context
18 def kwargs_firefox(self, kwargs):
19 from wptrunner import wptcommandline
21 if kwargs["config"] is None:
22 kwargs["config"] = os.path.join(
23 self.context.package_root, "web-platform", "wptrunner.ini"
25 if kwargs["binary"] is None:
26 kwargs["binary"] = self.context.firefox_bin
27 if kwargs["prefs_root"] is None:
28 kwargs["prefs_root"] = os.path.join(
29 self.context.package_root, "web-platform", "prefs"
31 if kwargs["certutil_binary"] is None:
32 kwargs["certutil_binary"] = os.path.join(self.context.bin_dir, "certutil")
33 if kwargs["stackfix_dir"] is None:
34 kwargs["stackfix_dir"] = self.context.bin_dir
35 if kwargs["ssl_type"] in (None, "pregenerated"):
36 cert_root = os.path.join(
37 self.context.package_root, "web-platform", "tests", "tools", "certs"
39 if kwargs["ca_cert_path"] is None:
40 kwargs["ca_cert_path"] = os.path.join(cert_root, "cacert.pem")
41 if kwargs["host_key_path"] is None:
42 kwargs["host_key_path"] = os.path.join(
43 cert_root, "web-platform.test.key"
45 if kwargs["host_cert_path"] is None:
46 kwargs["host_cert_path"] = os.path.join(
47 cert_root, "web-platform.test.pem"
49 kwargs["capture_stdio"] = True
51 if (
52 kwargs["exclude"] is None
53 and kwargs["include"] is None
54 and not sys.platform.startswith("linux")
56 kwargs["exclude"] = ["css"]
58 if kwargs["webdriver_binary"] is None:
59 kwargs["webdriver_binary"] = os.path.join(
60 self.context.bin_dir, "geckodriver"
63 return wptcommandline.check_args(kwargs)
65 def kwargs_wptrun(self, kwargs):
66 raise NotImplementedError
69 @Command("web-platform-tests", category="testing", parser=create_parser_wpt)
70 def run_web_platform_tests(command_context, **kwargs):
71 command_context._mach_context.activate_mozharness_venv()
72 return WebPlatformTestsRunner(
73 WebPlatformTestsRunnerSetup(command_context._mach_context)
74 ).run(**kwargs)
77 @Command("wpt", category="testing", parser=create_parser_wpt)
78 def run_wpt(command_context, **params):
79 return command_context.run_web_platform_tests(**params)