diff --git a/examples/examples_test.sh b/examples/examples_test.sh index 7196d3012..577345cd0 100755 --- a/examples/examples_test.sh +++ b/examples/examples_test.sh @@ -1,27 +1,27 @@ #!/bin/bash # -# Copyright 2019 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# -set +e +set +e -x export TMPDIR=$(mktemp -d) trap "rm -rf ${TMPDIR}" EXIT clean () { - jobs -p | xargs pkill -P + jobs -p | xargs pkill -P wait } @@ -50,7 +50,7 @@ EXAMPLES=( "features/name_resolving" ) -declare -A EXPECTED_SERVER_OUTPUT=( +declare -A EXPECTED_SERVER_OUTPUT=( ["helloworld"]="Received: world" ["route_guide"]="" ["features/authentication"]="server starting on port 50051..." @@ -69,8 +69,8 @@ declare -A EXPECTED_CLIENT_OUTPUT=( ["helloworld"]="Greeting: Hello world" ["route_guide"]="location:" ["features/authentication"]="UnaryEcho: hello world" - ["features/compression"]="UnaryEcho call returned \"compress\", " - ["features/deadline"]="wanted = DeadlineExceeded, got = DeadlineExceeded" + ["features/compression"]="UnaryEcho call returned \"compress\", " + ["features/deadline"]="wanted = DeadlineExceeded, got = DeadlineExceeded" ["features/encryption/TLS"]="UnaryEcho: hello world" ["features/errors"]="Greeting: Hello world" ["features/interceptor"]="UnaryEcho: hello world" @@ -96,7 +96,7 @@ for example in ${EXAMPLES[@]}; do else pass "successfully built client" fi - + # Start server SERVER_LOG="$(mktemp)" go run ./examples/$example/*server/*.go &> $SERVER_LOG & @@ -126,7 +126,7 @@ for example in ${EXAMPLES[@]}; do else pass "server log contains expected output: ${EXPECTED_SERVER_OUTPUT[$example]}" fi - fi + fi # Check client log for expected output if expecting an # output @@ -142,7 +142,6 @@ for example in ${EXAMPLES[@]}; do pass "client log contains expected output: ${EXPECTED_CLIENT_OUTPUT[$example]}" fi fi - + clean done -