| Index: third_party/grpc/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py b/third_party/grpc/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
|
| old mode 100644
|
| new mode 100755
|
| similarity index 60%
|
| copy from third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py
|
| copy to third_party/grpc/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
|
| index 429f58186e3fce43dc21e81e0f9d7e20c7e0bf70..d56bc0183118c8016ad1845d9c8c1f19a144334f
|
| --- a/third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py
|
| +++ b/third_party/grpc/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
|
| @@ -1,4 +1,5 @@
|
| -# Copyright 2010, Google Inc.
|
| +#!/bin/bash
|
| +# Copyright 2015-2016, Google Inc.
|
| # All rights reserved.
|
| #
|
| # Redistribution and use in source and binary forms, with or without
|
| @@ -27,20 +28,46 @@
|
| # (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 -e
|
|
|
| -from mod_pywebsocket import msgutil
|
| +# directories to run against
|
| +DIRS="src/core src/cpp test/core test/cpp include"
|
|
|
| +# file matching patterns to check
|
| +GLOB="*.h *.c *.cc"
|
|
|
| -_GOODBYE_MESSAGE = 'Goodbye'
|
| +# clang format command
|
| +CLANG_FORMAT=clang-format-3.6
|
|
|
| +files=
|
| +for dir in $DIRS
|
| +do
|
| + for glob in $GLOB
|
| + do
|
| + files="$files `find /local-code/$dir -name $glob -and -not -name *.generated.* -and -not -name *.pb.h -and -not -name *.pb.c`"
|
| + done
|
| +done
|
|
|
| -def web_socket_do_extra_handshake(request):
|
| - pass # Always accept.
|
| +# The CHANGED_FILES variable is used to restrict the set of files to check.
|
| +# Here we set files to the intersection of files and CHANGED_FILES
|
| +if [ -n "$CHANGED_FILES" ]; then
|
| + files=$(comm -12 <(echo $files | tr ' ' '\n' | sort -u) <(echo $CHANGED_FILES | tr ' ' '\n' | sort -u))
|
| +fi
|
|
|
| -
|
| -def web_socket_transfer_data(request):
|
| - while True:
|
| - line = msgutil.receive_message(request)
|
| - msgutil.send_message(request, line)
|
| - if line == _GOODBYE_MESSAGE:
|
| - return
|
| +if [ "x$TEST" = "x" ]
|
| +then
|
| + echo $files | xargs $CLANG_FORMAT -i
|
| +else
|
| + ok=yes
|
| + for file in $files
|
| + do
|
| + tmp=`mktemp`
|
| + $CLANG_FORMAT $file > $tmp
|
| + diff -u $file $tmp || ok=no
|
| + rm $tmp
|
| + done
|
| + if [ $ok == no ]
|
| + then
|
| + false
|
| + fi
|
| +fi
|
|
|