1#!/bin/bash 2# Copyright 2019 gRPC authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16# Don't run this script standalone. Instead, run from the repository root: 17# ./tools/run_tests/run_tests.py -l objc 18 19set -ev 20 21cd $(dirname $0) 22 23BAZEL=../../../tools/bazel 24 25INTEROP=../../../bazel-out/darwin-fastbuild/bin/test/cpp/interop/interop_server 26 27[ -d Tests.xcworkspace ] || { 28 ./build_tests.sh 29} 30 31[ -f $INTEROP ] || { 32 BAZEL build //test/cpp/interop:interop_server 33} 34 35[ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { 36 echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." 37 exit 1 38} 39 40PLAIN_PORT=$(curl localhost:32766/get) 41TLS_PORT=$(curl localhost:32766/get) 42 43$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 & 44$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & 45 46# Create loopback aliases for iOS performance tests 47if [ $SCHEME == PerfTests ] || [ $SCHEME == PerfTestsPosix ]; then 48for ((i=2;i<11;i++)) 49do 50 sudo ifconfig lo0 alias 127.0.0.$i up 51done 52fi 53 54function finish { 55 if [ $SCHEME == PerfTests ] || [ $SCHEME == PerfTestsPosix ]; then 56 for ((i=2;i<11;i++)) 57 do 58 sudo ifconfig lo0 -alias 127.0.0.$i 59 done 60 fi 61 kill -9 `jobs -p` 62 echo "EXIT TIME: $(date)" 63} 64trap finish EXIT 65 66set -o pipefail 67 68XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' 69 70if [ -z $PLATFORM ]; then 71DESTINATION='name=iPhone 8' 72elif [ $PLATFORM == ios ]; then 73DESTINATION='name=iPhone 8' 74elif [ $PLATFORM == macos ]; then 75DESTINATION='platform=macOS' 76elif [ $PLATFORM == tvos ]; then 77DESTINATION='platform=tvOS Simulator,name=Apple TV' 78fi 79 80 81xcodebuild \ 82 -workspace Tests.xcworkspace \ 83 -scheme $SCHEME \ 84 -destination "$DESTINATION" \ 85 HOST_PORT_LOCALSSL=localhost:$TLS_PORT \ 86 HOST_PORT_LOCAL=localhost:$PLAIN_PORT \ 87 HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ 88 test \ 89 | ./verbose_time.sh \ 90 | egrep -v "$XCODEBUILD_FILTER" \ 91 | egrep -v '^$' \ 92 | egrep -v "(GPBDictionary|GPBArray)" - 93 94