mirror of
https://git.mirrors.martin98.com/https://github.com/google/googletest.git
synced 2025-06-02 05:38:18 +08:00
GoogleTest CI Update
* Use abseil-cpp@20250512.0, which requires C++17 and removes any/optional/variant polyfills * Test C++23 * Support/test GCC15 * Use Bazel vendor mode to reduce reliance on GitHub PiperOrigin-RevId: 759184924 Change-Id: Ifb866cdd7faf1e5be475b44f69870745e21a3104
This commit is contained in:
parent
9f79a9597a
commit
571930618f
@ -41,7 +41,7 @@ module(
|
||||
|
||||
bazel_dep(
|
||||
name = "abseil-cpp",
|
||||
version = "20250127.1",
|
||||
version = "20250512.0",
|
||||
)
|
||||
bazel_dep(
|
||||
name = "platforms",
|
||||
|
@ -31,15 +31,23 @@
|
||||
|
||||
set -euox pipefail
|
||||
|
||||
readonly LINUX_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20241218"
|
||||
readonly LINUX_GCC_FLOOR_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-floor:20250205"
|
||||
readonly LINUX_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20250430"
|
||||
readonly LINUX_GCC_FLOOR_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-floor:20250430"
|
||||
|
||||
if [[ -z ${GTEST_ROOT:-} ]]; then
|
||||
GTEST_ROOT="$(realpath $(dirname ${0})/..)"
|
||||
fi
|
||||
|
||||
# Use Bazel Vendor mode to reduce reliance on external dependencies.
|
||||
# See https://bazel.build/external/vendor and the Dockerfile for
|
||||
# an explaination of how this works.
|
||||
if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -f "${KOKORO_GFILE_DIR}/distdir/googletest_vendor.tar.gz" ]]; then
|
||||
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:-}"
|
||||
BAZEL_EXTRA_ARGS="--vendor_dir=/googletest_vendor ${BAZEL_EXTRA_ARGS:-}"
|
||||
fi
|
||||
|
||||
if [[ -z ${STD:-} ]]; then
|
||||
STD="c++17 c++20"
|
||||
STD="c++17 c++20 c++23"
|
||||
fi
|
||||
|
||||
# Test CMake + GCC
|
||||
@ -93,18 +101,21 @@ time docker run \
|
||||
--rm \
|
||||
--env="CC=/usr/local/bin/gcc" \
|
||||
--env="BAZEL_CXXOPTS=-std=c++17" \
|
||||
${DOCKER_EXTRA_ARGS:-} \
|
||||
${LINUX_GCC_FLOOR_CONTAINER} \
|
||||
/bin/bash --login -c "
|
||||
/usr/local/bin/bazel test ... \
|
||||
--copt="-Wall" \
|
||||
--copt="-Werror" \
|
||||
--copt="-Wuninitialized" \
|
||||
--copt="-Wundef" \
|
||||
--copt="-Wno-error=pragmas" \
|
||||
--copt=\"-Wall\" \
|
||||
--copt=\"-Werror\" \
|
||||
--copt=\"-Wuninitialized\" \
|
||||
--copt=\"-Wundef\" \
|
||||
--copt=\"-Wno-error=pragmas\" \
|
||||
--enable_bzlmod=false \
|
||||
--features=external_include_paths \
|
||||
--keep_going \
|
||||
--show_timestamps \
|
||||
--test_output=errors
|
||||
--test_output=errors \
|
||||
${BAZEL_EXTRA_ARGS:-}"
|
||||
|
||||
# Test GCC
|
||||
for std in ${STD}; do
|
||||
@ -115,18 +126,21 @@ for std in ${STD}; do
|
||||
--rm \
|
||||
--env="CC=/usr/local/bin/gcc" \
|
||||
--env="BAZEL_CXXOPTS=-std=${std}" \
|
||||
${DOCKER_EXTRA_ARGS:-} \
|
||||
${LINUX_LATEST_CONTAINER} \
|
||||
/usr/local/bin/bazel test ... \
|
||||
--copt="-Wall" \
|
||||
--copt="-Werror" \
|
||||
--copt="-Wuninitialized" \
|
||||
--copt="-Wundef" \
|
||||
--define="absl=${absl}" \
|
||||
--enable_bzlmod=true \
|
||||
--features=external_include_paths \
|
||||
--keep_going \
|
||||
--show_timestamps \
|
||||
--test_output=errors
|
||||
/bin/bash --login -c "
|
||||
/usr/local/bin/bazel test ... \
|
||||
--copt=\"-Wall\" \
|
||||
--copt=\"-Werror\" \
|
||||
--copt=\"-Wuninitialized\" \
|
||||
--copt=\"-Wundef\" \
|
||||
--define=\"absl=${absl}\" \
|
||||
--enable_bzlmod=true \
|
||||
--features=external_include_paths \
|
||||
--keep_going \
|
||||
--show_timestamps \
|
||||
--test_output=errors \
|
||||
${BAZEL_EXTRA_ARGS:-}"
|
||||
done
|
||||
done
|
||||
|
||||
@ -139,19 +153,22 @@ for std in ${STD}; do
|
||||
--rm \
|
||||
--env="CC=/opt/llvm/clang/bin/clang" \
|
||||
--env="BAZEL_CXXOPTS=-std=${std}" \
|
||||
${DOCKER_EXTRA_ARGS:-} \
|
||||
${LINUX_LATEST_CONTAINER} \
|
||||
/usr/local/bin/bazel test ... \
|
||||
--copt="--gcc-toolchain=/usr/local" \
|
||||
--copt="-Wall" \
|
||||
--copt="-Werror" \
|
||||
--copt="-Wuninitialized" \
|
||||
--copt="-Wundef" \
|
||||
--define="absl=${absl}" \
|
||||
--enable_bzlmod=true \
|
||||
--features=external_include_paths \
|
||||
--keep_going \
|
||||
--linkopt="--gcc-toolchain=/usr/local" \
|
||||
--show_timestamps \
|
||||
--test_output=errors
|
||||
/bin/bash --login -c "
|
||||
/usr/local/bin/bazel test ... \
|
||||
--copt=\"--gcc-toolchain=/usr/local\" \
|
||||
--copt=\"-Wall\" \
|
||||
--copt=\"-Werror\" \
|
||||
--copt=\"-Wuninitialized\" \
|
||||
--copt=\"-Wundef\" \
|
||||
--define=\"absl=${absl}\" \
|
||||
--enable_bzlmod=true \
|
||||
--features=external_include_paths \
|
||||
--keep_going \
|
||||
--linkopt=\"--gcc-toolchain=/usr/local\" \
|
||||
--show_timestamps \
|
||||
--test_output=errors \
|
||||
${BAZEL_EXTRA_ARGS:-}"
|
||||
done
|
||||
done
|
||||
|
@ -56,7 +56,7 @@ done
|
||||
# Test the Bazel build
|
||||
|
||||
# If we are running on Kokoro, check for a versioned Bazel binary.
|
||||
KOKORO_GFILE_BAZEL_BIN="bazel-8.0.0-darwin-x86_64"
|
||||
KOKORO_GFILE_BAZEL_BIN="bazel-8.2.1-darwin-x86_64"
|
||||
if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -f ${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN} ]]; then
|
||||
BAZEL_BIN="${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN}"
|
||||
chmod +x ${BAZEL_BIN}
|
||||
@ -64,6 +64,12 @@ else
|
||||
BAZEL_BIN="bazel"
|
||||
fi
|
||||
|
||||
# Use Bazel Vendor mode to reduce reliance on external dependencies.
|
||||
if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -f "${KOKORO_GFILE_DIR}/distdir/googletest_vendor.tar.gz" ]]; then
|
||||
tar -xf "${KOKORO_GFILE_DIR}/distdir/googletest_vendor.tar.gz" -C "${TMP}/"
|
||||
BAZEL_EXTRA_ARGS="--vendor_dir=\"${TMP}/googletest_vendor\" ${BAZEL_EXTRA_ARGS:-}"
|
||||
fi
|
||||
|
||||
cd ${GTEST_ROOT}
|
||||
for absl in 0 1; do
|
||||
${BAZEL_BIN} test ... \
|
||||
@ -76,5 +82,6 @@ for absl in 0 1; do
|
||||
--features=external_include_paths \
|
||||
--keep_going \
|
||||
--show_timestamps \
|
||||
--test_output=errors
|
||||
--test_output=errors \
|
||||
${BAZEL_EXTRA_ARGS:-}
|
||||
done
|
||||
|
@ -1,6 +1,6 @@
|
||||
SETLOCAL ENABLEDELAYEDEXPANSION
|
||||
|
||||
SET BAZEL_EXE=%KOKORO_GFILE_DIR%\bazel-8.0.0-windows-x86_64.exe
|
||||
SET BAZEL_EXE=%KOKORO_GFILE_DIR%\bazel-8.2.1-windows-x86_64.exe
|
||||
|
||||
SET PATH=C:\Python34;%PATH%
|
||||
SET BAZEL_PYTHON=C:\python34\python.exe
|
||||
@ -48,6 +48,14 @@ RMDIR /S /Q %CMAKE_BUILD_PATH%
|
||||
:: --output_user_root=C:\tmp causes Bazel to use a shorter path.
|
||||
SET BAZEL_VS=C:\Program Files\Microsoft Visual Studio\2022\Community
|
||||
|
||||
:: Use Bazel Vendor mode to reduce reliance on external dependencies.
|
||||
IF EXIST "%KOKORO_GFILE_DIR%\distdir\googletest_vendor.tar.gz" (
|
||||
tar --force-local -xf "%KOKORO_GFILE_DIR%\distdir\googletest_vendor.tar.gz" -C c:
|
||||
SET VENDOR_FLAG=--vendor_dir=c:\googletest_vendor
|
||||
) ELSE (
|
||||
SET VENDOR_FLAG=
|
||||
)
|
||||
|
||||
:: C++17
|
||||
%BAZEL_EXE% ^
|
||||
--output_user_root=C:\tmp ^
|
||||
@ -58,7 +66,8 @@ SET BAZEL_VS=C:\Program Files\Microsoft Visual Studio\2022\Community
|
||||
--enable_bzlmod=true ^
|
||||
--keep_going ^
|
||||
--test_output=errors ^
|
||||
--test_tag_filters=-no_test_msvc2017
|
||||
--test_tag_filters=-no_test_msvc2017 ^
|
||||
%VENDOR_FLAG%
|
||||
IF %errorlevel% neq 0 EXIT /B 1
|
||||
|
||||
:: C++20
|
||||
@ -71,5 +80,6 @@ IF %errorlevel% neq 0 EXIT /B 1
|
||||
--enable_bzlmod=true ^
|
||||
--keep_going ^
|
||||
--test_output=errors ^
|
||||
--test_tag_filters=-no_test_msvc2017
|
||||
--test_tag_filters=-no_test_msvc2017 ^
|
||||
%VENDOR_FLAG%
|
||||
IF %errorlevel% neq 0 EXIT /B 1
|
||||
|
@ -17,9 +17,9 @@ def googletest_deps():
|
||||
if not native.existing_rule("abseil-cpp"):
|
||||
http_archive(
|
||||
name = "abseil-cpp",
|
||||
sha256 = "b396401fd29e2e679cace77867481d388c807671dc2acc602a0259eeb79b7811",
|
||||
strip_prefix = "abseil-cpp-20250127.1",
|
||||
urls = ["https://github.com/abseil/abseil-cpp/releases/download/20250127.1/abseil-cpp-20250127.1.tar.gz"],
|
||||
sha256 = "7262daa7c1711406248c10f41026d685e88223bc92817d16fb93c19adb57f669",
|
||||
strip_prefix = "abseil-cpp-20250512.0",
|
||||
urls = ["https://github.com/abseil/abseil-cpp/releases/download/20250512.0/abseil-cpp-20250512.0.tar.gz"],
|
||||
)
|
||||
|
||||
if not native.existing_rule("fuchsia_sdk"):
|
||||
|
Loading…
x
Reference in New Issue
Block a user