mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision 81962ac8802223d038b188b6f9cb88a0a9c5beee
This commit is contained in:
parent
fe1a057bd1
commit
24183668c4
1960 changed files with 29853 additions and 10555 deletions
|
@ -7,6 +7,7 @@ import argparse
|
|||
import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import socket
|
||||
import sys
|
||||
import threading
|
||||
|
@ -399,9 +400,13 @@ class ServerProc(object):
|
|||
return self.proc.is_alive()
|
||||
|
||||
|
||||
def check_subdomains(domains, paths, bind_address, ssl_config, aliases):
|
||||
domains = domains.copy()
|
||||
host = domains.pop("")
|
||||
def check_subdomains(config):
|
||||
paths = config.paths
|
||||
bind_address = config.bind_address
|
||||
ssl_config = config.ssl_config
|
||||
aliases = config.aliases
|
||||
|
||||
host = config.server_host
|
||||
port = get_port(host)
|
||||
logger.debug("Going to use port %d to check subdomains" % port)
|
||||
|
||||
|
@ -423,7 +428,10 @@ def check_subdomains(domains, paths, bind_address, ssl_config, aliases):
|
|||
"You may need to edit /etc/hosts or similar, see README.md." % (host, port))
|
||||
sys.exit(1)
|
||||
|
||||
for domain in domains.itervalues():
|
||||
for domain in config.domains_set:
|
||||
if domain == host:
|
||||
continue
|
||||
|
||||
try:
|
||||
urllib2.urlopen("http://%s:%d/" % (domain, port))
|
||||
except Exception as e:
|
||||
|
@ -437,11 +445,19 @@ def check_subdomains(domains, paths, bind_address, ssl_config, aliases):
|
|||
def make_hosts_file(config, host):
|
||||
rv = []
|
||||
|
||||
for domain in config["domains"].values():
|
||||
for domain in config.domains_set:
|
||||
rv.append("%s\t%s\n" % (host, domain))
|
||||
|
||||
for not_domain in config.get("not_domains", {}).values():
|
||||
rv.append("0.0.0.0\t%s\n" % not_domain)
|
||||
# Windows interpets the IP address 0.0.0.0 as non-existent, making it an
|
||||
# appropriate alias for non-existent hosts. However, UNIX-like systems
|
||||
# interpret the same address to mean any IP address, which is inappropraite
|
||||
# for this context. These systems do not reserve any value for this
|
||||
# purpose, so the inavailability of the domains must be taken for granted.
|
||||
#
|
||||
# https://github.com/w3c/web-platform-tests/issues/10560
|
||||
if platform.uname()[0] == "Windows":
|
||||
for not_domain in config.not_domains_set:
|
||||
rv.append("0.0.0.0\t%s\n" % not_domain)
|
||||
|
||||
return "".join(rv)
|
||||
|
||||
|
@ -613,16 +629,10 @@ def iter_procs(servers):
|
|||
yield server.proc
|
||||
|
||||
|
||||
def load_config(default_path, override_path=None, **kwargs):
|
||||
if os.path.exists(default_path):
|
||||
with open(default_path) as f:
|
||||
base_obj = json.load(f)
|
||||
else:
|
||||
raise ValueError("Config path %s does not exist" % default_path)
|
||||
def load_config(override_path=None, **kwargs):
|
||||
rv = Config()
|
||||
|
||||
rv = Config(**base_obj)
|
||||
|
||||
if os.path.exists(override_path):
|
||||
if override_path and os.path.exists(override_path):
|
||||
with open(override_path) as f:
|
||||
override_obj = json.load(f)
|
||||
rv.update(override_obj)
|
||||
|
@ -655,12 +665,49 @@ _subdomains = {u"www",
|
|||
u"天気の良い日",
|
||||
u"élève"}
|
||||
|
||||
_not_subdomains = {u"nonexistent-origin"}
|
||||
_not_subdomains = {u"nonexistent"}
|
||||
|
||||
|
||||
class Config(config.Config):
|
||||
"""serve config
|
||||
|
||||
this subclasses wptserve.config.Config to add serve config options"""
|
||||
|
||||
_default = {
|
||||
"browser_host": "web-platform.test",
|
||||
"alternate_hosts": {
|
||||
"alt": "not-web-platform.test"
|
||||
},
|
||||
"doc_root": repo_root,
|
||||
"ws_doc_root": os.path.join(repo_root, "websockets", "handlers"),
|
||||
"server_host": None,
|
||||
"ports": {
|
||||
"http": [8000, "auto"],
|
||||
"https": [8443],
|
||||
"ws": ["auto"],
|
||||
"wss": ["auto"]
|
||||
},
|
||||
"check_subdomains": True,
|
||||
"log_level": "debug",
|
||||
"bind_address": True,
|
||||
"ssl": {
|
||||
"type": "pregenerated",
|
||||
"encrypt_after_connect": False,
|
||||
"openssl": {
|
||||
"openssl_binary": "openssl",
|
||||
"base_path": "_certs",
|
||||
"force_regenerate": False,
|
||||
"base_conf_path": None
|
||||
},
|
||||
"pregenerated": {
|
||||
"host_key_path": os.path.join(repo_root, "tools", "certs", "web-platform.test.key"),
|
||||
"host_cert_path": os.path.join(repo_root, "tools", "certs", "web-platform.test.pem")
|
||||
},
|
||||
"none": {}
|
||||
},
|
||||
"aliases": []
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Config, self).__init__(
|
||||
subdomains=_subdomains,
|
||||
|
@ -669,6 +716,23 @@ class Config(config.Config):
|
|||
**kwargs
|
||||
)
|
||||
|
||||
@property
|
||||
def ws_doc_root(self):
|
||||
if self._ws_doc_root is not None:
|
||||
return self._ws_doc_root
|
||||
else:
|
||||
return os.path.join(self.doc_root, "websockets", "handlers")
|
||||
|
||||
@ws_doc_root.setter
|
||||
def ws_doc_root(self, v):
|
||||
self._ws_doc_root = v
|
||||
|
||||
@property
|
||||
def paths(self):
|
||||
rv = super(Config, self).paths
|
||||
rv["ws_doc_root"] = self.ws_doc_root
|
||||
return rv
|
||||
|
||||
|
||||
def get_parser():
|
||||
parser = argparse.ArgumentParser()
|
||||
|
@ -684,8 +748,7 @@ def get_parser():
|
|||
|
||||
|
||||
def run(**kwargs):
|
||||
config = load_config(os.path.join(repo_root, "config.default.json"),
|
||||
os.path.join(repo_root, "config.json"),
|
||||
config = load_config(os.path.join(repo_root, "config.json"),
|
||||
**kwargs)
|
||||
|
||||
global logger
|
||||
|
@ -695,9 +758,7 @@ def run(**kwargs):
|
|||
bind_address = config["bind_address"]
|
||||
|
||||
if config["check_subdomains"]:
|
||||
paths = config.paths
|
||||
ssl_config = config.ssl_config
|
||||
check_subdomains(config.domains, paths, bind_address, ssl_config, config["aliases"])
|
||||
check_subdomains(config)
|
||||
|
||||
stash_address = None
|
||||
if bind_address:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue