Files
palemoon27/testing/web-platform/mach_commands.py
T
roytam1 538b35a4ee import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1147951, part 2 - Remove unused JAVASCRIPT definition from nsJSEnvironment.cpp. r=baku (607909217)
- Bug 1147951, part 1 - Remove uses of JAVASCRIPT2 from Console.cpp. r=baku (46cde7cfa)
- pointer style (5504c22d4)
- Bug 1165384 - Add a typedef for the statistics phase table; r=sfink (484a24237)
- Bug 1165385 - Remove the rarely used !fullFormat mode of MOZ_GCTIMER; r=sfink (ab8b17eb1)
- Bug 1165390 - Make the detailed statistics formatting methods have consistent names; r=sfink (55c5db543)
- Bug 1165410 - Reimplement GC statistics JSON output formatter; r=sfink (04c13c874)
- Bug 1166789 - Cleanup javascript.options.mem.log formatting; r=sfink, r=mccr8 (f23b455b4)
- Bug 1171451 - Use the correct type for the argv argument to NS_CreateJSArgv and the nsJSArgArray constructor; r=jst (edfa21a59)
- Bug 886459, part 1 - Remove unused includes of nsIJSRuntimeService.h. r=bholley (bbc277ac1)
- Bug 886459, part 2 - Remove context callbacks from XPCJSRuntime. r=bholley (2c3c8515a)
- Bug 886459, part 3 - Remove simple uses of nsIJSRuntimeService to get the JSRuntime. r=bholley (ff5bfe304)
- pointer style (2ea264afd)
- Bug 1169457 - Add null check in OnWrapperDestroy. r=jimm (741739513)
-  Bug 886459, part 4 - Remove nsIJSRuntimeService. r=bholley,aklotz (61563f53b)
- Bug 1176642 - Use absolute_import in mach_commands.py files; r=glandium (a9fcb3b3f)
- Bug 1176642 - Defer import of autotry and pprint; r=chmanchester (de40855cb)
- Bug 1178772 - Add check_macroassembler_style.py: Verify that each MacroAssembler declaration maps to all its definitions. r=h4writer (fd406593a)
- Bug 1152556 - Add moz.build bugzilla metadata in dom/media. r=kinetik (fa2ffa121)
- Bug 1152556 - Add moz.build bugzilla metadata in dom/media webrtc. r=abr (d208b839a)
- re-enable peerconnection (42e8c412b)
- Bug 1152538 - Enable WebRTC identity, r=jesup (13a47adcb)
- Bug 1231123 - Simplify LaunchApp on BSDs by dropping fork/exec version. r=jld (c35e6e36f)
- bug 1171120 - Fix mtransport+signalling to build on iOS. r=ekr (7034b20ab)
- Bug 1150609 Patch 1 WebRTC SDP - add tmmbr to offer. r=jesup (52ca72d09)
- Bug 1150609 Patch 2 - WebRTC enable tmmbr r=jesup (d59c6adb9)
- Bug 1150609 Patch 3 - WebRTC enable tmmbr unittest changes. r=jesup (eeffed826)
- Bug 1087161 - Upgrading B2G toolchain to gcc-4.9 (851194ca0)
2020-12-01 21:03:44 +08:00

161 lines
5.1 KiB
Python

# 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.
from __future__ import absolute_import, unicode_literals, print_function
import os
import sys
from mozbuild.base import (
MachCommandBase,
MachCommandConditions as conditions,
MozbuildObject,
)
from mach.decorators import (
CommandProvider,
Command,
)
from wptrunner import wptcommandline
from update import updatecommandline
# This should probably be consolidated with similar classes in other test
# runners.
class InvalidTestPathError(Exception):
"""Exception raised when the test path is not valid."""
class WebPlatformTestsRunner(MozbuildObject):
"""Run web platform tests."""
def setup_kwargs(self, kwargs):
build_path = os.path.join(self.topobjdir, 'build')
if build_path not in sys.path:
sys.path.append(build_path)
if kwargs["config"] is None:
kwargs["config"] = os.path.join(self.topsrcdir, 'testing', 'web-platform', 'wptrunner.ini')
if kwargs["binary"] is None:
kwargs["binary"] = self.get_binary_path('app')
if kwargs["prefs_root"] is None:
kwargs["prefs_root"] = os.path.join(self.topobjdir, '_tests', 'web-platform', "prefs")
if kwargs["certutil_binary"] is None:
kwargs["certutil_binary"] = self.get_binary_path('certutil')
here = os.path.split(__file__)[0]
if kwargs["ssl_type"] in (None, "pregenerated"):
if kwargs["ca_cert_path"] is None:
kwargs["ca_cert_path"] = os.path.join(here, "certs", "cacert.pem")
if kwargs["host_key_path"] is None:
kwargs["host_key_path"] = os.path.join(here, "certs", "web-platform.test.key")
if kwargs["host_cert_path"] is None:
kwargs["host_cert_path"] = os.path.join(here, "certs", "web-platform.test.pem")
kwargs["capture_stdio"] = True
kwargs = wptcommandline.check_args(kwargs)
def run_tests(self, **kwargs):
from wptrunner import wptrunner
self.setup_kwargs(kwargs)
logger = wptrunner.setup_logging(kwargs, {"mach": sys.stdout})
result = wptrunner.run_tests(**kwargs)
return int(not result)
def list_test_groups(self, **kwargs):
from wptrunner import wptrunner
self.setup_kwargs(kwargs)
wptrunner.list_test_groups(**kwargs)
class WebPlatformTestsUpdater(MozbuildObject):
"""Update web platform tests."""
def run_update(self, **kwargs):
import update
if kwargs["config"] is None:
kwargs["config"] = os.path.join(self.topsrcdir, 'testing', 'web-platform', 'wptrunner.ini')
updatecommandline.check_args(kwargs)
logger = update.setup_logging(kwargs, {"mach": sys.stdout})
try:
update.run_update(logger, **kwargs)
except:
import pdb
import traceback
traceback.print_exc()
pdb.post_mortem()
class WebPlatformTestsReduce(WebPlatformTestsRunner):
def run_reduce(self, **kwargs):
from wptrunner import reduce
self.setup_kwargs(kwargs)
kwargs["capture_stdio"] = True
logger = reduce.setup_logging(kwargs, {"mach": sys.stdout})
tests = reduce.do_reduce(**kwargs)
if not tests:
logger.warning("Test was not unstable")
for item in tests:
logger.info(item.id)
@CommandProvider
class MachCommands(MachCommandBase):
@Command("web-platform-tests",
category="testing",
conditions=[conditions.is_firefox],
parser=wptcommandline.create_parser(["firefox"]))
def run_web_platform_tests(self, **params):
self.setup()
if "test_objects" in params:
for item in params["test_objects"]:
params["include"].append(item["name"])
del params["test_objects"]
wpt_runner = self._spawn(WebPlatformTestsRunner)
if params["list_test_groups"]:
return wpt_runner.list_test_groups(**params)
else:
return wpt_runner.run_tests(**params)
@Command("web-platform-tests-update",
category="testing",
parser=updatecommandline.create_parser())
def update_web_platform_tests(self, **params):
self.setup()
self.virtualenv_manager.install_pip_package('html5lib==0.99')
self.virtualenv_manager.install_pip_package('requests')
wpt_updater = self._spawn(WebPlatformTestsUpdater)
return wpt_updater.run_update(**params)
def setup(self):
self._activate_virtualenv()
@Command("web-platform-tests-reduce",
category="testing",
conditions=[conditions.is_firefox],
parser=wptcommandline.create_parser_reduce(["firefox"]))
def unstable_web_platform_tests(self, **params):
self.setup()
wpt_reduce = self._spawn(WebPlatformTestsReduce)
return wpt_reduce.run_reduce(**params)