Update web-platform-tests to revision 8fed98324bc133df221d778c62cbff210d43b0ce

This commit is contained in:
WPT Sync Bot 2018-02-19 20:08:38 -05:00
parent be902d56c0
commit 8a6476740e
246 changed files with 15482 additions and 1281 deletions

View file

@ -3,6 +3,7 @@ import os
import re
from collections import defaultdict
from six import iteritems, itervalues, viewkeys, string_types
from tempfile import mkstemp
from .item import ManualTest, WebdriverSpecTest, Stub, RefTestNode, RefTest, TestharnessTest, SupportFile, ConformanceCheckerTest, VisualTest
from .log import get_logger
@ -232,6 +233,11 @@ def write(manifest, manifest_path):
dir_name = os.path.dirname(manifest_path)
if not os.path.exists(dir_name):
os.makedirs(dir_name)
with open(manifest_path, "wb") as f:
json.dump(manifest.to_json(), f, sort_keys=True, indent=1, separators=(',', ': '))
f.write("\n")
fd, temp_manifest_path = mkstemp(dir=dir_name)
temp_manifest = open(temp_manifest_path, "wb")
json.dump(manifest.to_json(), temp_manifest,
sort_keys=True, indent=1, separators=(',', ': '))
temp_manifest.write("\n")
os.rename(temp_manifest_path, manifest_path)
os.close(fd)

View file

