Cleanup of ObjC test scripts (#28333)

* cleanup cfstream tests scripts

* add xcodebuild_filter_output script

* cleanup scripts for ObjC CoreTests

* clean one more build_tests.sh file

* cleanup more scripts

* cleanup ios cpp scripts

* remove last copy of verbose_time

* revert readlink change
pull/28347/head
Jan Tattermusch 3 years ago committed by GitHub
parent 4fd524cd17
commit 32770542b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      src/objective-c/tests/CoreTests/build_and_run_tests.sh
  2. 9
      src/objective-c/tests/CoreTests/build_tests.sh
  3. 20
      src/objective-c/tests/CoreTests/verbose_time.sh
  4. 25
      src/objective-c/tests/build_one_example.sh
  5. 8
      src/objective-c/tests/build_tests.sh
  6. 18
      src/objective-c/tests/run_one_test.sh
  7. 20
      src/objective-c/tests/verbose_time.sh
  8. 37
      src/objective-c/tests/xcodebuild_filter_output.sh
  9. 46
      test/core/iomgr/ios/CFStreamTests/build_and_run_tests.sh
  10. 9
      test/core/iomgr/ios/CFStreamTests/build_tests.sh
  11. 19
      test/cpp/ios/build_and_run_tests.sh
  12. 6
      test/cpp/ios/build_tests.sh
  13. 20
      test/cpp/ios/verbose_time.sh

@ -16,25 +16,17 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l c++
set -ev
set -ex
set -o pipefail # preserve xcodebuild exit code when piping output
cd "$(dirname "$0")"
echo "TIME: $(date)"
time ./build_tests.sh
./build_tests.sh | ./verbose_time.sh
echo "TIME: $(date)"
set -o pipefail
XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )'
XCODEBUILD_FILTER_OUTPUT_SCRIPT="../xcodebuild_filter_output.sh"
xcodebuild \
-workspace CoreTests.xcworkspace \
-scheme CoreTests \
-destination name="iPhone 8" \
test \
| ./verbose_time.sh \
| grep -E -v "$XCODEBUILD_FILTER" \
| grep -E -v '^$' -
test | "${XCODEBUILD_FILTER_OUTPUT_SCRIPT}"

@ -16,27 +16,30 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l objc
set -e
set -ex
# CocoaPods requires the terminal to be using UTF-8 encoding.
export LANG=en_US.UTF-8
cd "$(dirname "$0")"
# Check that required tools are available.
hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; }
hash xcodebuild 2>/dev/null || {
echo >&2 "XCode command-line tools need to be installed."
exit 1
}
# TODO(jtattermusch): make the cleanup command consistent in all build_tests.sh directories.
# clean the directory
rm -rf Pods
# TODO(jtattermusch): is this wrong directory?
rm -rf Tests.xcworkspace
rm -f Podfile.lock
# TODO(jtattermusch): is this wrong directory?
rm -rf RemoteTestClientCpp/src
echo "TIME: $(date)"
pod install
time pod install
# ios-cpp-test-cronet flakes sometimes because of missing files in Protobuf-C++,
# add some log to help find out the root cause.

@ -1,20 +0,0 @@
#!/bin/bash
# Copyright 2019 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
while IFS= read -r line; do
echo "$(date) - $line"
done

@ -16,7 +16,7 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l objc
set -ev
set -ex
# Params:
# EXAMPLE_PATH - directory of the example
@ -27,7 +27,7 @@ export LANG=en_US.UTF-8
TEST_PATH=$(cd "$(dirname $0)" > /dev/null ; pwd)
cd `dirname $0`/../../..
cd $(dirname $0)/../../..
cd $EXAMPLE_PATH
@ -36,12 +36,14 @@ rm -rf Pods
rm -rf *.xcworkspace
rm -f Podfile.lock
pod install | $TEST_PATH/verbose_time.sh
time pod install
set -o pipefail # preserve xcodebuild exit code when piping output
XCODEBUILD_FILTER_OUTPUT_SCRIPT="${TEST_PATH}/xcodebuild_filter_output.sh"
set -o pipefail
XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )'
if [ "$SCHEME" == "tvOS-sample" ]; then
xcodebuild \
time xcodebuild \
build \
-workspace *.xcworkspace \
-scheme $SCHEME \
@ -50,11 +52,9 @@ if [ "$SCHEME" == "tvOS-sample" ]; then
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO \
| $TEST_PATH/verbose_time.sh \
| egrep -v "$XCODEBUILD_FILTER" \
| egrep -v "^$" -
| "${XCODEBUILD_FILTER_OUTPUT_SCRIPT}"
else
xcodebuild \
time xcodebuild \
build \
-workspace *.xcworkspace \
-scheme $SCHEME \
@ -63,8 +63,5 @@ else
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO \
| $TEST_PATH/verbose_time.sh \
| egrep -v "$XCODEBUILD_FILTER" \
| egrep -v "^$" -
| "${XCODEBUILD_FILTER_OUTPUT_SCRIPT}"
fi

