3 # Copyright 2020, Google Inc.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are
10 # * Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above
13 # copyright notice, this list of conditions and the following disclaimer
14 # in the documentation and/or other materials provided with the
16 # * Neither the name of Google Inc. nor the names of its
17 # contributors may be used to endorse or promote products derived from
18 # this software without specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 readonly LINUX_LATEST_CONTAINER
="gcr.io/google.com/absl-177019/linux_hybrid-latest:20210525"
35 readonly LINUX_GCC_FLOOR_CONTAINER
="gcr.io/google.com/absl-177019/linux_gcc-floor:20201015"
37 if [[ -z ${GTEST_ROOT:-} ]]; then
38 GTEST_ROOT
="$(realpath $(dirname ${0})/..)"
41 if [[ -z ${STD:-} ]]; then
42 STD
="c++11 c++14 c++17 c++20"
45 # Test the CMake build
46 for cc
in /usr
/local
/bin
/gcc
/opt
/llvm
/clang
/bin
/clang
; do
47 for cmake_off_on
in OFF ON
; do
49 --volume="${GTEST_ROOT}:/src:ro" \
50 --tmpfs="/build:exec" \
54 --env="CXX_FLAGS=\"-Werror -Wdeprecated\"" \
55 ${LINUX_LATEST_CONTAINER} \
58 -DCMAKE_CXX_STANDARD=11 \
59 -Dgtest_build_samples=ON \
60 -Dgtest_build_tests=ON \
61 -Dgmock_build_tests=ON \
62 -Dcxx_no_exception=${cmake_off_on} \
63 -Dcxx_no_rtti=${cmake_off_on} && \
65 ctest -j$(nproc) --output-on-failure"
69 # Do one test with an older version of GCC
71 --volume="${GTEST_ROOT}:/src:ro" \
74 --env="CC=/usr/local/bin/gcc" \
75 ${LINUX_GCC_FLOOR_CONTAINER} \
76 /usr
/local
/bin
/bazel
test ... \
79 --copt="-Wno-error=pragmas" \
88 --volume="${GTEST_ROOT}:/src:ro" \
91 --env="CC=/usr/local/bin/gcc" \
92 --env="BAZEL_CXXOPTS=-std=${std}" \
93 ${LINUX_LATEST_CONTAINER} \
94 /usr
/local
/bin
/bazel
test ... \
97 --define="absl=${absl}" \
98 --distdir="/bazel-distdir" \
106 for std
in ${STD}; do
109 --volume="${GTEST_ROOT}:/src:ro" \
112 --env="CC=/opt/llvm/clang/bin/clang" \
113 --env="BAZEL_CXXOPTS=-std=${std}" \
114 ${LINUX_LATEST_CONTAINER} \
115 /usr
/local
/bin
/bazel
test ... \
116 --copt="--gcc-toolchain=/usr/local" \
119 --define="absl=${absl}" \
120 --distdir="/bazel-distdir" \
122 --linkopt="--gcc-toolchain=/usr/local" \