Index: third_party/grpc/tools/distrib/check_nanopb_output.sh |
diff --git a/third_party/WebKit/LayoutTests/http/tests/websocket/close_wsh.py b/third_party/grpc/tools/distrib/check_nanopb_output.sh |
old mode 100644 |
new mode 100755 |
similarity index 61% |
copy from third_party/WebKit/LayoutTests/http/tests/websocket/close_wsh.py |
copy to third_party/grpc/tools/distrib/check_nanopb_output.sh |
index 1b02d66267e294ce83977dac64f075981705647c..5f49ebb93e645981c3e15c2c624866eea2e7c1b9 |
--- a/third_party/WebKit/LayoutTests/http/tests/websocket/close_wsh.py |
+++ b/third_party/grpc/tools/distrib/check_nanopb_output.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,41 @@ |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+set -ex |
-import logging |
-_GOODBYE_MESSAGE = u'Goodbye' |
+apt-get install -y autoconf automake libtool curl python-virtualenv |
+readonly NANOPB_TMP_OUTPUT="$(mktemp -d)" |
-def web_socket_do_extra_handshake(request): |
- pass # Always accept. |
+# install protoc version 3 |
+pushd third_party/protobuf |
+./autogen.sh |
+./configure |
+make |
+make install |
+ldconfig |
+popd |
+if [ ! -x "/usr/local/bin/protoc" ]; then |
+ echo "Error: protoc not found in path" |
+ exit 1 |
+fi |
+readonly PROTOC_PATH='/usr/local/bin' |
+# stack up and change to nanopb's proto generator directory |
+pushd third_party/nanopb/generator/proto |
+PATH="$PROTOC_PATH:$PATH" make |
-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) |
+# back to the root directory |
+popd |
-def web_socket_passive_closing_handshake(request): |
- return request.ws_close_code, request.ws_close_reason |
+# nanopb-compile the proto to a temp location |
+PATH="$PROTOC_PATH:$PATH" ./tools/codegen/core/gen_load_balancing_proto.sh \ |
+ src/proto/grpc/lb/v0/load_balancer.proto \ |
+ $NANOPB_TMP_OUTPUT |
+ |
+# compare outputs to checked compiled code |
+if ! diff -r $NANOPB_TMP_OUTPUT src/core/proto/grpc/lb/v0; then |
+ echo "Outputs differ: $NANOPB_TMP_OUTPUT vs src/core/proto/grpc/lb/v0" |
+ exit 2 |
+fi |