From 2f1cc8373ff47af6aed627cc178027ab5a6db366 Mon Sep 17 00:00:00 2001 From: moz-wptsync-bot Date: Mon, 30 Jul 2018 15:14:47 +0000 Subject: [PATCH] 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 --- testing/web-platform/tests/tools/serve/serve.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/testing/web-platform/tests/tools/serve/serve.py b/testing/web-platform/tests/tools/serve/serve.py index aea58cffffb1..60d95a04c4da 100644 --- a/testing/web-platform/tests/tools/serve/serve.py +++ b/testing/web-platform/tests/tools/serve/serve.py @@ -779,6 +779,11 @@ def get_parser(): help="Path to document root. Overrides config.") parser.add_argument("--ws_doc_root", action="store", dest="ws_doc_root", 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 @@ -791,6 +796,15 @@ def run(**kwargs): 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"]: check_subdomains(config)