@ -4,4 +4,3 @@ include wptrunner.default.ini
include wptrunner/testharness_runner.html
include wptrunner/*.js
include wptrunner/executors/*.js
include wptrunner/config.json

View file

@ -50,7 +50,6 @@ setup(name=PACKAGE_NAME,
"executors/reftest-wait.js",
"testharnessreport.js",
"testharness_runner.html",
"config.json",
"wptrunner.default.ini",
"browsers/sauce_setup/*",
"prefs/*"]},

View file

@ -117,6 +117,11 @@ def env_extras(**kwargs):
def env_options():
# The server host is set to 127.0.0.1 as Firefox is configured (through the
# network.dns.localDomains preference set below) to resolve the test
# domains to localhost without relying on the network stack.
#
# https://github.com/w3c/web-platform-tests/pull/9480
return {"host": "127.0.0.1",
"external_host": "web-platform.test",
"bind_hostname": "false",

View file

@ -127,15 +127,29 @@ def get_tar(url, dest):
class SauceConnect():
def __init__(self, **kwargs):
self.config = kwargs["config"]
self.sauce_user = kwargs["sauce_user"]
self.sauce_key = kwargs["sauce_key"]
self.sauce_tunnel_id = kwargs["sauce_tunnel_id"]
self.sauce_connect_binary = kwargs.get("sauce_connect_binary")
self.sc_process = None
self.temp_dir = None
self.env_config = None
def __call__(self, env_options, env_config):
self.env_config = env_config
return self
def __enter__(self):
# Because this class implements the context manager protocol, it is
# possible for instances to be provided to the `with` statement
# directly. This class implements the callable protocol so that data
# which is not available during object initialization can be provided
# prior to this moment. Instances must be invoked in preparation for
# the context manager protocol, but this additional constraint is not
# itself part of the protocol.
assert self.env_config is not None, 'The instance has been invoked.'
def __enter__(self, options):
if not self.sauce_connect_binary:
self.temp_dir = tempfile.mkdtemp()
get_tar("https://saucelabs.com/downloads/sc-4.4.9-linux.tar.gz", self.temp_dir)
@ -153,7 +167,7 @@ class SauceConnect():
"--metrics-address=0.0.0.0:9876",
"--readyfile=./sauce_is_ready",
"--tunnel-domains",
",".join(self.config['domains'].values())
",".join(self.env_config['domains'].values())
])
# Timeout config vars
@ -180,6 +194,7 @@ class SauceConnect():
raise SauceException("Unable to start Sauce Connect Proxy. Process exited with code %s", self.sc_process.returncode)
def __exit__(self, exc_type, exc_val, exc_tb):
self.env_config = None
self.sc_process.terminate()
if self.temp_dir and os.path.exists(self.temp_dir):
try:

View file

@ -54,7 +54,7 @@ def env_extras(**kwargs):
def env_options():
return {"host": "127.0.0.1",
"external_host": "web-platform.test",
"bind_hostname": "false",
"bind_hostname": False,
"testharnessreport": "testharnessreport-servo.js",
"supports_debugger": True}

View file

@ -1,7 +0,0 @@
{"host": "%(host)s",
"ports":{"http":[8000, 8001],
"https":[8443],
"ws":[8888]},
"check_subdomains":false,
"bind_hostname":%(bind_hostname)s,
"ssl":{}}

View file

@ -84,18 +84,29 @@ class TestEnvironment(object):
self.cache_manager = multiprocessing.Manager()
self.stash = serve.stash.StashServer()
self.env_extras = env_extras
self.env_extras_cms = None
def __enter__(self):
self.stash.__enter__()
self.ssl_env.__enter__()
self.cache_manager.__enter__()
for cm in self.env_extras:
cm.__enter__(self.options)
self.setup_server_logging()
self.config = self.load_config()
self.setup_server_logging()
ports = serve.get_ports(self.config, self.ssl_env)
self.config = serve.normalise_config(self.config, ports)
assert self.env_extras_cms is None, (
"A TestEnvironment object cannot be nested")
self.env_extras_cms = []
for env in self.env_extras:
cm = env(self.options, self.config)
cm.__enter__()
self.env_extras_cms.append(cm)
self.servers = serve.start(self.config, self.ssl_env,
self.get_routes())
if self.options.get("supports_debugger") and self.debug_info and self.debug_info.interactive:
@ -108,8 +119,11 @@ class TestEnvironment(object):
for scheme, servers in self.servers.iteritems():
for port, server in servers:
server.kill()
for cm in self.env_extras:
for cm in self.env_extras_cms:
cm.__exit__(exc_type, exc_val, exc_tb)
self.env_extras_cms = None
self.cache_manager.__exit__(exc_type, exc_val, exc_tb)
self.ssl_env.__exit__(exc_type, exc_val, exc_tb)
self.stash.__exit__()
@ -122,15 +136,23 @@ class TestEnvironment(object):
def load_config(self):
default_config_path = os.path.join(serve_path(self.test_paths), "config.default.json")
local_config_path = os.path.join(here, "config.json")
local_config = {
"ports": {
"http": [8000, 8001],
"https": [8443],
"ws": [8888]
},
"check_subdomains": False,
"bind_hostname": self.options["bind_hostname"],
"ssl": {}
}
if "host" in self.options:
local_config["host"] = self.options["host"]
with open(default_config_path) as f:
default_config = json.load(f)
with open(local_config_path) as f:
data = f.read()
local_config = json.loads(data % self.options)
#TODO: allow non-default configuration for ssl
local_config["external_host"] = self.options.get("external_host", None)

View file

@ -17,7 +17,10 @@ class FontInstaller(object):
self.created_dir = False
self.fonts = fonts
def __enter__(self, options=None):
def __call__(self, env_options=None, env_config=None):
return self
def __enter__(self):
for _, font_path in self.fonts.items():
font_name = font_path.split('/')[-1]
install = getattr(self, 'install_%s_font' % SYSTEM, None)

View file

@ -20,15 +20,15 @@ def test_sauceconnect_success():
exists.return_value = True
sauce_connect = sauce.SauceConnect(
config={
"domains": {"": "example.net"}
},
sauce_user="aaa",
sauce_key="bbb",
sauce_tunnel_id="ccc",
sauce_connect_binary="ddd")
sauce_connect.__enter__(None)
env_config = {
"domains": {"": "example.net"}
}
sauce_connect.__enter__(None, env_config)
@pytest.mark.parametrize("readyfile,returncode", [
@ -49,16 +49,16 @@ def test_sauceconnect_failure_exit(readyfile, returncode):
exists.return_value = readyfile
sauce_connect = sauce.SauceConnect(
config={
"domains": {"": "example.net"}
},
sauce_user="aaa",
sauce_key="bbb",
sauce_tunnel_id="ccc",
sauce_connect_binary="ddd")
env_config = {
"domains": {"": "example.net"}
}
with pytest.raises(sauce.SauceException):
sauce_connect.__enter__(None)
sauce_connect.__enter__(None, env_config)
# Given we appear to exit immediately with these mocks, sleep shouldn't be called
sleep.assert_not_called()
@ -74,16 +74,16 @@ def test_sauceconnect_failure_never_ready():
exists.return_value = False
sauce_connect = sauce.SauceConnect(
config={
"domains": {"": "example.net"}
},
sauce_user="aaa",
sauce_key="bbb",
sauce_tunnel_id="ccc",
sauce_connect_binary="ddd")
env_config = {
"domains": {"": "example.net"}
}
with pytest.raises(sauce.SauceException):
sauce_connect.__enter__(None)
sauce_connect.__enter__(None, env_config)
# We should sleep while waiting for it to create the readyfile
sleep.assert_called()
@ -102,15 +102,15 @@ def test_sauceconnect_tunnel_domains():
exists.return_value = True
sauce_connect = sauce.SauceConnect(
config={
"domains": {"foo": "foo.bar.example.com", "": "example.net"}
},
sauce_user="aaa",
sauce_key="bbb",
sauce_tunnel_id="ccc",
sauce_connect_binary="ddd")
sauce_connect.__enter__(None)
env_config = {
"domains": {"foo": "foo.bar.example.com", "": "example.net"}
}
sauce_connect.__enter__(None, env_config)
Popen.assert_called_once()
args, kwargs = Popen.call_args