@ -16,13 +16,14 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l objc
set -ev
set -ex
# CocoaPods requires the terminal to be using UTF-8 encoding.
export LANG=en_US.UTF-8
cd $(dirname $0)
cd "$(dirname "$0")"
# Check that required tools are available.
hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; }
hash xcodebuild 2>/dev/null || {
echo >&2 "XCode command-line tools need to be installed."
@ -34,8 +35,7 @@ rm -Rf Pods Podfile.lock Tests.xcworkspace
rm -f RemoteTestClient/*.{h,m}
pod cache clean --all
echo "TIME: $(date)"
pod install --verbose | ./verbose_time.sh
time pod install --verbose
# verify pod header installation
if [ -d "./Pods/Headers/Public/gRPC-Core/grpc/impl/codegen" ]

@ -16,7 +16,7 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l objc
set -ev
set -ex
cd $(dirname $0)
@ -40,6 +40,8 @@ INTEROP=../../../bazel-out/darwin-fastbuild/bin/test/cpp/interop/interop_server
PLAIN_PORT=$(curl localhost:32766/get)
TLS_PORT=$(curl localhost:32766/get)
# start interop_server for plaintext and interop_server for TLS on random ports obtained
# from the port server.
$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 &
$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls &
@ -63,9 +65,7 @@ function finish {
}
trap finish EXIT
set -o pipefail
XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )'
set -o pipefail # preserve xcodebuild exit code when piping output
if [ -z $PLATFORM ]; then
DESTINATION='name=iPhone 8'
@ -77,8 +77,9 @@ elif [ $PLATFORM == tvos ]; then
DESTINATION='platform=tvOS Simulator,name=Apple TV'
fi
XCODEBUILD_FILTER_OUTPUT_SCRIPT="./xcodebuild_filter_output.sh"
xcodebuild \
time xcodebuild \
-workspace Tests.xcworkspace \
-scheme $SCHEME \
-destination "$DESTINATION" \
@ -86,9 +87,4 @@ xcodebuild \
HOST_PORT_LOCAL=localhost:$PLAIN_PORT \
HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \
GCC_OPTIMIZATION_LEVEL=s \
test \
| ./verbose_time.sh \
| egrep -v "$XCODEBUILD_FILTER" \
| egrep -v '^$' \
| egrep -v "(GPBDictionary|GPBArray)" -
test | "${XCODEBUILD_FILTER_OUTPUT_SCRIPT}"

@ -1,20 +0,0 @@
#!/bin/bash
# Copyright 2019 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
while IFS= read -r line; do
echo "$(date) - $line"
done

@ -0,0 +1,37 @@
#!/bin/bash
# Copyright 2021 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Be default xcodebuild generates gigabytes of useless output. We
# use this script to make the logs smaller, while still keeping them
# useful (e.g. we need to be able to see the logs printed by a test
# when it fails on the CI).
# Alternatives considered:
# * "xcodebuild -quiet" prints much less output, but doesn't display the test outputs.
# * "xcpretty" prints a nice and readable log, but doesn't display logs printed
# by the tests when they fail (and we need those)
#
# Usage:
# set -o pipefail # preserve xcodebuild's exit code when piping the output
# xcodebuild ... | xcodebuild_filter_output.sh
# need to be careful not to exclude important logs, so the patterns here need to be very specific.
XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )'
# we expect xcodebuild output piped to the stdin
# - also skip empty lines
grep -E -v "$XCODEBUILD_FILTER" - | grep -E -v "^$" -
# TODO: What is this for?
#| grep -E -v "(GPBDictionary|GPBArray)" -

@ -16,57 +16,35 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l objc
set -ev
set -o pipefail
set -ex
set -o pipefail # preserve xcodebuild exit code when piping output
cd "$(dirname "$0")"
echo "TIME: $(date)"
XCODEBUILD_FILTER_OUTPUT_SCRIPT="../../../../../src/objective-c/tests/xcodebuild_filter_output.sh"
./build_tests.sh
time ./build_tests.sh
echo "TIME: $(date)"
XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )'
xcodebuild \
time xcodebuild \
-workspace CFStreamTests.xcworkspace \
-scheme CFStreamTests \
-destination name="iPhone 8" \
test \
| grep -E -v "$XCODEBUILD_FILTER" \
| grep -E -v '^$' \
| grep -E -v "(GPBDictionary|GPBArray)" -
echo "TIME: $(date)"
test | "${XCODEBUILD_FILTER_OUTPUT_SCRIPT}"
xcodebuild \
time xcodebuild \
-workspace CFStreamTests.xcworkspace \
-scheme CFStreamTests_Asan \
-destination name="iPhone 8" \
test \
| grep -E -v "$XCODEBUILD_FILTER" \
| grep -E -v '^$' \
| grep -E -v "(GPBDictionary|GPBArray)" -
test | "${XCODEBUILD_FILTER_OUTPUT_SCRIPT}"
echo "TIME: $(date)"
xcodebuild \
time xcodebuild \
-workspace CFStreamTests.xcworkspace \
-scheme CFStreamTests_Tsan \
-destination name="iPhone 8" \
test \
| grep -E -v "$XCODEBUILD_FILTER" \
| grep -E -v '^$' \
| grep -E -v "(GPBDictionary|GPBArray)" -
echo "TIME: $(date)"
test | "${XCODEBUILD_FILTER_OUTPUT_SCRIPT}"
xcodebuild \
time xcodebuild \
-workspace CFStreamTests.xcworkspace \
-scheme CFStreamTests_Msan \
-destination name="iPhone 8" \
test \
| grep -E -v "$XCODEBUILD_FILTER" \
| grep -E -v '^$' \
| grep -E -v "(GPBDictionary|GPBArray)" -
test | "${XCODEBUILD_FILTER_OUTPUT_SCRIPT}"

@ -16,13 +16,14 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l objc
set -ev
set -ex
# CocoaPods requires the terminal to be using UTF-8 encoding.
export LANG=en_US.UTF-8
cd "$(dirname "$0")"
# Check that required tools are available.
hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; }
hash xcodebuild 2>/dev/null || {
echo >&2 "XCode command-line tools need to be installed."
@ -31,10 +32,9 @@ hash xcodebuild 2>/dev/null || {
# clean up pod cache and existing pods
rm -Rf Pods Podfile.lock CFStreamTests.xcworkspace
pod cache clean --all
time pod cache clean --all
echo "TIME: $(date)"
pod install --verbose
time pod install --verbose
# ios-test-cfstream-tests flakes sometimes because of missing files in gRPC-Core,
# add some log to help find out the root cause.
@ -47,4 +47,3 @@ then
else
echo "Error: grpc/impl/codegen/ hasn't been imported."
fi

@ -16,25 +16,18 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l c++
set -ev
set -ex
set -o pipefail # preserve xcodebuild exit code when piping output
cd "$(dirname "$0")"
echo "TIME: $(date)"
time ./build_tests.sh
./build_tests.sh | ./verbose_time.sh
XCODEBUILD_FILTER_OUTPUT_SCRIPT="../../../src/objective-c/tests/xcodebuild_filter_output.sh"
echo "TIME: $(date)"
set -o pipefail
XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )'
xcodebuild \
time xcodebuild \
-workspace Tests.xcworkspace \
-scheme CronetTests \
-destination name="iPhone 8" \
test \
| ./verbose_time.sh \
| grep -E -v "$XCODEBUILD_FILTER" \
| grep -E -v '^$' -
| "${XCODEBUILD_FILTER_OUTPUT_SCRIPT}"

@ -16,13 +16,14 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l objc
set -e
set -ex
# CocoaPods requires the terminal to be using UTF-8 encoding.
export LANG=en_US.UTF-8
cd "$(dirname "$0")"
# Check that required tools are available.
hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; }
hash xcodebuild 2>/dev/null || {
echo >&2 "XCode command-line tools need to be installed."
@ -35,8 +36,7 @@ rm -rf Tests.xcworkspace
rm -f Podfile.lock
rm -rf RemoteTestClientCpp/src
echo "TIME: $(date)"
pod install
time pod install
# ios-cpp-test-cronet flakes sometimes because of missing files in Protobuf-C++,
# add some log to help find out the root cause.

@ -1,20 +0,0 @@
#!/bin/bash
# Copyright 2019 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
while IFS= read -r line; do
echo "$(date) - $line"
done
Loading…
Cancel
Save