xref: /aosp_15_r20/external/grpc-grpc/src/objective-c/tests/run_one_test_bazel.sh (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
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
19# TODO(tonyzhehaolu):
20# For future use when Xcode is upgraded and tvos_unit_test is fully functional
21
22set -ev
23
24cd $(dirname $0)
25
26BAZEL=../../../tools/bazel
27
28INTEROP=../../../bazel-bin/test/cpp/interop/interop_server
29
30[ -f $INTEROP ] || {
31    $BAZEL build //test/cpp/interop:interop_server
32}
33[ -f $INTEROP ] || exit 1
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
46trap 'kill -9 `jobs -p` ; echo "EXIT TIME:  $(date)"' EXIT
47
48time $BAZEL test --ios_multi_cpus=x86_64,sim_arm64 \
49    --test_env HOST_PORT_LOCALSSL=localhost:$TLS_PORT \
50    --test_env HOST_PORT_LOCAL=localhost:$PLAIN_PORT \
51    $SCHEME
52