Update web-platform-tests to revision fec3928f355e049657d19780aa4b412d9d3a714b

This commit is contained in:
WPT Sync Bot 2018-10-02 22:11:10 -04:00
parent 74ba683e27
commit 2a8d9b6983
153 changed files with 3075 additions and 719 deletions

View file

@ -6,4 +6,4 @@ cd $WPT_ROOT
mkdir -p ~/meta
./wpt manifest -p ~/meta/MANIFEST.json
./wpt lint
./wpt lint --all

View file

@ -18,14 +18,14 @@ test_infrastructure() {
}
main() {
PRODUCTS=( "firefox" "chrome" "chrome_webdriver" )
PRODUCTS=( "firefox" "chrome" )
for PRODUCT in "${PRODUCTS[@]}"; do
if [ "$PRODUCT" != "firefox" ]; then
# Firefox is expected to work using pref settings for DNS
# Don't adjust the hostnames in that case to ensure this keeps working
hosts_fixup
fi
if [[ "$PRODUCT" == "chrome"* ]]; then
if [[ "$PRODUCT" == "chrome" ]]; then
install_chrome unstable
test_infrastructure "--binary=$(which google-chrome-unstable)"
else

View file

@ -499,13 +499,6 @@ class ChromeAndroid(Browser):
def version(self, binary):
return None
class ChromeWebDriver(Chrome):
"""Chrome-specific interface for chrome without using selenium.
Includes webdriver installation.
"""
product = "chrome_webdriver"
class Opera(Browser):
"""Opera-specific interface.

View file

@ -292,11 +292,6 @@ class ChromeAndroid(BrowserSetup):
raise WptrunError("Unable to locate or install chromedriver binary")
class ChromeWebDriver(Chrome):
name = "chrome_webdriver"
browser_cls = browser.ChromeWebDriver
class Opera(BrowserSetup):
name = "opera"
browser_cls = browser.Opera
@ -435,7 +430,6 @@ product_setup = {
"firefox": Firefox,
"chrome": Chrome,
"chrome_android": ChromeAndroid,
"chrome_webdriver": ChromeWebDriver,
"edge": Edge,
"edge_webdriver": EdgeWebDriver,
"ie": InternetExplorer,

View file

@ -24,7 +24,6 @@ module global scope.
product_list = ["chrome",
"chrome_android",
"chrome_webdriver",
"edge",
"edge_webdriver",
"fennec",

View file

@ -1,16 +1,16 @@
from .base import Browser, ExecutorBrowser, require_arg
from ..webdriver_server import ChromeDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
SeleniumRefTestExecutor) # noqa: F401
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
WebDriverRefTestExecutor) # noqa: F401
from ..executors.executorchrome import ChromeDriverWdspecExecutor # noqa: F401
__wptrunner__ = {"product": "chrome",
"check_args": "check_args",
"browser": "ChromeBrowser",
"executor": {"testharness": "SeleniumTestharnessExecutor",
"reftest": "SeleniumRefTestExecutor",
"executor": {"testharness": "WebDriverTestharnessExecutor",
"reftest": "WebDriverRefTestExecutor",
"wdspec": "ChromeDriverWdspecExecutor"},
"browser_kwargs": "browser_kwargs",
"executor_kwargs": "executor_kwargs",
@ -30,34 +30,43 @@ def browser_kwargs(test_type, run_info_data, config, **kwargs):
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
**kwargs):
from selenium.webdriver import DesiredCapabilities
executor_kwargs = base_executor_kwargs(test_type, server_config,
cache_manager, run_info_data,
**kwargs)
executor_kwargs["close_after_done"] = True
capabilities = dict(DesiredCapabilities.CHROME.items())
capabilities.setdefault("goog:chromeOptions", {})["prefs"] = {
"profile": {
"default_content_setting_values": {
"popups": 1
}
capabilities = {
"browserName": "chrome",
"platform": "ANY",
"version": "",
"goog:chromeOptions": {
"prefs": {
"profile": {
"default_content_setting_values": {
"popups": 1
}
}
},
"w3c": True
}
}
for (kwarg, capability) in [("binary", "binary"), ("binary_args", "args")]:
if kwargs[kwarg] is not None:
capabilities["goog:chromeOptions"][capability] = kwargs[kwarg]
if kwargs["headless"]:
if "args" not in capabilities["goog:chromeOptions"]:
capabilities["goog:chromeOptions"]["args"] = []
if "--headless" not in capabilities["goog:chromeOptions"]["args"]:
capabilities["goog:chromeOptions"]["args"].append("--headless")
if test_type == "testharness":
capabilities["goog:chromeOptions"]["useAutomationExtension"] = False
capabilities["goog:chromeOptions"]["excludeSwitches"] = ["enable-automation"]
if test_type == "wdspec":
capabilities["goog:chromeOptions"]["w3c"] = True
executor_kwargs["capabilities"] = capabilities
return executor_kwargs

View file

@ -1,56 +0,0 @@
from .base import inherit
from . import chrome
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
WebDriverRefTestExecutor) # noqa: F401
inherit(chrome, globals(), "chrome_webdriver")
# __wptrunner__ magically appears from inherit, F821 is undefined name
__wptrunner__["executor_kwargs"] = "executor_kwargs" # noqa: F821
__wptrunner__["executor"]["testharness"] = "WebDriverTestharnessExecutor" # noqa: F821
__wptrunner__["executor"]["reftest"] = "WebDriverRefTestExecutor" # noqa: F821
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
**kwargs):
executor_kwargs = base_executor_kwargs(test_type, server_config,
cache_manager, run_info_data,
**kwargs)
executor_kwargs["close_after_done"] = True
capabilities = {
"browserName": "chrome",
"platform": "ANY",
"version": "",
"goog:chromeOptions": {
"prefs": {
"profile": {
"default_content_setting_values": {
"popups": 1
}
}
},
"w3c": True
}
}
for (kwarg, capability) in [("binary", "binary"), ("binary_args", "args")]:
if kwargs[kwarg] is not None:
capabilities["goog:chromeOptions"][capability] = kwargs[kwarg]
if kwargs["headless"]:
if "args" not in capabilities["goog:chromeOptions"]:
capabilities["goog:chromeOptions"]["args"] = []
if "--headless" not in capabilities["goog:chromeOptions"]["args"]:
capabilities["goog:chromeOptions"]["args"].append("--headless")
if test_type == "testharness":
capabilities["goog:chromeOptions"]["useAutomationExtension"] = False
capabilities["goog:chromeOptions"]["excludeSwitches"] = ["enable-automation"]
executor_kwargs["capabilities"] = capabilities
return executor_kwargs

View file

@ -226,8 +226,12 @@ class SeleniumRun(object):
flag = self.result_flag.wait(timeout + 2 * extra_timeout)
if self.result is None:
assert not flag
self.result = False, ("EXTERNAL-TIMEOUT", None)
if flag:
# flag is True unless we timeout; this *shouldn't* happen, but
# it can if self._run fails to set self.result due to raising
self.result = False, ("INTERNAL-ERROR", "self._run didn't set a result")
else:
self.result = False, ("EXTERNAL-TIMEOUT", None)
return self.result
@ -239,7 +243,7 @@ class SeleniumRun(object):
except (socket.timeout, exceptions.ErrorInResponseException):
self.result = False, ("CRASH", None)
except Exception as e:
message = getattr(e, "message", "")
message = str(getattr(e, "message", ""))
if message:
message += "\n"
message += traceback.format_exc(e)

View file

@ -228,8 +228,12 @@ class WebDriverRun(object):
flag = self.result_flag.wait(timeout + 2 * extra_timeout)
if self.result is None:
assert not flag
self.result = False, ("EXTERNAL-TIMEOUT", None)
if flag:
# flag is True unless we timeout; this *shouldn't* happen, but
# it can if self._run fails to set self.result due to raising
self.result = False, ("INTERNAL-ERROR", "self._run didn't set a result")
else:
self.result = False, ("EXTERNAL-TIMEOUT", None)
return self.result
@ -247,11 +251,11 @@ class WebDriverRun(object):
# workaround for https://bugs.chromium.org/p/chromedriver/issues/detail?id=2001
self.result = False, ("EXTERNAL-TIMEOUT", None)
else:
message = getattr(e, "message", "")
message = str(getattr(e, "message", ""))
if message:
message += "\n"
message += traceback.format_exc(e)
self.result = False, ("ERROR", message)
self.result = False, ("INTERNAL-ERROR", message)
finally:
self.result_flag.set()

View file

@ -9,6 +9,8 @@ from multiprocessing import Process, current_process, Queue
from mozlog import structuredlog
import wptlogging
# Special value used as a sentinal in various commands
Stop = object()
@ -40,12 +42,13 @@ for level_name in structuredlog.log_levels:
class TestRunner(object):
def __init__(self, command_queue, result_queue, executor):
def __init__(self, logger, command_queue, result_queue, executor):
"""Class implementing the main loop for running tests.
This class delegates the job of actually running a test to the executor
that is passed in.
:param logger: Structured logger
:param command_queue: subprocess.Queue used to send commands to the
process
:param result_queue: subprocess.Queue used to send results to the
@ -57,7 +60,7 @@ class TestRunner(object):
self.executor = executor
self.name = current_process().name
self.logger = MessageLogger(self.send_message)
self.logger = logger
def __enter__(self):
return self
@ -117,30 +120,31 @@ class TestRunner(object):
def start_runner(runner_command_queue, runner_result_queue,
executor_cls, executor_kwargs,
executor_browser_cls, executor_browser_kwargs,
stop_flag):
capture_stdio, stop_flag):
"""Launch a TestRunner in a new process"""
def log(level, msg):
runner_result_queue.put(("log", (level, {"message": msg})))
def send_message(command, *args):
runner_result_queue.put((command, args))
def handle_error(e):
log("critical", traceback.format_exc())
logger.critical(traceback.format_exc())
stop_flag.set()
try:
browser = executor_browser_cls(**executor_browser_kwargs)
executor = executor_cls(browser, **executor_kwargs)
with TestRunner(runner_command_queue, runner_result_queue, executor) as runner:
try:
runner.run()
except KeyboardInterrupt:
stop_flag.set()
except Exception as e:
handle_error(e)
except Exception as e:
handle_error(e)
finally:
runner_command_queue = None
runner_result_queue = None
logger = MessageLogger(send_message)
with wptlogging.CaptureIO(logger, capture_stdio):
try:
browser = executor_browser_cls(**executor_browser_kwargs)
executor = executor_cls(browser, **executor_kwargs)
with TestRunner(logger, runner_command_queue, runner_result_queue, executor) as runner:
try:
runner.run()
except KeyboardInterrupt:
stop_flag.set()
except Exception as e:
handle_error(e)
except Exception as e:
handle_error(e)
manager_count = 0
@ -255,7 +259,8 @@ RunnerManagerState = _RunnerManagerState()
class TestRunnerManager(threading.Thread):
def __init__(self, suite_name, test_queue, test_source_cls, browser_cls, browser_kwargs,
executor_cls, executor_kwargs, stop_flag, rerun=1, pause_after_test=False,
pause_on_unexpected=False, restart_on_unexpected=True, debug_info=None):
pause_on_unexpected=False, restart_on_unexpected=True, debug_info=None,
capture_stdio=True):
"""Thread that owns a single TestRunner process and any processes required
by the TestRunner (e.g. the Firefox binary).
@ -313,6 +318,8 @@ class TestRunnerManager(threading.Thread):
self.browser = None
self.capture_stdio = capture_stdio
def run(self):
"""Main loop for the TestManager.
@ -479,6 +486,7 @@ class TestRunnerManager(threading.Thread):
self.executor_kwargs,
executor_browser_cls,
executor_browser_kwargs,
self.capture_stdio,
self.child_stop_flag)
self.test_runner_proc = Process(target=start_runner,
args=args,
@ -737,7 +745,8 @@ class ManagerGroup(object):
pause_after_test=False,
pause_on_unexpected=False,
restart_on_unexpected=True,
debug_info=None):
debug_info=None,
capture_stdio=True):
"""Main thread object that owns all the TestManager threads."""
self.suite_name = suite_name
self.size = size
@ -752,6 +761,7 @@ class ManagerGroup(object):
self.restart_on_unexpected = restart_on_unexpected
self.debug_info = debug_info
self.rerun = rerun
self.capture_stdio = capture_stdio
self.pool = set()
# Event that is polled by threads so that they can gracefully exit in the face
@ -788,7 +798,8 @@ class ManagerGroup(object):
self.pause_after_test,
self.pause_on_unexpected,
self.restart_on_unexpected,
self.debug_info)
self.debug_info,
self.capture_stdio)
manager.start()
self.pool.add(manager)
self.wait()

