blob: 9dde07d55c8ee1256e79e351735885c4c5f61f79 [file] [log] [blame]
Jorge Canizalesbe853522015-07-19 23:54:24 -07001#!/bin/bash
Jan Tattermusch7897ae92017-06-07 22:57:36 +02002# Copyright 2015 gRPC authors.
Jorge Canizalesbe853522015-07-19 23:54:24 -07003#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02004# 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
Jorge Canizalesbe853522015-07-19 23:54:24 -07007#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02008# http://www.apache.org/licenses/LICENSE-2.0
Jorge Canizalesbe853522015-07-19 23:54:24 -07009#
Jan Tattermusch7897ae92017-06-07 22:57:36 +020010# 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.
Jorge Canizalesbe853522015-07-19 23:54:24 -070015
Jorge Canizalese8d95352015-08-03 15:41:11 -070016# Don't run this script standalone. Instead, run from the repository root:
17# ./tools/run_tests/run_tests.py -l objc
18
Jorge Canizales545bad32016-07-15 23:16:32 -070019set -ev
Jorge Canizalesbe853522015-07-19 23:54:24 -070020
Jorge Canizales5dc58992015-07-20 09:23:43 -070021cd $(dirname $0)
Jorge Canizalesbe853522015-07-19 23:54:24 -070022
Jorge Canizalesd0b32e92015-07-30 23:08:43 -070023# Run the tests server.
Jorge Canizalesf4df3d22016-07-15 23:14:35 -070024
25BINDIR=../../../bins/$CONFIG
26
27[ -f $BINDIR/interop_server ] || {
28 echo >&2 "Can't find the test server. Make sure run_tests.py is making" \
29 "interop_server before calling this script."
30 exit 1
31}
Mark D. Rothc99fd892016-09-06 08:16:13 -070032$BINDIR/interop_server --port=5050 --max_send_message_size=8388608 &
33$BINDIR/interop_server --port=5051 --max_send_message_size=8388608 --use_tls &
Jorge Canizalescdabaca2015-07-31 12:03:16 -070034# Kill them when this script exits.
Muxi Yanea9d8b62017-03-29 10:20:19 -070035trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT
Jorge Canizales1433f522015-07-24 20:51:39 -070036
Muxi Yan9f2dd2d2017-12-20 16:53:30 -080037set -o pipefail
Muxi Yan2b57a102017-12-11 11:19:08 -080038
Jorge Canizales5dc58992015-07-20 09:23:43 -070039# xcodebuild is very verbose. We filter its output and tell Bash to fail if any
40# element of the pipe fails.
Jorge Canizalesaaab6512015-07-20 10:51:37 -070041# TODO(jcanizales): Use xctool instead? Issue #2540.
Muxi Yan01bc32c2017-11-30 09:49:50 -080042XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )'
Muxi Yan9f2dd2d2017-12-20 16:53:30 -080043
Muxi Yanea9d8b62017-03-29 10:20:19 -070044echo "TIME: $(date)"
Muxi Yan9f2dd2d2017-12-20 16:53:30 -080045
46# Retry the test for up to 3 times when return code is 65, due to Xcode issue:
47# http://www.openradar.me/29785686
48# The issue seems to be a connectivity issue to Xcode simulator so only retry
49# the first xcodebuild command
50retries=0
51while [ $retries -lt 3 ]; do
52 return_code=0
53 out=$(xcodebuild \
54 -workspace Tests.xcworkspace \
55 -scheme AllTests \
Muxi Yan95608df2018-04-25 14:18:02 -070056 -destination name="iPhone 8" \
Muxi Yan9f2dd2d2017-12-20 16:53:30 -080057 HOST_PORT_LOCALSSL=localhost:5051 \
58 HOST_PORT_LOCAL=localhost:5050 \
59 HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \
Muxi Yan36abd152017-12-22 10:37:40 -080060 test 2>&1 \
Muxi Yan9f2dd2d2017-12-20 16:53:30 -080061 | egrep -v "$XCODEBUILD_FILTER" \
62 | egrep -v '^$' \
63 | egrep -v "(GPBDictionary|GPBArray)" - ) || return_code=$?
64 if [ $return_code == 65 ] && [[ $out == *"DTXProxyChannel error 1"* ]]; then
65 echo "$out"
66 echo "Failed with code 65 (DTXProxyChannel error 1); retry."
67 retries=$(($retries+1))
68 elif [ $return_code == 0 ]; then
Muxi Yan3d44fc32017-12-22 10:58:38 -080069 echo "$out"
Muxi Yan9f2dd2d2017-12-20 16:53:30 -080070 break
71 else
72 echo "$out"
73 echo "Failed with code $return_code."
74 exit 1
75 fi
76done
77if [ $retries == 3 ]; then
78 echo "Failed with code 65 for 3 times; abort."
79 exit 1
80fi
Muxi Yan51319c72017-02-07 10:19:02 -080081
Muxi Yanea9d8b62017-03-29 10:20:19 -070082echo "TIME: $(date)"
Muxi Yan51319c72017-02-07 10:19:02 -080083xcodebuild \
84 -workspace Tests.xcworkspace \
Muxi Yane0b6aaa2017-03-22 15:57:46 -070085 -scheme CoreCronetEnd2EndTests \
Muxi Yan95608df2018-04-25 14:18:02 -070086 -destination name="iPhone 8" \
Muxi Yandde45482017-07-31 11:24:45 -070087 test \
Muxi Yan3fb250b2017-09-15 11:47:50 -070088 | egrep -v "$XCODEBUILD_FILTER" \
89 | egrep -v '^$' \
Muxi Yandde45482017-07-31 11:24:45 -070090 | egrep -v "(GPBDictionary|GPBArray)" -
Muxi Yane0b6aaa2017-03-22 15:57:46 -070091
Muxi Yan41ccb772017-08-11 17:16:28 -070092echo "TIME: $(date)"
93xcodebuild \
94 -workspace Tests.xcworkspace \
Muxi Yan35859222018-03-08 14:23:42 -080095 -scheme CoreCronetEnd2EndTests_Asan \
96 -destination name="iPhone 6" \
97 test \
98 | egrep -v "$XCODEBUILD_FILTER" \
99 | egrep -v '^$' \
100 | egrep -v "(GPBDictionary|GPBArray)" -
101
102echo "TIME: $(date)"
103xcodebuild \
104 -workspace Tests.xcworkspace \
105 -scheme CoreCronetEnd2EndTests_Tsan \
106 -destination name="iPhone 6" \
107 test \
108 | egrep -v "$XCODEBUILD_FILTER" \
109 | egrep -v '^$' \
110 | egrep -v "(GPBDictionary|GPBArray)" -
111
112echo "TIME: $(date)"
113xcodebuild \
114 -workspace Tests.xcworkspace \
Muxi Yan41ccb772017-08-11 17:16:28 -0700115 -scheme CronetUnitTests \
Muxi Yan95608df2018-04-25 14:18:02 -0700116 -destination name="iPhone 8" \
Muxi Yan3fb250b2017-09-15 11:47:50 -0700117 test \
118 | egrep -v "$XCODEBUILD_FILTER" \
119 | egrep -v '^$' \
120 | egrep -v "(GPBDictionary|GPBArray)" -
Muxi Yane0b6aaa2017-03-22 15:57:46 -0700121
Muxi Yanea9d8b62017-03-29 10:20:19 -0700122echo "TIME: $(date)"
Muxi Yane0b6aaa2017-03-22 15:57:46 -0700123xcodebuild \
124 -workspace Tests.xcworkspace \
Muxi Yan51319c72017-02-07 10:19:02 -0800125 -scheme InteropTestsRemoteWithCronet \
Muxi Yan95608df2018-04-25 14:18:02 -0700126 -destination name="iPhone 8" \
Makarand Dharmapurikarb4e97272017-04-12 12:16:28 -0700127 HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \
Muxi Yandde45482017-07-31 11:24:45 -0700128 test \
Muxi Yan3fb250b2017-09-15 11:47:50 -0700129 | egrep -v "$XCODEBUILD_FILTER" \
130 | egrep -v '^$' \
Muxi Yandde45482017-07-31 11:24:45 -0700131 | egrep -v "(GPBDictionary|GPBArray)" -
Muxi Yan9f2dd2d2017-12-20 16:53:30 -0800132
Muxi Yan95608df2018-04-25 14:18:02 -0700133echo "TIME: $(date)"
134xcodebuild \
135 -workspace Tests.xcworkspace \
136 -scheme InteropTestsRemoteCFStream \
137 -destination name="iPhone 8" \
138 HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \
139 test \
140 | egrep -v "$XCODEBUILD_FILTER" \
141 | egrep -v '^$' \
142 | egrep -v "(GPBDictionary|GPBArray)" -
143
144echo "TIME: $(date)"
145xcodebuild \
146 -workspace Tests.xcworkspace \
147 -scheme InteropTestsLocalCleartextCFStream \
148 -destination name="iPhone 8" \
149 HOST_PORT_LOCAL=localhost:5050 \
150 test \
151 | egrep -v "$XCODEBUILD_FILTER" \
152 | egrep -v '^$' \
153 | egrep -v "(GPBDictionary|GPBArray)" -
154
155echo "TIME: $(date)"
156xcodebuild \
157 -workspace Tests.xcworkspace \
158 -scheme InteropTestsLocalSSLCFStream \
159 -destination name="iPhone 8" \
160 HOST_PORT_LOCALSSL=localhost:5051 \
161 test \
162 | egrep -v "$XCODEBUILD_FILTER" \
163 | egrep -v '^$' \
164 | egrep -v "(GPBDictionary|GPBArray)" -
165
Muxi Yan9f2dd2d2017-12-20 16:53:30 -0800166exit 0