2014-09-04 15:52:43 +04: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/.
|
|
|
|
|
|
|
|
# Integrates the web-platform-tests test runner with mach.
|
|
|
|
|
2015-06-22 03:39:09 +03:00
|
|
|
from __future__ import absolute_import, unicode_literals, print_function
|
2014-09-04 15:52:43 +04:00
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from mozbuild.base import (
|
|
|
|
MachCommandBase,
|
|
|
|
MachCommandConditions as conditions,
|
|
|
|
MozbuildObject,
|
|
|
|
)
|
|
|
|
|
|
|
|
from mach.decorators import (
|
|
|
|
CommandProvider,
|
|
|
|
Command,
|
|
|
|
)
|
|
|
|
|
2017-06-19 21:20:41 +03:00
|
|
|
from mach_commands_base import WebPlatformTestsRunner, create_parser_wpt
|
2014-09-04 15:52:43 +04:00
|
|
|
|
|
|
|
|
2017-06-19 21:20:41 +03:00
|
|
|
class WebPlatformTestsRunnerSetup(MozbuildObject):
|
|
|
|
default_log_type = "mach"
|
|
|
|
|
2018-12-05 00:53:27 +03:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(WebPlatformTestsRunnerSetup, self).__init__(*args, **kwargs)
|
|
|
|
self._here = os.path.join(self.topsrcdir, 'testing', 'web-platform')
|
|
|
|
kwargs["tests_root"] = os.path.join(self._here, "tests")
|
|
|
|
sys.path.insert(0, kwargs["tests_root"])
|
2014-09-04 15:52:43 +04:00
|
|
|
build_path = os.path.join(self.topobjdir, 'build')
|
|
|
|
if build_path not in sys.path:
|
|
|
|
sys.path.append(build_path)
|
|
|
|
|
2018-12-05 00:53:27 +03:00
|
|
|
def kwargs_common(self, kwargs):
|
|
|
|
tests_src_path = os.path.join(self._here, "tests")
|
2019-07-09 21:10:03 +03:00
|
|
|
if kwargs["product"] == "firefox_android":
|
|
|
|
# package_name may be different in the future
|
2018-10-12 01:07:45 +03:00
|
|
|
package_name = kwargs["package_name"]
|
|
|
|
if not package_name:
|
2019-06-26 05:34:49 +03:00
|
|
|
kwargs["package_name"] = package_name = "org.mozilla.geckoview.test"
|
2018-10-12 01:07:45 +03:00
|
|
|
|
2019-07-09 21:10:03 +03:00
|
|
|
# Note that this import may fail in non-firefox-for-android trees
|
2019-11-26 01:17:59 +03:00
|
|
|
from mozrunner.devices.android_device import (verify_android_device, InstallIntent)
|
|
|
|
verify_android_device(self, install=InstallIntent.PROMPT, verbose=False, xre=True, app=package_name)
|
2018-11-19 18:28:15 +03:00
|
|
|
|
2018-10-11 02:49:35 +03:00
|
|
|
if kwargs["certutil_binary"] is None:
|
|
|
|
kwargs["certutil_binary"] = os.path.join(os.environ.get('MOZ_HOST_BIN'), "certutil")
|
|
|
|
|
2018-11-15 23:41:18 +03:00
|
|
|
if kwargs["install_fonts"] is None:
|
|
|
|
kwargs["install_fonts"] = True
|
|
|
|
|
2014-09-04 15:52:43 +04:00
|
|
|
if kwargs["config"] is None:
|
2018-09-20 15:07:58 +03:00
|
|
|
kwargs["config"] = os.path.join(self.topobjdir, '_tests', 'web-platform', 'wptrunner.local.ini')
|
2014-09-04 15:52:43 +04:00
|
|
|
|
|
|
|
if kwargs["prefs_root"] is None:
|
2018-07-20 15:29:05 +03:00
|
|
|
kwargs["prefs_root"] = os.path.join(self.topsrcdir, 'testing', 'profiles')
|
2014-09-04 15:52:43 +04:00
|
|
|
|
2016-11-11 21:09:22 +03:00
|
|
|
if kwargs["stackfix_dir"] is None:
|
2017-09-14 14:07:23 +03:00
|
|
|
kwargs["stackfix_dir"] = self.bindir
|
2016-11-11 21:09:22 +03:00
|
|
|
|
2017-06-28 21:34:19 +03:00
|
|
|
if kwargs["exclude"] is None and kwargs["include"] is None and not sys.platform.startswith("linux"):
|
|
|
|
kwargs["exclude"] = ["css"]
|
|
|
|
|
2015-01-10 13:42:44 +03:00
|
|
|
if kwargs["ssl_type"] in (None, "pregenerated"):
|
2018-07-20 15:29:05 +03:00
|
|
|
cert_root = os.path.join(tests_src_path, "tools", "certs")
|
2015-01-10 13:42:44 +03:00
|
|
|
if kwargs["ca_cert_path"] is None:
|
2018-07-20 15:29:05 +03:00
|
|
|
kwargs["ca_cert_path"] = os.path.join(cert_root, "cacert.pem")
|
2015-01-10 13:42:44 +03:00
|
|
|
|
|
|
|
if kwargs["host_key_path"] is None:
|
2018-07-20 15:29:05 +03:00
|
|
|
kwargs["host_key_path"] = os.path.join(cert_root, "web-platform.test.key")
|
2015-01-10 13:42:44 +03:00
|
|
|
|
|
|
|
if kwargs["host_cert_path"] is None:
|
2018-07-20 15:29:05 +03:00
|
|
|
kwargs["host_cert_path"] = os.path.join(cert_root, "web-platform.test.pem")
|
2015-01-10 13:42:44 +03:00
|
|
|
|
2019-01-18 17:21:56 +03:00
|
|
|
if kwargs["reftest_screenshot"] is None:
|
|
|
|
kwargs["reftest_screenshot"] = "fail"
|
|
|
|
|
2014-09-04 15:52:43 +04:00
|
|
|
kwargs["capture_stdio"] = True
|
|
|
|
|
2018-06-15 19:30:58 +03:00
|
|
|
return kwargs
|
|
|
|
|
|
|
|
def kwargs_firefox(self, kwargs):
|
2018-10-18 16:44:36 +03:00
|
|
|
import mozinfo
|
2018-06-15 19:30:58 +03:00
|
|
|
from wptrunner import wptcommandline
|
|
|
|
kwargs = self.kwargs_common(kwargs)
|
|
|
|
|
|
|
|
if kwargs["binary"] is None:
|
|
|
|
kwargs["binary"] = self.get_binary_path()
|
|
|
|
|
|
|
|
if kwargs["certutil_binary"] is None:
|
|
|
|
kwargs["certutil_binary"] = self.get_binary_path('certutil')
|
|
|
|
|
2017-06-05 13:30:59 +03:00
|
|
|
if kwargs["webdriver_binary"] is None:
|
2017-06-08 20:15:31 +03:00
|
|
|
kwargs["webdriver_binary"] = self.get_binary_path("geckodriver", validate_exists=False)
|
2017-06-05 13:30:59 +03:00
|
|
|
|
2018-10-18 16:44:36 +03:00
|
|
|
|
|
|
|
if mozinfo.info["os"] == "win" and mozinfo.info["os_version"] == "6.1":
|
|
|
|
# On Windows 7 --install-fonts fails, so fall back to a Firefox-specific codepath
|
|
|
|
self.setup_fonts_firefox()
|
|
|
|
else:
|
|
|
|
kwargs["install_fonts"] = True
|
2017-06-01 17:20:11 +03:00
|
|
|
|
2014-09-04 15:52:43 +04:00
|
|
|
kwargs = wptcommandline.check_args(kwargs)
|
|
|
|
|
2017-08-16 17:42:30 +03:00
|
|
|
return kwargs
|
|
|
|
|
2017-06-19 21:20:41 +03:00
|
|
|
def kwargs_wptrun(self, kwargs):
|
2017-05-23 15:48:29 +03:00
|
|
|
from wptrunner import wptcommandline
|
2017-08-16 17:42:30 +03:00
|
|
|
|
2017-05-23 15:48:29 +03:00
|
|
|
if kwargs["metadata_root"] is None:
|
2018-12-05 00:53:27 +03:00
|
|
|
metadir = os.path.join(self._here, "products", kwargs["product"])
|
2017-05-23 15:48:29 +03:00
|
|
|
if not os.path.exists(metadir):
|
|
|
|
os.makedirs(metadir)
|
|
|
|
kwargs["metadata_root"] = metadir
|
|
|
|
|
2018-12-05 00:53:27 +03:00
|
|
|
src_manifest = os.path.join(self._here, "meta", "MANIFEST.json")
|
2017-05-23 15:48:29 +03:00
|
|
|
dest_manifest = os.path.join(kwargs["metadata_root"], "MANIFEST.json")
|
|
|
|
|
|
|
|
if not os.path.exists(dest_manifest) and os.path.exists(src_manifest):
|
|
|
|
with open(src_manifest) as src, open(dest_manifest, "w") as dest:
|
|
|
|
dest.write(src.read())
|
|
|
|
|
2017-08-16 17:42:30 +03:00
|
|
|
from tools.wpt import run
|
|
|
|
|
2018-10-18 16:39:23 +03:00
|
|
|
# Add additional kwargs consumed by the run frontend. Currently we don't
|
|
|
|
# have a way to set these through mach
|
|
|
|
kwargs["channel"] = None
|
|
|
|
kwargs["prompt"] = True
|
|
|
|
kwargs["install_browser"] = False
|
|
|
|
|
2019-05-29 14:30:45 +03:00
|
|
|
# Install the deps
|
|
|
|
# We do this explicitly to avoid calling pip with options that aren't
|
|
|
|
# supported in the in-tree version
|
|
|
|
wptrunner_path = os.path.join(self._here, "tests", "tools", "wptrunner")
|
|
|
|
browser_cls = run.product_setup[kwargs["product"]].browser_cls
|
|
|
|
requirements = ["requirements.txt"]
|
|
|
|
if hasattr(browser_cls, "requirements"):
|
|
|
|
requirements.append(browser_cls.requirements)
|
|
|
|
|
|
|
|
for filename in requirements:
|
|
|
|
path = os.path.join(wptrunner_path, filename)
|
|
|
|
if os.path.exists(path):
|
|
|
|
self.virtualenv_manager.install_pip_requirements(path, require_hashes=False)
|
|
|
|
|
|
|
|
venv = run.virtualenv.Virtualenv(self.virtualenv_manager.virtualenv_root,
|
|
|
|
skip_virtualenv_setup=True)
|
2017-08-16 17:42:30 +03:00
|
|
|
try:
|
2019-05-29 14:30:45 +03:00
|
|
|
kwargs = run.setup_wptrunner(venv, **kwargs)
|
2017-08-16 17:42:30 +03:00
|
|
|
except run.WptrunError as e:
|
|
|
|
print(e.message, file=sys.stderr)
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
return kwargs
|
2017-05-23 15:48:29 +03:00
|
|
|
|
2017-06-01 17:20:11 +03:00
|
|
|
def setup_fonts_firefox(self):
|
|
|
|
# Ensure the Ahem font is available
|
|
|
|
if not sys.platform.startswith("darwin"):
|
|
|
|
font_path = os.path.join(os.path.dirname(self.get_binary_path()), "fonts")
|
|
|
|
else:
|
|
|
|
font_path = os.path.join(os.path.dirname(self.get_binary_path()), os.pardir, "Resources", "res", "fonts")
|
|
|
|
ahem_src = os.path.join(self.topsrcdir, "testing", "web-platform", "tests", "fonts", "Ahem.ttf")
|
|
|
|
ahem_dest = os.path.join(font_path, "Ahem.ttf")
|
|
|
|
if not os.path.exists(ahem_dest) and os.path.exists(ahem_src):
|
2017-08-02 06:35:53 +03:00
|
|
|
with open(ahem_src, "rb") as src, open(ahem_dest, "wb") as dest:
|
2017-06-01 17:20:11 +03:00
|
|
|
dest.write(src.read())
|
|
|
|
|
|
|
|
|
2018-10-18 16:44:36 +03:00
|
|
|
|
2014-09-04 15:52:43 +04:00
|
|
|
class WebPlatformTestsUpdater(MozbuildObject):
|
|
|
|
"""Update web platform tests."""
|
2018-09-29 17:51:44 +03:00
|
|
|
def setup_logging(self, **kwargs):
|
|
|
|
import update
|
|
|
|
return update.setup_logging(kwargs, {"mach": sys.stdout})
|
|
|
|
|
2018-11-20 14:04:30 +03:00
|
|
|
def update_manifest(self, logger, **kwargs):
|
|
|
|
import manifestupdate
|
|
|
|
return manifestupdate.run(logger=logger,
|
|
|
|
src_root=self.topsrcdir,
|
|
|
|
obj_root=self.topobjdir,
|
|
|
|
**kwargs)
|
|
|
|
|
2018-09-29 17:51:44 +03:00
|
|
|
def run_update(self, logger, **kwargs):
|
2015-01-13 12:42:40 +03:00
|
|
|
import update
|
2015-06-30 18:38:14 +03:00
|
|
|
from update import updatecommandline
|
2014-09-04 15:52:43 +04:00
|
|
|
|
2018-11-20 14:04:30 +03:00
|
|
|
self.update_manifest(logger, **kwargs)
|
|
|
|
|
2014-09-04 15:52:43 +04:00
|
|
|
if kwargs["config"] is None:
|
2018-09-20 15:07:58 +03:00
|
|
|
kwargs["config"] = os.path.join(self.topobjdir, '_tests', 'web-platform', 'wptrunner.local.ini')
|
2016-03-17 14:35:32 +03:00
|
|
|
if kwargs["product"] is None:
|
|
|
|
kwargs["product"] = "firefox"
|
|
|
|
|
2018-07-10 12:09:43 +03:00
|
|
|
kwargs["store_state"] = False
|
|
|
|
|
2017-06-16 12:45:55 +03:00
|
|
|
kwargs = updatecommandline.check_args(kwargs)
|
2014-09-04 15:52:43 +04:00
|
|
|
|
2015-01-13 12:42:40 +03:00
|
|
|
try:
|
|
|
|
update.run_update(logger, **kwargs)
|
2016-10-07 15:28:37 +03:00
|
|
|
except Exception:
|
2015-01-13 12:42:40 +03:00
|
|
|
import pdb
|
|
|
|
import traceback
|
|
|
|
traceback.print_exc()
|
2016-10-07 15:28:37 +03:00
|
|
|
# pdb.post_mortem()
|
2014-09-04 15:52:43 +04:00
|
|
|
|
2018-06-15 19:30:58 +03:00
|
|
|
|
2019-06-13 17:24:25 +03:00
|
|
|
class WebPlatformTestsUnittestRunner(MozbuildObject):
|
|
|
|
def run(self, **kwargs):
|
|
|
|
import unittestrunner
|
|
|
|
return unittestrunner.run(self.topsrcdir, **kwargs)
|
|
|
|
|
|
|
|
|
2015-06-30 18:38:14 +03:00
|
|
|
def create_parser_update():
|
|
|
|
from update import updatecommandline
|
|
|
|
return updatecommandline.create_parser()
|
|
|
|
|
2018-06-15 19:30:58 +03:00
|
|
|
|
2015-10-14 21:10:10 +03:00
|
|
|
def create_parser_create():
|
|
|
|
import argparse
|
|
|
|
p = argparse.ArgumentParser()
|
|
|
|
p.add_argument("--no-editor", action="store_true",
|
|
|
|
help="Don't try to open the test in an editor")
|
|
|
|
p.add_argument("-e", "--editor", action="store", help="Editor to use")
|
|
|
|
p.add_argument("--long-timeout", action="store_true",
|
|
|
|
help="Test should be given a long timeout (typically 60s rather than 10s, but varies depending on environment)")
|
|
|
|
p.add_argument("--overwrite", action="store_true",
|
|
|
|
help="Allow overwriting an existing test file")
|
2015-10-19 17:44:19 +03:00
|
|
|
p.add_argument("-r", "--reftest", action="store_true",
|
|
|
|
help="Create a reftest rather than a testharness (js) test"),
|
2017-07-03 17:39:20 +03:00
|
|
|
p.add_argument("-m", "--reference", dest="ref", help="Path to the reference file")
|
2015-10-19 17:44:19 +03:00
|
|
|
p.add_argument("--mismatch", action="store_true",
|
|
|
|
help="Create a mismatch reftest")
|
|
|
|
p.add_argument("--wait", action="store_true",
|
|
|
|
help="Create a reftest that waits until takeScreenshot() is called")
|
2015-10-14 21:10:10 +03:00
|
|
|
p.add_argument("path", action="store", help="Path to the test file")
|
|
|
|
return p
|
|
|
|
|
|
|
|
|
2016-09-13 16:20:20 +03:00
|
|
|
def create_parser_manifest_update():
|
|
|
|
import manifestupdate
|
|
|
|
return manifestupdate.create_parser()
|
|
|
|
|
|
|
|
|
2019-04-11 19:40:07 +03:00
|
|
|
def create_parser_metadata_summary():
|
|
|
|
import metasummary
|
|
|
|
return metasummary.create_parser()
|
|
|
|
|
|
|
|
|
2019-08-09 20:48:53 +03:00
|
|
|
def create_parser_metadata_merge():
|
|
|
|
import metamerge
|
|
|
|
return metamerge.get_parser()
|
|
|
|
|
2019-04-11 19:47:58 +03:00
|
|
|
def create_parser_serve():
|
|
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),
|
|
|
|
"tests", "tools")))
|
|
|
|
import serve
|
|
|
|
return serve.serve.get_parser()
|
|
|
|
|
|
|
|
|
2019-06-13 17:24:25 +03:00
|
|
|
def create_parser_unittest():
|
|
|
|
import unittestrunner
|
|
|
|
return unittestrunner.get_parser()
|
|
|
|
|
|
|
|
|
2014-09-04 15:52:43 +04:00
|
|
|
@CommandProvider
|
|
|
|
class MachCommands(MachCommandBase):
|
2016-09-13 16:20:20 +03:00
|
|
|
def setup(self):
|
|
|
|
self._activate_virtualenv()
|
|
|
|
|
2014-09-04 15:52:43 +04:00
|
|
|
@Command("web-platform-tests",
|
|
|
|
category="testing",
|
2018-09-24 01:08:56 +03:00
|
|
|
conditions=[conditions.is_firefox_or_android],
|
2018-12-21 21:55:27 +03:00
|
|
|
description="Run web-platform-tests.",
|
2015-06-30 18:38:14 +03:00
|
|
|
parser=create_parser_wpt)
|
2014-09-04 15:52:43 +04:00
|
|
|
def run_web_platform_tests(self, **params):
|
|
|
|
self.setup()
|
2019-07-09 21:10:03 +03:00
|
|
|
if conditions.is_android(self) and params["product"] != "firefox_android":
|
2018-06-15 19:30:58 +03:00
|
|
|
if params["product"] is None:
|
2019-07-09 21:10:03 +03:00
|
|
|
params["product"] = "firefox_android"
|
2015-05-28 22:27:23 +03:00
|
|
|
if "test_objects" in params:
|
|
|
|
for item in params["test_objects"]:
|
|
|
|
params["include"].append(item["name"])
|
|
|
|
del params["test_objects"]
|
2019-07-26 18:18:18 +03:00
|
|
|
if params.get('debugger', None):
|
|
|
|
import mozdebug
|
|
|
|
if not mozdebug.get_debugger_info(params.get('debugger')):
|
|
|
|
sys.exit(1)
|
2015-05-28 22:27:23 +03:00
|
|
|
|
2017-06-19 21:20:41 +03:00
|
|
|
wpt_setup = self._spawn(WebPlatformTestsRunnerSetup)
|
2019-06-04 03:11:18 +03:00
|
|
|
wpt_setup._mach_context = self._mach_context
|
2017-06-19 21:20:41 +03:00
|
|
|
wpt_runner = WebPlatformTestsRunner(wpt_setup)
|
2018-09-29 17:51:44 +03:00
|
|
|
|
|
|
|
logger = wpt_runner.setup_logging(**params)
|
|
|
|
|
2019-07-09 21:10:03 +03:00
|
|
|
if conditions.is_android(self) and params["product"] != "firefox_android":
|
|
|
|
logger.warning("Must specify --product=firefox_android in Android environment.")
|
|
|
|
|
2018-09-29 17:51:44 +03:00
|
|
|
return wpt_runner.run(logger, **params)
|
2014-09-04 15:52:43 +04:00
|
|
|
|
2016-09-12 17:10:55 +03:00
|
|
|
@Command("wpt",
|
|
|
|
category="testing",
|
2018-09-24 01:08:56 +03:00
|
|
|
conditions=[conditions.is_firefox_or_android],
|
2018-12-21 21:55:27 +03:00
|
|
|
description="Run web-platform-tests.",
|
2016-09-12 17:10:55 +03:00
|
|
|
parser=create_parser_wpt)
|
|
|
|
def run_wpt(self, **params):
|
|
|
|
return self.run_web_platform_tests(**params)
|
|
|
|
|
2014-09-04 15:52:43 +04:00
|
|
|
@Command("web-platform-tests-update",
|
|
|
|
category="testing",
|
2018-12-21 21:55:27 +03:00
|
|
|
description="Update web-platform-test metadata.",
|
2015-06-30 18:38:14 +03:00
|
|
|
parser=create_parser_update)
|
2014-09-04 15:52:43 +04:00
|
|
|
def update_web_platform_tests(self, **params):
|
|
|
|
self.setup()
|
2018-05-10 17:39:14 +03:00
|
|
|
self.virtualenv_manager.install_pip_package('html5lib==1.0.1')
|
|
|
|
self.virtualenv_manager.install_pip_package('ujson')
|
2015-01-13 12:42:40 +03:00
|
|
|
self.virtualenv_manager.install_pip_package('requests')
|
2018-09-29 17:51:44 +03:00
|
|
|
|
2014-09-04 15:52:43 +04:00
|
|
|
wpt_updater = self._spawn(WebPlatformTestsUpdater)
|
2018-09-29 17:51:44 +03:00
|
|
|
logger = wpt_updater.setup_logging(**params)
|
|
|
|
return wpt_updater.run_update(logger, **params)
|
2014-09-04 15:52:43 +04:00
|
|
|
|
2016-09-12 17:10:55 +03:00
|
|
|
@Command("wpt-update",
|
|
|
|
category="testing",
|
2018-12-21 21:55:27 +03:00
|
|
|
description="Update web-platform-test metadata.",
|
2016-09-12 17:10:55 +03:00
|
|
|
parser=create_parser_update)
|
|
|
|
def update_wpt(self, **params):
|
|
|
|
return self.update_web_platform_tests(**params)
|
|
|
|
|
2016-09-12 17:06:32 +03:00
|
|
|
@Command("wpt-manifest-update",
|
2016-09-13 16:20:20 +03:00
|
|
|
category="testing",
|
2018-12-21 21:55:27 +03:00
|
|
|
description="Update web-platform-test manifests.",
|
2016-09-13 16:20:20 +03:00
|
|
|
parser=create_parser_manifest_update)
|
|
|
|
def wpt_manifest_update(self, **params):
|
2016-09-12 17:06:32 +03:00
|
|
|
self.setup()
|
2018-10-02 18:46:42 +03:00
|
|
|
wpt_setup = self._spawn(WebPlatformTestsRunnerSetup)
|
|
|
|
wpt_runner = WebPlatformTestsRunner(wpt_setup)
|
|
|
|
logger = wpt_runner.setup_logging(**params)
|
2019-04-11 19:47:58 +03:00
|
|
|
logger.warning("The wpt manifest is now automatically updated, "
|
|
|
|
"so running this command is usually unnecessary")
|
2018-10-02 18:46:42 +03:00
|
|
|
return 0 if wpt_runner.update_manifest(logger, **params) else 1
|
2019-04-11 19:40:07 +03:00
|
|
|
|
2019-04-11 19:47:58 +03:00
|
|
|
@Command("wpt-serve",
|
|
|
|
category="testing",
|
|
|
|
description="Run the wpt server",
|
|
|
|
parser=create_parser_serve)
|
|
|
|
def wpt_manifest_serve(self, **params):
|
|
|
|
self.setup()
|
|
|
|
import logging
|
|
|
|
logger = logging.getLogger("web-platform-tests")
|
|
|
|
logger.addHandler(logging.StreamHandler(sys.stdout))
|
|
|
|
import serve
|
|
|
|
return 0 if serve.serve.run(**params) else 1
|
|
|
|
|
2019-04-11 19:40:07 +03:00
|
|
|
@Command("wpt-metadata-summary",
|
|
|
|
category="testing",
|
|
|
|
description="Create a json summary of the wpt metadata",
|
|
|
|
parser=create_parser_metadata_summary)
|
|
|
|
def wpt_summary(self, **params):
|
|
|
|
import metasummary
|
|
|
|
wpt_setup = self._spawn(WebPlatformTestsRunnerSetup)
|
|
|
|
return metasummary.run(wpt_setup.topsrcdir, wpt_setup.topobjdir, **params)
|
2019-06-13 17:24:25 +03:00
|
|
|
|
2019-08-09 20:48:53 +03:00
|
|
|
@Command("wpt-metadata-merge",
|
|
|
|
category="testing",
|
|
|
|
parser=create_parser_metadata_merge)
|
|
|
|
def wpt_meta_merge(self, **params):
|
|
|
|
import metamerge
|
|
|
|
if params["dest"] is None:
|
|
|
|
params["dest"] = params["current"]
|
|
|
|
return metamerge.run(**params)
|
|
|
|
|
2019-06-13 17:24:25 +03:00
|
|
|
@Command("wpt-unittest",
|
|
|
|
category="testing",
|
|
|
|
description="Run the wpt tools and wptrunner unit tests",
|
|
|
|
parser=create_parser_unittest)
|
|
|
|
def wpt_unittest(self, **params):
|
|
|
|
self.setup()
|
|
|
|
self.virtualenv_manager.install_pip_package('tox')
|
|
|
|
runner = self._spawn(WebPlatformTestsUnittestRunner)
|
|
|
|
return 0 if runner.run(**params) else 1
|