Index: third_party/grpc/test/distrib/node/run_distrib_test.sh |
diff --git a/third_party/WebKit/LayoutTests/http/tests/websocket/close_wsh.py b/third_party/grpc/test/distrib/node/run_distrib_test.sh |
old mode 100644 |
new mode 100755 |
similarity index 65% |
copy from third_party/WebKit/LayoutTests/http/tests/websocket/close_wsh.py |
copy to third_party/grpc/test/distrib/node/run_distrib_test.sh |
index 1b02d66267e294ce83977dac64f075981705647c..13a42fcb0a217d906845972599f9d59a5f5f72ad |
--- a/third_party/WebKit/LayoutTests/http/tests/websocket/close_wsh.py |
+++ b/third_party/grpc/test/distrib/node/run_distrib_test.sh |
@@ -1,4 +1,5 @@ |
-# Copyright 2011, Google Inc. |
+#!/bin/bash |
+# Copyright 2015-2016, Google Inc. |
# All rights reserved. |
# |
# Redistribution and use in source and binary forms, with or without |
@@ -27,27 +28,36 @@ |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+function finish() { |
+ rv=$? |
+ kill $STATIC_PID || true |
+ curl "localhost:32767/drop/$STATIC_PORT" || true |
+ exit $rv |
+} |
-import logging |
-_GOODBYE_MESSAGE = u'Goodbye' |
+trap finish EXIT |
+NODE_VERSION=$1 |
+source ~/.nvm/nvm.sh |
-def web_socket_do_extra_handshake(request): |
- pass # Always accept. |
+cd $(dirname $0) |
+nvm install $NODE_VERSION |
+set -ex |
-def web_socket_transfer_data(request): |
- while True: |
- line = request.ws_stream.receive_message() |
- if line is None: |
- return |
- if isinstance(line, unicode): |
- request.ws_stream.send_message(line, binary=False) |
- if line == _GOODBYE_MESSAGE: |
- return |
- else: |
- request.ws_stream.send_message(line, binary=True) |
+npm install -g node-static |
+STATIC_SERVER=127.0.0.1 |
+# If port_server is running, get port from that. Otherwise, assume we're in |
+# docker and use 8080 |
+STATIC_PORT=$(curl 'localhost:32767/get' || echo '8080') |
-def web_socket_passive_closing_handshake(request): |
- return request.ws_close_code, request.ws_close_reason |
+# Serves the input_artifacts directory statically at localhost: |
+static "$EXTERNAL_GIT_ROOT/input_artifacts" -a $STATIC_SERVER -p $STATIC_PORT & |
+STATIC_PID=$! |
+ |
+STATIC_URL="http://$STATIC_SERVER:$STATIC_PORT/" |
+ |
+npm install --unsafe-perm $STATIC_URL/grpc.tgz --grpc_node_binary_host_mirror=$STATIC_URL |
+ |
+./distrib_test.js |