View file

@ -17,7 +17,7 @@ if "CURRENT_TOX_ENV" in os.environ:
current_tox_env_split = os.environ["CURRENT_TOX_ENV"].split("-")
tox_env_extra_browsers = {
"chrome": {"chrome_android", "chrome_webdriver"},
"chrome": {"chrome_android"},
"edge": {"edge_webdriver"},
"safari": {"safari_webdriver"},
"servo": {"servodriver"},

View file

@ -48,6 +48,7 @@ def get_loader(test_paths, product, debug=None, run_info_extras=None, **kwargs):
run_info = wpttest.get_run_info(kwargs["run_info"], product,
browser_version=kwargs.get("browser_version"),
browser_channel=kwargs.get("browser_channel"),
verify=kwargs.get("verify"),
debug=debug,
extras=run_info_extras)
@ -265,7 +266,8 @@ def run_tests(config, test_paths, product, **kwargs):
kwargs["pause_after_test"],
kwargs["pause_on_unexpected"],
kwargs["restart_on_unexpected"],
kwargs["debug_info"]) as manager_group:
kwargs["debug_info"],
not kwargs["no_capture_stdio"]) as manager_group:
try:
manager_group.run(test_type, run_tests)
except KeyboardInterrupt:

View file

@ -70,6 +70,7 @@ class RunInfo(dict):
def __init__(self, metadata_root, product, debug,
browser_version=None,
browser_channel=None,
verify=None,
extras=None):
import mozinfo
self._update_mozinfo(metadata_root)
@ -94,6 +95,10 @@ class RunInfo(dict):
self["browser_version"] = browser_version
if browser_channel:
self["browser_channel"] = browser_channel
self["verify"] = verify
if "wasm" not in self:
self["wasm"] = False
if extras is not None:
self.update(extras)