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 | |
| 22 | if [ -z ${ABSEIL_ROOT:-} ]; then |
| 23 | ABSEIL_ROOT="$(dirname ${0})/.." |
| 24 | fi |
| 25 | ABSEIL_ROOT=$(realpath ${ABSEIL_ROOT}) |
| 26 | |
| 27 | if [ -z ${ABSL_CMAKE_BUILD_TYPES:-} ]; then |
| 28 | ABSL_CMAKE_BUILD_TYPES="Debug" |
| 29 | fi |
| 30 | |
| 31 | for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do |
| 32 | BUILD_DIR=$(mktemp -d ${compilation_mode}.XXXXXXXX) |
| 33 | cd ${BUILD_DIR} |
| 34 | |
| 35 | # TODO(absl-team): Enable -Werror once all warnings are fixed. |
| 36 | time cmake ${ABSEIL_ROOT} \ |
| 37 | -GXcode \ |
| 38 | -DCMAKE_BUILD_TYPE=${compilation_mode} \ |
| 39 | -DABSL_USE_GOOGLETEST_HEAD=ON \ |
| 40 | -DABSL_RUN_TESTS=ON |
| 41 | time cmake --build . |
| 42 | time ctest -C ${compilation_mode} --output-on-failure |
| 43 | done |