Bug 1478188 [wpt PR 12172] - Exposed support for multiple document roots, a=testonly

Automatic update from web-platform-testsAdded a way to specify aliases using command line.

--

wpt-commits: 3f67724a2abefcbdf43e8797579a2e2c2c6a40f8
wpt-pr: 12172
This commit is contained in:
moz-wptsync-bot 2018-07-30 15:14:47 +00:00
Родитель e8be4f2c8b
Коммит 2f1cc8373f
1 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -779,6 +779,11 @@ def get_parser():
help="Path to document root. Overrides config.") help="Path to document root. Overrides config.")
parser.add_argument("--ws_doc_root", action="store", dest="ws_doc_root", parser.add_argument("--ws_doc_root", action="store", dest="ws_doc_root",
help="Path to WebSockets document root. Overrides config.") help="Path to WebSockets document root. Overrides config.")
parser.add_argument("--alias_file", action="store", dest="alias_file",
help="File with entries for aliases/multiple doc roots. In form of `/ALIAS_NAME/, DOC_ROOT\\n`")
parser.add_argument("--h2", action="store_true", dest="h2",
help="Flag for enabling the HTTP/2.0 server")
parser.set_defaults(h2=False)
return parser return parser
@ -791,6 +796,15 @@ def run(**kwargs):
bind_address = config["bind_address"] bind_address = config["bind_address"]
if kwargs.get("alias_file"):
with open(kwargs["alias_file"], 'r') as alias_file:
for line in alias_file:
alias, doc_root = [x.strip() for x in line.split(',')]
config["aliases"].append({
'url-path': alias,
'local-dir': doc_root,
})
if config["check_subdomains"]: if config["check_subdomains"]:
check_subdomains(config) check_subdomains(config)