From c3f95a5b4f43a719abcb6e0807efe116af14fbac Mon Sep 17 00:00:00 2001 From: James Graham Date: Tue, 20 Jun 2017 14:22:11 +0100 Subject: [PATCH] Add a serve command to the wpt frontend --- README.md | 3 ++- ci_unittest.sh | 4 ++-- tools/serve/commands.json | 2 ++ tools/serve/serve.py | 8 ++++++-- tools/wpt/paths | 3 ++- 5 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 tools/serve/commands.json diff --git a/README.md b/README.md index d5ab579c16d120..37a08c60b4a38c 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Running Tests Manually The test server can be started using - ./serve + ./wpt serve This will start HTTP servers on two ports and a websockets server on one port. By default one web server starts on port 8000 and the other @@ -121,6 +121,7 @@ The `wpt` command provides a frontend to a variety of tools for working with and running web-platform-tests. Some of the most useful commands are: +* `wpt serve` - For starting the wpt http server * `wpt run` - For running tests in a browser * `wpt lint` - For running the lint against all tests * `wpt manifest` - For updating or generating a `MANIFEST.json` test manifest diff --git a/ci_unittest.sh b/ci_unittest.sh index 5bffd22d6c1a8b..6d1b6224b58321 100755 --- a/ci_unittest.sh +++ b/ci_unittest.sh @@ -13,8 +13,8 @@ if [ $TOXENV == "py27" ] || [ $TOXENV == "pypy" ]; then cd $ROOT pip install --requirement tools/browserutils/requirements.txt - wpt install firefox browser --destination $HOME - wpt install firefox webdriver --destination $HOME/firefox + ./wpt install firefox browser --destination $HOME + ./wpt install firefox webdriver --destination $HOME/firefox export PATH=$HOME/firefox:$PATH cd $ROOT/resources/test diff --git a/tools/serve/commands.json b/tools/serve/commands.json new file mode 100644 index 00000000000000..abcb2970b63f48 --- /dev/null +++ b/tools/serve/commands.json @@ -0,0 +1,2 @@ +{"serve": {"path": "serve.py", "script": "run", "parser": "get_parser", "help": "Run wptserve server", + "virtualenv": false}} diff --git a/tools/serve/serve.py b/tools/serve/serve.py index c0991366f2e55e..125c958a250cfb 100644 --- a/tools/serve/serve.py +++ b/tools/serve/serve.py @@ -762,8 +762,7 @@ def get_parser(): return parser -def main(): - kwargs = vars(get_parser().parse_args()) +def run(**kwargs): config = load_config("config.default.json", "config.json", **kwargs) @@ -784,3 +783,8 @@ def main(): item.join(1) except KeyboardInterrupt: logger.info("Shutting down") + + +def main(): + kwargs = vars(get_parser().parse_args()) + return run(**kwargs) diff --git a/tools/wpt/paths b/tools/wpt/paths index 2c92f074999816..dee93efa62eca4 100644 --- a/tools/wpt/paths +++ b/tools/wpt/paths @@ -1,4 +1,5 @@ -tools/wpt/ tools/browserutils/ tools/lint/ tools/manifest/ +tools/serve/ +tools/wpt/