3131
3232set -euox pipefail
3333
34- readonly LINUX_LATEST_CONTAINER=" gcr.io/google.com/absl-177019/linux_hybrid-latest:20241218 "
35- readonly LINUX_GCC_FLOOR_CONTAINER=" gcr.io/google.com/absl-177019/linux_gcc-floor:20250205 "
34+ readonly LINUX_LATEST_CONTAINER=" gcr.io/google.com/absl-177019/linux_hybrid-latest:20250430 "
35+ readonly LINUX_GCC_FLOOR_CONTAINER=" gcr.io/google.com/absl-177019/linux_gcc-floor:20250430 "
3636
3737if [[ -z ${GTEST_ROOT:- } ]]; then
3838 GTEST_ROOT=" $( realpath $( dirname ${0} ) /..) "
3939fi
4040
41+ # Use Bazel Vendor mode to reduce reliance on external dependencies.
42+ # See https://bazel.build/external/vendor and the Dockerfile for
43+ # an explaination of how this works.
44+ if [[ ${KOKORO_GFILE_DIR:- } ]] && [[ -f " ${KOKORO_GFILE_DIR} /distdir/googletest_vendor.tar.gz" ]]; then
45+ DOCKER_EXTRA_ARGS=" --mount type=bind,source=${KOKORO_GFILE_DIR} /distdir,target=/distdir,readonly --env=BAZEL_VENDOR_ARCHIVE=/distdir/googletest_vendor.tar.gz ${DOCKER_EXTRA_ARGS:- } "
46+ BAZEL_EXTRA_ARGS=" --vendor_dir=/googletest_vendor ${BAZEL_EXTRA_ARGS:- } "
47+ fi
48+
4149if [[ -z ${STD:- } ]]; then
42- STD=" c++17 c++20"
50+ STD=" c++17 c++20 c++23 "
4351fi
4452
4553# Test CMake + GCC
@@ -93,18 +101,21 @@ time docker run \
93101 --rm \
94102 --env=" CC=/usr/local/bin/gcc" \
95103 --env=" BAZEL_CXXOPTS=-std=c++17" \
104+ ${DOCKER_EXTRA_ARGS:- } \
96105 ${LINUX_GCC_FLOOR_CONTAINER} \
106+ /bin/bash --login -c "
97107 /usr/local/bin/bazel test ... \
98- --copt=" -Wall" \
99- --copt=" -Werror" \
100- --copt=" -Wuninitialized" \
101- --copt=" -Wundef" \
102- --copt=" -Wno-error=pragmas" \
108+ --copt=\ " -Wall\ " \
109+ --copt=\ " -Werror\ " \
110+ --copt=\ " -Wuninitialized\ " \
111+ --copt=\ " -Wundef\ " \
112+ --copt=\ " -Wno-error=pragmas\ " \
103113 --enable_bzlmod=false \
104114 --features=external_include_paths \
105115 --keep_going \
106116 --show_timestamps \
107- --test_output=errors
117+ --test_output=errors \
118+ ${BAZEL_EXTRA_ARGS:- } "
108119
109120# Test GCC
110121for std in ${STD} ; do
@@ -115,18 +126,21 @@ for std in ${STD}; do
115126 --rm \
116127 --env=" CC=/usr/local/bin/gcc" \
117128 --env=" BAZEL_CXXOPTS=-std=${std} " \
129+ ${DOCKER_EXTRA_ARGS:- } \
118130 ${LINUX_LATEST_CONTAINER} \
119- /usr/local/bin/bazel test ... \
120- --copt=" -Wall" \
121- --copt=" -Werror" \
122- --copt=" -Wuninitialized" \
123- --copt=" -Wundef" \
124- --define=" absl=${absl} " \
125- --enable_bzlmod=true \
126- --features=external_include_paths \
127- --keep_going \
128- --show_timestamps \
129- --test_output=errors
131+ /bin/bash --login -c "
132+ /usr/local/bin/bazel test ... \
133+ --copt=\" -Wall\" \
134+ --copt=\" -Werror\" \
135+ --copt=\" -Wuninitialized\" \
136+ --copt=\" -Wundef\" \
137+ --define=\" absl=${absl} \" \
138+ --enable_bzlmod=true \
139+ --features=external_include_paths \
140+ --keep_going \
141+ --show_timestamps \
142+ --test_output=errors \
143+ ${BAZEL_EXTRA_ARGS:- } "
130144 done
131145done
132146
@@ -139,19 +153,22 @@ for std in ${STD}; do
139153 --rm \
140154 --env=" CC=/opt/llvm/clang/bin/clang" \
141155 --env=" BAZEL_CXXOPTS=-std=${std} " \
156+ ${DOCKER_EXTRA_ARGS:- } \
142157 ${LINUX_LATEST_CONTAINER} \
143- /usr/local/bin/bazel test ... \
144- --copt=" --gcc-toolchain=/usr/local" \
145- --copt=" -Wall" \
146- --copt=" -Werror" \
147- --copt=" -Wuninitialized" \
148- --copt=" -Wundef" \
149- --define=" absl=${absl} " \
150- --enable_bzlmod=true \
151- --features=external_include_paths \
152- --keep_going \
153- --linkopt=" --gcc-toolchain=/usr/local" \
154- --show_timestamps \
155- --test_output=errors
158+ /bin/bash --login -c "
159+ /usr/local/bin/bazel test ... \
160+ --copt=\" --gcc-toolchain=/usr/local\" \
161+ --copt=\" -Wall\" \
162+ --copt=\" -Werror\" \
163+ --copt=\" -Wuninitialized\" \
164+ --copt=\" -Wundef\" \
165+ --define=\" absl=${absl} \" \
166+ --enable_bzlmod=true \
167+ --features=external_include_paths \
168+ --keep_going \
169+ --linkopt=\" --gcc-toolchain=/usr/local\" \
170+ --show_timestamps \
171+ --test_output=errors \
172+ ${BAZEL_EXTRA_ARGS:- } "
156173 done
157174done
0 commit comments