Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright 2019 The Abseil Authors. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # This script is invoked on Kokoro to test Abseil on macOS. |
| 18 | # It is not hermetic and may break when Kokoro is updated. |
| 19 | |
| 20 | set -euox pipefail |
| 21 | |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 22 | if [[ -z ${ABSEIL_ROOT:-} ]]; then |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 23 | ABSEIL_ROOT="$(realpath $(dirname ${0})/..)" |
| 24 | fi |
| 25 | |
| 26 | # If we are running on Kokoro, check for a versioned Bazel binary. |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 27 | KOKORO_GFILE_BAZEL_BIN="bazel-2.0.0-darwin-x86_64" |
| 28 | if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -f ${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN} ]]; then |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 29 | BAZEL_BIN="${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN}" |
| 30 | chmod +x ${BAZEL_BIN} |
| 31 | else |
| 32 | BAZEL_BIN="bazel" |
| 33 | fi |
| 34 | |
| 35 | # Print the compiler and Bazel versions. |
| 36 | echo "---------------" |
| 37 | gcc -v |
| 38 | echo "---------------" |
| 39 | ${BAZEL_BIN} version |
| 40 | echo "---------------" |
| 41 | |
| 42 | cd ${ABSEIL_ROOT} |
| 43 | |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 44 | if [[ -n "${ALTERNATE_OPTIONS:-}" ]]; then |
| 45 | cp ${ALTERNATE_OPTIONS:-} absl/base/options.h || exit 1 |
| 46 | fi |
| 47 | |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 48 | ${BAZEL_BIN} test ... \ |
| 49 | --copt=-Werror \ |
| 50 | --keep_going \ |
| 51 | --show_timestamps \ |
| 52 | --test_env="TZDIR=${ABSEIL_ROOT}/absl/time/internal/cctz/testdata/zoneinfo" \ |
| 53 | --test_output=errors \ |
| 54 | --test_tag_filters=-benchmark |