1#!/usr/bin/env bash 2# Copyright 2017 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 16set -ex 17 18# change to grpc repo root 19cd $(dirname $0)/../../.. 20 21source tools/internal_ci/helper_scripts/prepare_build_linux_rc 22 23# make sure bazel is available 24tools/bazel version 25 26# to get "bazel" link for kokoro build, we need to generate 27# invocation UUID, set a flag for bazel to use it 28# and upload "bazel_invocation_ids" file as artifact. 29BAZEL_INVOCATION_ID="$(uuidgen)" 30echo "${BAZEL_INVOCATION_ID}" >"${KOKORO_ARTIFACTS_DIR}/bazel_invocation_ids" 31 32tools/bazel \ 33 --bazelrc=tools/remote_build/kokoro.bazelrc \ 34 test \ 35 --invocation_id="${BAZEL_INVOCATION_ID}" \ 36 --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh \ 37 --google_credentials="${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json" \ 38 $@ \ 39 -- //test/... || FAILED="true" 40 41if [ "$UPLOAD_TEST_RESULTS" != "" ] 42then 43 # Sleep to let ResultStore finish writing results before querying 44 sleep 60 45 python ./tools/run_tests/python_utils/upload_rbe_results.py 46fi 47 48if [ "$FAILED" != "" ] 49then 50 exit 1 51fi 52