1#!/usr/bin/env bash 2 3set -eu 4set -o pipefail 5 6set -x 7 8echo "Running for OS: ${OSTYPE}" 9 10case "$OSTYPE" in 11 darwin*) OS="darwin"; EXT="" ;; 12 linux*) OS="linux"; EXT="" ;; 13 msys*) OS="windows"; EXT=".exe" ;; 14 *) exit 2 ;; 15esac 16 17ARG="${1:-""}" 18 19 20(cd interop && cargo build --bins) 21 22SERVER="interop/bin/server_${OS}_amd64${EXT}" 23 24# TLS_CA="interop/data/ca.pem" 25TLS_CRT="interop/data/server1.pem" 26TLS_KEY="interop/data/server1.key" 27 28# run the test server 29./"${SERVER}" ${ARG} --tls_cert_file $TLS_CRT --tls_key_file $TLS_KEY & 30SERVER_PID=$! 31echo ":; started grpc-go test server." 32 33# trap exits to make sure we kill the server process when the script exits, 34# regardless of why (errors, SIGTERM, etc). 35trap 'echo ":; killing test server"; kill ${SERVER_PID};' EXIT 36 37sleep 1 38 39./target/debug/client \ 40 --test_case=empty_unary,large_unary,client_streaming,server_streaming,ping_pong,\ 41empty_stream,status_code_and_message,special_status_message,unimplemented_method,\ 42unimplemented_service,custom_metadata ${ARG} 43 44echo ":; killing test server"; kill ${SERVER_PID}; 45 46# run the test server 47./target/debug/server ${ARG} & 48SERVER_PID=$! 49echo ":; started tonic test server." 50 51# trap exits to make sure we kill the server process when the script exits, 52# regardless of why (errors, SIGTERM, etc). 53trap 'echo ":; killing test server"; kill ${SERVER_PID};' EXIT 54 55sleep 1 56 57./target/debug/client \ 58--test_case=empty_unary,large_unary,client_streaming,server_streaming,ping_pong,\ 59empty_stream,status_code_and_message,special_status_message,unimplemented_method,\ 60unimplemented_service,custom_metadata ${ARG} 61 62if [ -z "${ARG}" ]; then 63 # TODO: run all other test cases w/wo tls 64 GO_CLIENT="interop/bin/client_${OS}_amd64${EXT}" 65 66 $GO_CLIENT --test_case="status_code_and_message" 67 $GO_CLIENT --test_case="custom_metadata" 68fi