mirror of
https://github.com/servo/servo.git
synced 2025-08-17 03:15:34 +01:00
Update web-platform-tests to revision 1e4fe87a7f01c0b5c614c8f601ffa68b4a00662a
This commit is contained in:
parent
4c3f1756da
commit
432648745e
164 changed files with 8354 additions and 595 deletions
|
@ -5,4 +5,3 @@ include wptrunner/testharness_runner.html
|
|||
include wptrunner/*.js
|
||||
include wptrunner/executors/*.js
|
||||
include wptrunner/config.json
|
||||
include wptrunner/browsers/server-locations.txt
|
|
@ -52,7 +52,6 @@ setup(name=PACKAGE_NAME,
|
|||
"testharness_runner.html",
|
||||
"config.json",
|
||||
"wptrunner.default.ini",
|
||||
"browsers/server-locations.txt",
|
||||
"browsers/sauce_setup/*",
|
||||
"prefs/*"]},
|
||||
include_package_data=True,
|
||||
|
|
|
@ -60,8 +60,7 @@ def env_extras(**kwargs):
|
|||
|
||||
|
||||
def env_options():
|
||||
return {"host": "web-platform.test",
|
||||
"bind_hostname": "true"}
|
||||
return {"bind_hostname": "true"}
|
||||
|
||||
|
||||
class ChromeBrowser(Browser):
|
||||
|
|
|
@ -68,8 +68,7 @@ def env_extras(**kwargs):
|
|||
|
||||
|
||||
def env_options():
|
||||
return {"host": "web-platform.test",
|
||||
"bind_hostname": "true"}
|
||||
return {"bind_hostname": "true"}
|
||||
|
||||
|
||||
class ChromeAndroidBrowser(Browser):
|
||||
|
|
|
@ -38,8 +38,7 @@ def env_extras(**kwargs):
|
|||
return []
|
||||
|
||||
def env_options():
|
||||
return {"host": "web-platform.test",
|
||||
"bind_hostname": "true",
|
||||
return {"bind_hostname": "true",
|
||||
"supports_debugger": False}
|
||||
|
||||
class EdgeBrowser(Browser):
|
||||
|
|
|
@ -3,12 +3,12 @@ import platform
|
|||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import mozinfo
|
||||
import mozleak
|
||||
from mozprocess import ProcessHandler
|
||||
from mozprofile import FirefoxProfile, Preferences
|
||||
from mozprofile.permissions import ServerLocations
|
||||
from mozrunner import FirefoxRunner
|
||||
from mozrunner.utils import get_stack_fixer_function
|
||||
from mozcrash import mozcrash
|
||||
|
@ -23,7 +23,6 @@ from ..executors import executor_kwargs as base_executor_kwargs
|
|||
from ..executors.executormarionette import (MarionetteTestharnessExecutor,
|
||||
MarionetteRefTestExecutor,
|
||||
MarionetteWdspecExecutor)
|
||||
from ..environment import hostnames
|
||||
|
||||
|
||||
here = os.path.join(os.path.split(__file__)[0])
|
||||
|
@ -80,7 +79,8 @@ def browser_kwargs(test_type, run_info_data, **kwargs):
|
|||
**kwargs),
|
||||
"leak_check": kwargs["leak_check"],
|
||||
"stylo_threads": kwargs["stylo_threads"],
|
||||
"chaos_mode_flags": kwargs["chaos_mode_flags"]}
|
||||
"chaos_mode_flags": kwargs["chaos_mode_flags"],
|
||||
"config": kwargs["config"]}
|
||||
|
||||
|
||||
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
|
||||
|
@ -102,7 +102,7 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
|
|||
if kwargs["binary_args"]:
|
||||
options["args"] = kwargs["binary_args"]
|
||||
options["prefs"] = {
|
||||
"network.dns.localDomains": ",".join(hostnames)
|
||||
"network.dns.localDomains": ",".join(server_config['domains'].values())
|
||||
}
|
||||
capabilities["moz:firefoxOptions"] = options
|
||||
if kwargs["certutil_binary"] is None:
|
||||
|
@ -143,7 +143,7 @@ class FirefoxBrowser(Browser):
|
|||
symbols_path=None, stackwalk_binary=None, certutil_binary=None,
|
||||
ca_certificate_path=None, e10s=False, stackfix_dir=None,
|
||||
binary_args=None, timeout_multiplier=None, leak_check=False, stylo_threads=1,
|
||||
chaos_mode_flags=None):
|
||||
chaos_mode_flags=None, config=None):
|
||||
Browser.__init__(self, logger)
|
||||
self.binary = binary
|
||||
self.prefs_root = prefs_root
|
||||
|
@ -159,6 +159,7 @@ class FirefoxBrowser(Browser):
|
|||
self.certutil_binary = certutil_binary
|
||||
self.e10s = e10s
|
||||
self.binary_args = binary_args
|
||||
self.config = config
|
||||
if stackfix_dir:
|
||||
self.stack_fixer = get_stack_fixer_function(stackfix_dir,
|
||||
self.symbols_path)
|
||||
|
@ -189,15 +190,12 @@ class FirefoxBrowser(Browser):
|
|||
if self.chaos_mode_flags is not None:
|
||||
env["MOZ_CHAOSMODE"] = str(self.chaos_mode_flags)
|
||||
|
||||
locations = ServerLocations(filename=os.path.join(here, "server-locations.txt"))
|
||||
|
||||
preferences = self.load_prefs()
|
||||
|
||||
self.profile = FirefoxProfile(locations=locations,
|
||||
preferences=preferences)
|
||||
self.profile = FirefoxProfile(preferences=preferences)
|
||||
self.profile.set_preferences({"marionette.port": self.marionette_port,
|
||||
"dom.disable_open_during_load": False,
|
||||
"network.dns.localDomains": ",".join(hostnames),
|
||||
"network.dns.localDomains": ",".join(self.config['domains'].values()),
|
||||
"network.proxy.type": 0,
|
||||
"places.history.enabled": False,
|
||||
"dom.send_after_paint_to_content": True,
|
||||
|
|
|
@ -42,8 +42,7 @@ def env_extras(**kwargs):
|
|||
return []
|
||||
|
||||
def env_options():
|
||||
return {"host": "web-platform.test",
|
||||
"bind_hostname": "true",
|
||||
return {"bind_hostname": "true",
|
||||
"supports_debugger": False}
|
||||
|
||||
class InternetExplorerBrowser(Browser):
|
||||
|
|
|
@ -60,8 +60,7 @@ def env_extras(**kwargs):
|
|||
|
||||
|
||||
def env_options():
|
||||
return {"host": "web-platform.test",
|
||||
"bind_hostname": "true"}
|
||||
return {"bind_hostname": "true"}
|
||||
|
||||
|
||||
class OperaBrowser(Browser):
|
||||
|
|
|
@ -113,8 +113,7 @@ def env_extras(**kwargs):
|
|||
|
||||
|
||||
def env_options():
|
||||
return {"host": "web-platform.test",
|
||||
"bind_hostname": "true",
|
||||
return {"bind_hostname": "true",
|
||||
"supports_debugger": False}
|
||||
|
||||
|
||||
|
@ -128,6 +127,7 @@ 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"]
|
||||
|
@ -153,8 +153,7 @@ class SauceConnect():
|
|||
"--metrics-address=0.0.0.0:9876",
|
||||
"--readyfile=./sauce_is_ready",
|
||||
"--tunnel-domains",
|
||||
"web-platform.test",
|
||||
"*.web-platform.test"
|
||||
",".join(self.config['domains'].values())
|
||||
])
|
||||
|
||||
# Timeout config vars
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
http://localhost:8000 primary
|
||||
|
||||
http://web-platform.test:8000
|
||||
http://www.web-platform.test:8000
|
||||
http://www1.web-platform.test:8000
|
||||
http://www2.web-platform.test:8000
|
||||
http://xn--n8j6ds53lwwkrqhv28a.web-platform.test:8000
|
||||
http://xn--lve-6lad.web-platform.test:8000
|
||||
|
||||
http://web-platform.test:8001
|
||||
http://www.web-platform.test:8001
|
||||
http://www1.web-platform.test:8001
|
||||
http://www2.web-platform.test:8001
|
||||
http://xn--n8j6ds53lwwkrqhv28a.web-platform.test:8001
|
||||
http://xn--lve-6lad.web-platform.test:8001
|
||||
|
||||
https://web-platform.test:8443
|
||||
https://www.web-platform.test:8443
|
||||
https://www1.web-platform.test:8443
|
||||
https://www2.web-platform.test:8443
|
||||
https://xn--n8j6ds53lwwkrqhv28a.web-platform.test:8443
|
||||
https://xn--lve-6lad.web-platform.test:8443
|
||||
|
||||
# These are actually ws servers, but until mozprofile is
|
||||
# fixed we have to pretend that they are http servers
|
||||
http://web-platform.test:8888
|
||||
http://www.web-platform.test:8888
|
||||
http://www1.web-platform.test:8888
|
||||
http://www2.web-platform.test:8888
|
||||
http://xn--n8j6ds53lwwkrqhv28a.web-platform.test:8888
|
||||
http://xn--lve-6lad.web-platform.test:8888
|
|
@ -1,9 +1,12 @@
|
|||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
from mozprocess import ProcessHandler
|
||||
|
||||
from tools.serve.serve import make_hosts_file
|
||||
|
||||
from .base import Browser, require_arg, get_free_port, browser_command, ExecutorBrowser
|
||||
from ..executors import executor_kwargs as base_executor_kwargs
|
||||
from ..executors.executorservodriver import (ServoWebDriverTestharnessExecutor,
|
||||
|
@ -26,14 +29,6 @@ __wptrunner__ = {
|
|||
"update_properties": "update_properties",
|
||||
}
|
||||
|
||||
hosts_text = """127.0.0.1 web-platform.test
|
||||
127.0.0.1 www.web-platform.test
|
||||
127.0.0.1 www1.web-platform.test
|
||||
127.0.0.1 www2.web-platform.test
|
||||
127.0.0.1 xn--n8j6ds53lwwkrqhv28a.web-platform.test
|
||||
127.0.0.1 xn--lve-6lad.web-platform.test
|
||||
"""
|
||||
|
||||
|
||||
def check_args(**kwargs):
|
||||
require_arg(kwargs, "binary")
|
||||
|
@ -69,10 +64,10 @@ def update_properties():
|
|||
return ["debug", "os", "version", "processor", "bits"], None
|
||||
|
||||
|
||||
def make_hosts_file():
|
||||
def write_hosts_file(config):
|
||||
hosts_fd, hosts_path = tempfile.mkstemp()
|
||||
with os.fdopen(hosts_fd, "w") as f:
|
||||
f.write(hosts_text)
|
||||
f.write(make_hosts_file(config, "127.0.0.1"))
|
||||
return hosts_path
|
||||
|
||||
|
||||
|
@ -87,7 +82,7 @@ class ServoWebDriverBrowser(Browser):
|
|||
self.webdriver_port = None
|
||||
self.proc = None
|
||||
self.debug_info = debug_info
|
||||
self.hosts_path = make_hosts_file()
|
||||
self.hosts_path = write_hosts_file()
|
||||
self.command = None
|
||||
self.user_stylesheets = user_stylesheets if user_stylesheets else []
|
||||
|
||||
|
@ -158,6 +153,7 @@ class ServoWebDriverBrowser(Browser):
|
|||
|
||||
def cleanup(self):
|
||||
self.stop()
|
||||
shutil.rmtree(os.path.dirname(self.hosts_file))
|
||||
|
||||
def executor_browser(self):
|
||||
assert self.webdriver_port is not None
|
||||
|
|
|
@ -18,14 +18,6 @@ serve = None
|
|||
sslutils = None
|
||||
|
||||
|
||||
hostnames = ["web-platform.test",
|
||||
"www.web-platform.test",
|
||||
"www1.web-platform.test",
|
||||
"www2.web-platform.test",
|
||||
"xn--n8j6ds53lwwkrqhv28a.web-platform.test",
|
||||
"xn--lve-6lad.web-platform.test"]
|
||||
|
||||
|
||||
def do_delayed_imports(logger, test_paths):
|
||||
global serve, sslutils
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ from collections import defaultdict
|
|||
|
||||
from mozprocess import ProcessHandler
|
||||
|
||||
from tools.serve.serve import make_hosts_file
|
||||
|
||||
from .base import (ExecutorException,
|
||||
Protocol,
|
||||
RefTestImplementation,
|
||||
|
@ -30,18 +32,10 @@ webdriver = None
|
|||
|
||||
extra_timeout = 5 # seconds
|
||||
|
||||
hosts_text = """127.0.0.1 web-platform.test
|
||||
127.0.0.1 www.web-platform.test
|
||||
127.0.0.1 www1.web-platform.test
|
||||
127.0.0.1 www2.web-platform.test
|
||||
127.0.0.1 xn--n8j6ds53lwwkrqhv28a.web-platform.test
|
||||
127.0.0.1 xn--lve-6lad.web-platform.test
|
||||
"""
|
||||
|
||||
def make_hosts_file():
|
||||
def write_hosts_file(config):
|
||||
hosts_fd, hosts_path = tempfile.mkstemp()
|
||||
with os.fdopen(hosts_fd, "w") as f:
|
||||
f.write(hosts_text)
|
||||
f.write(make_hosts_file(config, "127.0.0.1"))
|
||||
return hosts_path
|
||||
|
||||
|
||||
|
@ -57,7 +51,7 @@ class ServoTestharnessExecutor(ProcessTestExecutor):
|
|||
self.result_data = None
|
||||
self.result_flag = None
|
||||
self.protocol = Protocol(self, browser)
|
||||
self.hosts_path = make_hosts_file()
|
||||
self.hosts_path = write_hosts_file(server_config)
|
||||
|
||||
def teardown(self):
|
||||
try:
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
class HostsLine(object):
|
||||
def __init__(self, ip_address, canonical_hostname, aliases=None, comment=None):
|
||||
self.ip_address = ip_address
|
||||
self.canonical_hostname = canonical_hostname
|
||||
self.aliases = aliases if aliases is not None else []
|
||||
self.comment = comment
|
||||
if self.ip_address is None:
|
||||
assert self.canonical_hostname is None
|
||||
assert not self.aliases
|
||||
assert self.comment is not None
|
||||
|
||||
@classmethod
|
||||
def from_string(cls, line):
|
||||
if not line.strip():
|
||||
return
|
||||
|
||||
line = line.strip()
|
||||
|
||||
ip_address = None
|
||||
canonical_hostname = None
|
||||
aliases = []
|
||||
comment = None
|
||||
|
||||
comment_parts = line.split("#", 1)
|
||||
if len(comment_parts) > 1:
|
||||
comment = comment_parts[1]
|
||||
|
||||
data = comment_parts[0].strip()
|
||||
|
||||
if data:
|
||||
fields = data.split()
|
||||
if len(fields) < 2:
|
||||
raise ValueError("Invalid hosts line")
|
||||
|
||||
ip_address = fields[0]
|
||||
canonical_hostname = fields[1]
|
||||
aliases = fields[2:]
|
||||
|
||||
return cls(ip_address, canonical_hostname, aliases, comment)
|
||||
|
||||
|
||||
class HostsFile(object):
|
||||
def __init__(self):
|
||||
self.data = []
|
||||
self.by_hostname = {}
|
||||
|
||||
def set_host(self, host):
|
||||
if host.canonical_hostname is None:
|
||||
self.data.append(host)
|
||||
elif host.canonical_hostname in self.by_hostname:
|
||||
old_host = self.by_hostname[host.canonical_hostname]
|
||||
old_host.ip_address = host.ip_address
|
||||
old_host.aliases = host.aliases
|
||||
old_host.comment = host.comment
|
||||
else:
|
||||
self.data.append(host)
|
||||
self.by_hostname[host.canonical_hostname] = host
|
||||
|
||||
@classmethod
|
||||
def from_file(cls, f):
|
||||
rv = cls()
|
||||
for line in f:
|
||||
host = HostsLine.from_string(line)
|
||||
if host is not None:
|
||||
rv.set_host(host)
|
||||
return rv
|
||||
|
||||
def to_string(self):
|
||||
field_widths = [0, 0]
|
||||
for line in self.data:
|
||||
if line.ip_address is not None:
|
||||
field_widths[0] = max(field_widths[0], len(line.ip_address))
|
||||
field_widths[1] = max(field_widths[1], len(line.canonical_hostname))
|
||||
|
||||
lines = []
|
||||
|
||||
for host in self.data:
|
||||
line = ""
|
||||
if host.ip_address is not None:
|
||||
ip_string = host.ip_address.ljust(field_widths[0])
|
||||
hostname_str = host.canonical_hostname
|
||||
if host.aliases:
|
||||
hostname_str = "%s %s" % (hostname_str.ljust(field_widths[1]),
|
||||
" ".join(host.aliases))
|
||||
line = "%s %s" % (ip_string, hostname_str)
|
||||
if host.comment:
|
||||
if line:
|
||||
line += " "
|
||||
line += "#%s" % host.comment
|
||||
lines.append(line)
|
||||
|
||||
lines.append("")
|
||||
|
||||
return "\n".join(lines)
|
||||
|
||||
def to_file(self, f):
|
||||
f.write(self.to_string().encode("utf8"))
|
|
@ -20,6 +20,9 @@ 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",
|
||||
|
@ -46,6 +49,9 @@ 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",
|
||||
|
@ -68,6 +74,9 @@ 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",
|
||||
|
@ -82,3 +91,34 @@ def test_sauceconnect_failure_never_ready():
|
|||
# Check we actually kill it after termination fails
|
||||
Popen.return_value.terminate.assert_called()
|
||||
Popen.return_value.kill.assert_called()
|
||||
|
||||
|
||||
def test_sauceconnect_tunnel_domains():
|
||||
with mock.patch.object(sauce.SauceConnect, "upload_prerun_exec"),\
|
||||
mock.patch.object(sauce.subprocess, "Popen") as Popen,\
|
||||
mock.patch.object(sauce.os.path, "exists") as exists:
|
||||
Popen.return_value.poll.return_value = None
|
||||
Popen.return_value.returncode = None
|
||||
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)
|
||||
|
||||
Popen.assert_called_once()
|
||||
args, kwargs = Popen.call_args
|
||||
cmd = args[0]
|
||||
assert "--tunnel-domains" in cmd
|
||||
i = cmd.index("--tunnel-domains")
|
||||
rest = cmd[i+1:]
|
||||
assert len(rest) >= 1
|
||||
if len(rest) > 1:
|
||||
assert rest[1].startswith("-"), "--tunnel-domains takes a comma separated list (not a space separated list)"
|
||||
assert set(rest[0].split(",")) == {"foo.bar.example.com", "example.net"}
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
import unittest
|
||||
import sys
|
||||
from os.path import join, dirname
|
||||
from cStringIO import StringIO
|
||||
|
||||
sys.path.insert(0, join(dirname(__file__), "..", ".."))
|
||||
|
||||
from wptrunner import hosts
|
||||
|
||||
|
||||
class HostsTest(unittest.TestCase):
|
||||
def do_test(self, input, expected):
|
||||
host_file = hosts.HostsFile.from_file(StringIO(input))
|
||||
self.assertEquals(host_file.to_string(), expected)
|
||||
|
||||
def test_simple(self):
|
||||
self.do_test("""127.0.0.1 \tlocalhost alias # comment
|
||||
# Another comment""",
|
||||
"""127.0.0.1 localhost alias # comment
|
||||
# Another comment
|
||||
""")
|
||||
|
||||
def test_blank_lines(self):
|
||||
self.do_test("""127.0.0.1 \tlocalhost alias # comment
|
||||
|
||||
\r
|
||||
\t
|
||||
# Another comment""",
|
||||
"""127.0.0.1 localhost alias # comment
|
||||
# Another comment
|
||||
""")
|
||||
|
||||
def test_whitespace(self):
|
||||
self.do_test(""" \t127.0.0.1 \tlocalhost alias # comment \r
|
||||
\t# Another comment""",
|
||||
"""127.0.0.1 localhost alias # comment
|
||||
# Another comment
|
||||
""")
|
||||
|
||||
def test_alignment(self):
|
||||
self.do_test("""127.0.0.1 \tlocalhost alias
|
||||
192.168.1.1 another_host another_alias
|
||||
""","""127.0.0.1 localhost alias
|
||||
192.168.1.1 another_host another_alias
|
||||
""")
|
||||
|
||||
def test_multiple_same_name(self):
|
||||
# The semantics are that we overwrite earlier entries with the same name
|
||||
self.do_test("""127.0.0.1 \tlocalhost alias
|
||||
192.168.1.1 localhost another_alias""","""192.168.1.1 localhost another_alias
|
||||
""")
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
|
@ -218,6 +218,7 @@ def run_tests(config, test_paths, product, **kwargs):
|
|||
browser_kwargs = get_browser_kwargs(test_type,
|
||||
run_info,
|
||||
ssl_env=ssl_env,
|
||||
config=test_environment.config,
|
||||
**kwargs)
|
||||
|
||||
executor_cls = executor_classes.get(test_type)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue