From 302d65ea46cfa9d41689a0f8ba4aebe03b58602b Mon Sep 17 00:00:00 2001
From: Thai Duong <thaidn@google.com>
Date: Wed, 27 Sep 2017 23:06:06 -0700
Subject: [PATCH] Measuring time spent during presubmit tests.

Change-Id: I2044360f158cc17fe8bd8f22c015e69dbe971378
ORIGINAL_AUTHOR=Thai Duong <thaidn@google.com>
GitOrigin-RevId: 64e6515028ad5ef44b02548b4b82c9d5d81e2829
---
 WORKSPACE                          |  1 -
 kokoro/gcp_ubuntu/presubmit.sh     | 10 +++++++---
 kokoro/macos_external/presubmit.sh | 14 +++++++++-----
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/WORKSPACE b/WORKSPACE
index ba3824a8a..28bf84f0d 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -39,7 +39,6 @@ git_repository(
 #-----------------------------------------------------------------------------
 # proto_library rules implicitly depend on @com_google_protobuf//:protoc,
 # which is the proto-compiler.
-# This statement defines the @com_google_protobuf repo.
 http_archive(
     name = "com_google_protobuf",
     strip_prefix = "protobuf-3.4.0",
diff --git a/kokoro/gcp_ubuntu/presubmit.sh b/kokoro/gcp_ubuntu/presubmit.sh
index 4257783b4..45000e1a9 100755
--- a/kokoro/gcp_ubuntu/presubmit.sh
+++ b/kokoro/gcp_ubuntu/presubmit.sh
@@ -27,12 +27,16 @@ rm -f ~/.bazelrc
 # Build
 cd github/tink/
 
+time bazel fetch ...
+
 # bazel sandbox doesn't work with Kokoro's MacOS image, see b/38040081.
-bazel build --strategy=CppCompile=standalone --strategy=Turbine=standalone \
+time bazel build --strategy=CppCompile=standalone --strategy=Turbine=standalone \
   --strategy=ProtoCompile=standalone --strategy=GenProto=standalone \
   --strategy=GenRule=standalone --strategy=GenProtoDescriptorSet=standalone \
-  --sandbox_tmpfs_path=$TMP -- //... -//objc/... -//tools/...
+  --proto_toolchain_for_cc=@com_google_protobuf//:cc_toolchain \
+  --proto_toolchain_for_java=@com_google_protobuf//:java_toolchain \
+  --sandbox_tmpfs_path=$TMP -- //... -//objc/...
 
 # Run all tests, except iOS.
-bazel test --strategy=TestRunner=standalone --test_output=all -- //... \
+time bazel test --strategy=TestRunner=standalone --test_output=all -- //... \
 -//objc/...
diff --git a/kokoro/macos_external/presubmit.sh b/kokoro/macos_external/presubmit.sh
index 7deeefa39..1d8ae2420 100755
--- a/kokoro/macos_external/presubmit.sh
+++ b/kokoro/macos_external/presubmit.sh
@@ -58,8 +58,10 @@ ${BAZEL_BIN} version
 echo "using java binary: " `which java`
 java -version
 
+time ${BAZEL_BIN} fetch ...
+
 # Build all the iOS targets.
-${BAZEL_BIN} build \
+time ${BAZEL_BIN} build \
   $DISABLE_SANDBOX \
   --compilation_mode=dbg \
   --dynamic_mode=off \
@@ -70,14 +72,16 @@ ${BAZEL_BIN} build \
   --ios_sdk_version="${IOS_SDK_VERSION}" \
   --xcode_version="${XCODE_VERSION}" \
   --verbose_failures \
-  //objc/... || \
-  ( ls -l ; df -h / ; exit 1 )
+  //objc/...
 
 echo "bazel obj-c passed"
 
 # Test all targets except iOS.
 # bazel sandbox doesn't work with Kokoro's MacOS image, see b/38040081.
-${BAZEL_BIN} test --sandbox_tmpfs_path=$TMP $DISABLE_SANDBOX -- //... \
--//objc/... || ( ls -l ; df -h / ; exit 1 )
+time ${BAZEL_BIN} build --sandbox_tmpfs_path=$TMP $DISABLE_SANDBOX -- //... \
+-//objc/...
+
+time ${BAZEL_BIN} test --sandbox_tmpfs_path=$TMP $DISABLE_SANDBOX -- //... \
+-//objc/...
 
 echo "bazel non objc-c passed"
-- 
GitLab