From ea9d8b67757526164c0b4cb86f61d2322d30f62d Mon Sep 17 00:00:00 2001
From: Muxi Yan <mxyan@google.com>
Date: Wed, 29 Mar 2017 10:20:19 -0700
Subject: [PATCH] Display time between tests for troubleshooting timeout

---
 src/objective-c/tests/build_example_test.sh | 9 +++++++++
 src/objective-c/tests/build_tests.sh        | 1 +
 src/objective-c/tests/run_tests.sh          | 6 +++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/objective-c/tests/build_example_test.sh b/src/objective-c/tests/build_example_test.sh
index ae75941ec6..5c50e83110 100755
--- a/src/objective-c/tests/build_example_test.sh
+++ b/src/objective-c/tests/build_example_test.sh
@@ -35,29 +35,38 @@ set -evo pipefail
 
 cd `dirname $0`
 
+trap 'echo "EXIT TIME:  $(date)"' EXIT
+
+echo "TIME:  $(date)"
 SCHEME=HelloWorld                              \
   EXAMPLE_PATH=examples/objective-c/helloworld \
   ./build_one_example.sh
 
+echo "TIME:  $(date)"
 SCHEME=RouteGuideClient                         \
   EXAMPLE_PATH=examples/objective-c/route_guide \
   ./build_one_example.sh
 
+echo "TIME:  $(date)"
 SCHEME=AuthSample                               \
   EXAMPLE_PATH=examples/objective-c/auth_sample \
   ./build_one_example.sh
 
 rm -f ../examples/RemoteTestClient/*.{h,m}
 
+echo "TIME:  $(date)"
 SCHEME=Sample                                  \
   EXAMPLE_PATH=src/objective-c/examples/Sample \
   ./build_one_example.sh
 
+echo "TIME:  $(date)"
 SCHEME=Sample                                  \
   EXAMPLE_PATH=src/objective-c/examples/Sample \
   FRAMEWORKS=YES                               \
   ./build_one_example.sh
 
+echo "TIME:  $(date)"
 SCHEME=SwiftSample                                  \
   EXAMPLE_PATH=src/objective-c/examples/SwiftSample \
   ./build_one_example.sh
+
diff --git a/src/objective-c/tests/build_tests.sh b/src/objective-c/tests/build_tests.sh
index bc5bc04494..6602d510d9 100755
--- a/src/objective-c/tests/build_tests.sh
+++ b/src/objective-c/tests/build_tests.sh
@@ -50,4 +50,5 @@ rm -rf Tests.xcworkspace
 rm -f Podfile.lock
 rm -f RemoteTestClient/*.{h,m}
 
+echo "TIME:  $(date)"
 pod install
diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh
index d217f1c8e0..bd7c2945a2 100755
--- a/src/objective-c/tests/run_tests.sh
+++ b/src/objective-c/tests/run_tests.sh
@@ -47,31 +47,35 @@ BINDIR=../../../bins/$CONFIG
 $BINDIR/interop_server --port=5050 --max_send_message_size=8388608 &
 $BINDIR/interop_server --port=5051 --max_send_message_size=8388608 --use_tls &
 # Kill them when this script exits.
-trap 'kill -9 `jobs -p`' EXIT
+trap 'kill -9 `jobs -p` ; echo "EXIT TIME:  $(date)"' EXIT
 
 # xcodebuild is very verbose. We filter its output and tell Bash to fail if any
 # element of the pipe fails.
 # TODO(jcanizales): Use xctool instead? Issue #2540.
 set -o pipefail
 XCODEBUILD_FILTER='(^===|^\*\*|\bfatal\b|\berror\b|\bwarning\b|\bfail)'
+echo "TIME:  $(date)"
 xcodebuild \
     -workspace Tests.xcworkspace \
     -scheme AllTests \
     -destination name="iPhone 6" \
     test | xcpretty
 
+echo "TIME:  $(date)"
 xcodebuild \
     -workspace Tests.xcworkspace \
     -scheme CoreCronetEnd2EndTests \
     -destination name="iPhone 6" \
     test | xcpretty
 
+echo "TIME:  $(date)"
 xcodebuild \
     -workspace Tests.xcworkspace \
     -scheme CronetUnitTests \
     -destination name="iPhone 6" \
     test | xcpretty
 
+echo "TIME:  $(date)"
 xcodebuild \
     -workspace Tests.xcworkspace \
     -scheme InteropTestsRemoteWithCronet \
-- 
GitLab