Jorge Canizales | be85352 | 2015-07-19 23:54:24 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 2 | # Copyright 2015 gRPC authors. |
Jorge Canizales | be85352 | 2015-07-19 23:54:24 -0700 | [diff] [blame] | 3 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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 |
Jorge Canizales | be85352 | 2015-07-19 23:54:24 -0700 | [diff] [blame] | 7 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
Jorge Canizales | be85352 | 2015-07-19 23:54:24 -0700 | [diff] [blame] | 9 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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. |
Jorge Canizales | be85352 | 2015-07-19 23:54:24 -0700 | [diff] [blame] | 15 | |
Jorge Canizales | e8d9535 | 2015-08-03 15:41:11 -0700 | [diff] [blame] | 16 | # Don't run this script standalone. Instead, run from the repository root: |
| 17 | # ./tools/run_tests/run_tests.py -l objc |
| 18 | |
Jorge Canizales | 545bad3 | 2016-07-15 23:16:32 -0700 | [diff] [blame] | 19 | set -ev |
Jorge Canizales | be85352 | 2015-07-19 23:54:24 -0700 | [diff] [blame] | 20 | |
Jorge Canizales | 5dc5899 | 2015-07-20 09:23:43 -0700 | [diff] [blame] | 21 | cd $(dirname $0) |
Jorge Canizales | be85352 | 2015-07-19 23:54:24 -0700 | [diff] [blame] | 22 | |
Jorge Canizales | d0b32e9 | 2015-07-30 23:08:43 -0700 | [diff] [blame] | 23 | # Run the tests server. |
Jorge Canizales | f4df3d2 | 2016-07-15 23:14:35 -0700 | [diff] [blame] | 24 | |
| 25 | BINDIR=../../../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. Roth | c99fd89 | 2016-09-06 08:16:13 -0700 | [diff] [blame] | 32 | $BINDIR/interop_server --port=5050 --max_send_message_size=8388608 & |
| 33 | $BINDIR/interop_server --port=5051 --max_send_message_size=8388608 --use_tls & |
Jorge Canizales | cdabaca | 2015-07-31 12:03:16 -0700 | [diff] [blame] | 34 | # Kill them when this script exits. |
Muxi Yan | ea9d8b6 | 2017-03-29 10:20:19 -0700 | [diff] [blame] | 35 | trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT |
Jorge Canizales | 1433f52 | 2015-07-24 20:51:39 -0700 | [diff] [blame] | 36 | |
Muxi Yan | 9f2dd2d | 2017-12-20 16:53:30 -0800 | [diff] [blame] | 37 | set -o pipefail |
Muxi Yan | 2b57a10 | 2017-12-11 11:19:08 -0800 | [diff] [blame] | 38 | |
Jorge Canizales | 5dc5899 | 2015-07-20 09:23:43 -0700 | [diff] [blame] | 39 | # xcodebuild is very verbose. We filter its output and tell Bash to fail if any |
| 40 | # element of the pipe fails. |
Jorge Canizales | aaab651 | 2015-07-20 10:51:37 -0700 | [diff] [blame] | 41 | # TODO(jcanizales): Use xctool instead? Issue #2540. |
Muxi Yan | 01bc32c | 2017-11-30 09:49:50 -0800 | [diff] [blame] | 42 | XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' |
Muxi Yan | 9f2dd2d | 2017-12-20 16:53:30 -0800 | [diff] [blame] | 43 | |
Muxi Yan | ea9d8b6 | 2017-03-29 10:20:19 -0700 | [diff] [blame] | 44 | echo "TIME: $(date)" |
Muxi Yan | 9f2dd2d | 2017-12-20 16:53:30 -0800 | [diff] [blame] | 45 | |
| 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 |
| 50 | retries=0 |
| 51 | while [ $retries -lt 3 ]; do |
| 52 | return_code=0 |
| 53 | out=$(xcodebuild \ |
| 54 | -workspace Tests.xcworkspace \ |
| 55 | -scheme AllTests \ |
Muxi Yan | 95608df | 2018-04-25 14:18:02 -0700 | [diff] [blame] | 56 | -destination name="iPhone 8" \ |
Muxi Yan | 9f2dd2d | 2017-12-20 16:53:30 -0800 | [diff] [blame] | 57 | HOST_PORT_LOCALSSL=localhost:5051 \ |
| 58 | HOST_PORT_LOCAL=localhost:5050 \ |
| 59 | HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ |
Muxi Yan | 36abd15 | 2017-12-22 10:37:40 -0800 | [diff] [blame] | 60 | test 2>&1 \ |
Muxi Yan | 9f2dd2d | 2017-12-20 16:53:30 -0800 | [diff] [blame] | 61 | | 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 Yan | 3d44fc3 | 2017-12-22 10:58:38 -0800 | [diff] [blame] | 69 | echo "$out" |
Muxi Yan | 9f2dd2d | 2017-12-20 16:53:30 -0800 | [diff] [blame] | 70 | break |
| 71 | else |
| 72 | echo "$out" |
| 73 | echo "Failed with code $return_code." |
| 74 | exit 1 |
| 75 | fi |
| 76 | done |
| 77 | if [ $retries == 3 ]; then |
| 78 | echo "Failed with code 65 for 3 times; abort." |
| 79 | exit 1 |
| 80 | fi |
Muxi Yan | 51319c7 | 2017-02-07 10:19:02 -0800 | [diff] [blame] | 81 | |
Muxi Yan | ea9d8b6 | 2017-03-29 10:20:19 -0700 | [diff] [blame] | 82 | echo "TIME: $(date)" |
Muxi Yan | 51319c7 | 2017-02-07 10:19:02 -0800 | [diff] [blame] | 83 | xcodebuild \ |
| 84 | -workspace Tests.xcworkspace \ |
Muxi Yan | e0b6aaa | 2017-03-22 15:57:46 -0700 | [diff] [blame] | 85 | -scheme CoreCronetEnd2EndTests \ |
Muxi Yan | 95608df | 2018-04-25 14:18:02 -0700 | [diff] [blame] | 86 | -destination name="iPhone 8" \ |
Muxi Yan | dde4548 | 2017-07-31 11:24:45 -0700 | [diff] [blame] | 87 | test \ |
Muxi Yan | 3fb250b | 2017-09-15 11:47:50 -0700 | [diff] [blame] | 88 | | egrep -v "$XCODEBUILD_FILTER" \ |
| 89 | | egrep -v '^$' \ |
Muxi Yan | dde4548 | 2017-07-31 11:24:45 -0700 | [diff] [blame] | 90 | | egrep -v "(GPBDictionary|GPBArray)" - |
Muxi Yan | e0b6aaa | 2017-03-22 15:57:46 -0700 | [diff] [blame] | 91 | |
Muxi Yan | 41ccb77 | 2017-08-11 17:16:28 -0700 | [diff] [blame] | 92 | echo "TIME: $(date)" |
| 93 | xcodebuild \ |
| 94 | -workspace Tests.xcworkspace \ |
Muxi Yan | 3585922 | 2018-03-08 14:23:42 -0800 | [diff] [blame] | 95 | -scheme CoreCronetEnd2EndTests_Asan \ |
| 96 | -destination name="iPhone 6" \ |
| 97 | test \ |
| 98 | | egrep -v "$XCODEBUILD_FILTER" \ |
| 99 | | egrep -v '^$' \ |
| 100 | | egrep -v "(GPBDictionary|GPBArray)" - |
| 101 | |
| 102 | echo "TIME: $(date)" |
| 103 | xcodebuild \ |
| 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 | |
| 112 | echo "TIME: $(date)" |
| 113 | xcodebuild \ |
| 114 | -workspace Tests.xcworkspace \ |
Muxi Yan | 41ccb77 | 2017-08-11 17:16:28 -0700 | [diff] [blame] | 115 | -scheme CronetUnitTests \ |
Muxi Yan | 95608df | 2018-04-25 14:18:02 -0700 | [diff] [blame] | 116 | -destination name="iPhone 8" \ |
Muxi Yan | 3fb250b | 2017-09-15 11:47:50 -0700 | [diff] [blame] | 117 | test \ |
| 118 | | egrep -v "$XCODEBUILD_FILTER" \ |
| 119 | | egrep -v '^$' \ |
| 120 | | egrep -v "(GPBDictionary|GPBArray)" - |
Muxi Yan | e0b6aaa | 2017-03-22 15:57:46 -0700 | [diff] [blame] | 121 | |
Muxi Yan | ea9d8b6 | 2017-03-29 10:20:19 -0700 | [diff] [blame] | 122 | echo "TIME: $(date)" |
Muxi Yan | e0b6aaa | 2017-03-22 15:57:46 -0700 | [diff] [blame] | 123 | xcodebuild \ |
| 124 | -workspace Tests.xcworkspace \ |
Muxi Yan | 51319c7 | 2017-02-07 10:19:02 -0800 | [diff] [blame] | 125 | -scheme InteropTestsRemoteWithCronet \ |
Muxi Yan | 95608df | 2018-04-25 14:18:02 -0700 | [diff] [blame] | 126 | -destination name="iPhone 8" \ |
Makarand Dharmapurikar | b4e9727 | 2017-04-12 12:16:28 -0700 | [diff] [blame] | 127 | HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ |
Muxi Yan | dde4548 | 2017-07-31 11:24:45 -0700 | [diff] [blame] | 128 | test \ |
Muxi Yan | 3fb250b | 2017-09-15 11:47:50 -0700 | [diff] [blame] | 129 | | egrep -v "$XCODEBUILD_FILTER" \ |
| 130 | | egrep -v '^$' \ |
Muxi Yan | dde4548 | 2017-07-31 11:24:45 -0700 | [diff] [blame] | 131 | | egrep -v "(GPBDictionary|GPBArray)" - |
Muxi Yan | 9f2dd2d | 2017-12-20 16:53:30 -0800 | [diff] [blame] | 132 | |
Muxi Yan | 95608df | 2018-04-25 14:18:02 -0700 | [diff] [blame] | 133 | echo "TIME: $(date)" |
| 134 | xcodebuild \ |
| 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 | |
| 144 | echo "TIME: $(date)" |
| 145 | xcodebuild \ |
| 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 | |
| 155 | echo "TIME: $(date)" |
| 156 | xcodebuild \ |
| 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 Yan | 9f2dd2d | 2017-12-20 16:53:30 -0800 | [diff] [blame] | 166 | exit 0 |