Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Upgrade GoogleTest version from 1.12.1 to 1.13.0 #2114

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
key: bazel_benchmark
- name: setup
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: Run benchmark
id: run_benchmarks
run: |
Expand Down
35 changes: 16 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ jobs:
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
GOOGLETEST_VERSION: 1.12.1
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -109,7 +108,6 @@ jobs:
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
GOOGLETEST_VERSION: 1.12.1
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -142,7 +140,6 @@ jobs:
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
GOOGLETEST_VERSION: 1.12.1
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -175,7 +172,6 @@ jobs:
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
GOOGLETEST_VERSION: 1.12.1
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -241,8 +237,8 @@ jobs:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run cmake tests (enable abseil-cpp)
run: |
sudo ./ci/install_abseil.sh
Expand All @@ -257,8 +253,8 @@ jobs:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run cmake tests (enable opentracing-shim)
run: ./ci/do_ci.sh cmake.opentracing_shim.test

Expand All @@ -281,8 +277,9 @@ jobs:
env:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8
GOOGLETEST_VERSION: "1.10.0"
run: sudo -E ./ci/setup_cmake.sh
GOOGLETEST_VERSION: 1.10.0
run: |
sudo -E ./ci/setup_cmake.sh
- name: run tests
env:
CC: /usr/bin/gcc-4.8
Expand All @@ -308,7 +305,7 @@ jobs:
env:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8
GOOGLETEST_VERSION: "1.10.0"
marcalff marked this conversation as resolved.
Show resolved Hide resolved
GOOGLETEST_VERSION: 1.10.0
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_grpc.sh -v 4.8
Expand All @@ -327,7 +324,7 @@ jobs:
submodules: 'recursive'
- name: setup
env:
CMAKE_VERSION: "3.20.6"
CMAKE_VERSION: 3.20.6
run: |
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
Expand All @@ -348,7 +345,7 @@ jobs:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CXXFLAGS: "-stdlib=libc++"
CMAKE_VERSION: "3.20.6"
CMAKE_VERSION: 3.20.6
run: |
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
Expand All @@ -374,8 +371,8 @@ jobs:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run otlp exporter tests
run: |
sudo ./ci/setup_grpc.sh
Expand All @@ -390,8 +387,8 @@ jobs:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run otlp exporter tests
run: |
sudo ./ci/setup_grpc.sh
Expand All @@ -406,8 +403,8 @@ jobs:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run otlp exporter tests
run: |
sudo ./ci/setup_grpc.sh -T
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ jobs:
run: |
rm -rf third_party
- name: Setup
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.12.1
run: |
sudo CC=/usr/bin/gcc-10 CXX=/usr/bin/g++-10 ./ci/setup_cmake.sh
sudo CC=/usr/bin/gcc-10 CXX=/usr/bin/g++-10 ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ set(OTELCPP_PROTO_PATH
if(WIN32)
if(BUILD_TESTING)
if(MSVC)
# GTest bug: https://github.com/google/googletest/issues/860
add_compile_options(/wd4275)
# Warning as error: warning STL4036: <ciso646> is removed in C++20
add_compile_options(/wd4996)
marcalff marked this conversation as resolved.
Show resolved Hide resolved
endif()
endif()
option(WITH_ETW "Whether to include the ETW Exporter in the SDK" ON)
Expand Down
6 changes: 3 additions & 3 deletions bazel/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def opentelemetry_cpp_deps():
maybe(
http_archive,
name = "com_google_googletest",
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
strip_prefix = "googletest-release-1.12.1",
sha256 = "ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363",
strip_prefix = "googletest-1.13.0",
urls = [
"https://github.com/google/googletest/archive/release-1.12.1.tar.gz",
"https://github.com/google/googletest/archive/v1.13.0.tar.gz",
],
)

Expand Down
16 changes: 14 additions & 2 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ if [[ "$1" == "cmake.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=14 \
marcalff marked this conversation as resolved.
Show resolved Hide resolved
-DWITH_PROMETHEUS=ON \
-DWITH_ZIPKIN=ON \
-DWITH_ELASTICSEARCH=ON \
Expand All @@ -103,6 +104,7 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON \
-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
Expand All @@ -127,6 +129,7 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON \
-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
Expand Down Expand Up @@ -175,6 +178,7 @@ elif [[ "$1" == "cmake.with_async_export.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_PROMETHEUS=ON \
-DWITH_ZIPKIN=ON \
-DWITH_ELASTICSEARCH=ON \
Expand All @@ -190,6 +194,7 @@ elif [[ "$1" == "cmake.abseil.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_METRICS_EXEMPLAR_PREVIEW=ON \
-DWITH_LOGS_PREVIEW=ON \
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \
Expand All @@ -203,6 +208,7 @@ elif [[ "$1" == "cmake.opentracing_shim.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=14 \
-DCMAKE_CXX_FLAGS="-Werror -Wno-error=redundant-move $CXXFLAGS" \
-DWITH_OPENTRACING=ON \
"${SRC_DIR}"
Expand All @@ -213,9 +219,9 @@ elif [[ "$1" == "cmake.c++20.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DCMAKE_CXX_STANDARD=20 \
${IWYU} \
"${SRC_DIR}"
eval "$MAKE_COMMAND"
Expand All @@ -225,6 +231,7 @@ elif [[ "$1" == "cmake.c++20.stl.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=20 \
-DWITH_METRICS_EXEMPLAR_PREVIEW=ON \
-DWITH_LOGS_PREVIEW=ON \
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \
Expand All @@ -241,8 +248,8 @@ elif [[ "$1" == "cmake.legacy.test" ]]; then
export BUILD_ROOT="${BUILD_DIR}"
${SRC_DIR}/tools/build-benchmark.sh
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \
-DCMAKE_CXX_STANDARD=11 \
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \
"${SRC_DIR}"
make -j $(nproc)
make test
Expand All @@ -268,6 +275,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON \
Expand All @@ -282,6 +290,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.shared_libs.with_static_grpc.test" ]]
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DBUILD_SHARED_LIBS=ON \
Expand All @@ -296,6 +305,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.with_async_export.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
Expand All @@ -310,6 +320,7 @@ elif [[ "$1" == "cmake.do_not_install.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
Expand Down Expand Up @@ -436,6 +447,7 @@ elif [[ "$1" == "code.coverage" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=14 \
-DCMAKE_CXX_FLAGS="-Werror --coverage $CXXFLAGS" \
"${SRC_DIR}"
make
Expand Down
83 changes: 51 additions & 32 deletions ci/setup_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,69 @@ export DEBIAN_FRONTEND=noninteractive
apt-get update

if [ "x$CMAKE_VERSION" = "x" ]; then
# By default, CMake version set the following version.
export CMAKE_VERSION=3.15.2
fi

if [ "x$GOOGLETEST_VERSION" = "x" ]; then
export GOOGLETEST_VERSION=1.12.1
# This variable not set on CI pipeline for only legacy environment(GCC 4.8).
# With 1.13.0 version, C++14 must be set which does not supported by legacy environment anymore.
# Also with this version, release version path needs to be adapted.
if [ -z "${GOOGLETEST_VERSION}" ]; then
# By default, GoogleTest version set the following version.
export GOOGLETEST_VERSION=1.13.0
fi

cmake_install() {
tmp_dir=$(mktemp -d)
pushd $tmp_dir
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh
chmod +x cmake-${CMAKE_VERSION}-Linux-x86_64.sh
./cmake-${CMAKE_VERSION}-Linux-x86_64.sh --prefix=/usr/local --skip-license
rm cmake-${CMAKE_VERSION}-Linux-x86_64.sh
popd
OLD_GOOGLETEST_VERSION_REGEXP="^1\.([0-9]|10|11|12)(\..*)?$"

# If GoogleTest version less than ${GOOGLETEST_LATEST_VERSION}
# Else otherwise
if [[ ${GOOGLETEST_VERSION} =~ ${OLD_GOOGLETEST_VERSION_REGEXP} ]]; then
GOOGLETEST_VERSION_PATH="release-${GOOGLETEST_VERSION}"
GOOGLETEST_FOLDER_PATH="googletest-release-${GOOGLETEST_VERSION}"
else
GOOGLETEST_VERSION_PATH="v${GOOGLETEST_VERSION}"
GOOGLETEST_FOLDER_PATH="googletest-${GOOGLETEST_VERSION}"
fi

cmake_install()
{
tmp_dir=$(mktemp -d)
pushd $tmp_dir
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh
chmod +x cmake-${CMAKE_VERSION}-Linux-x86_64.sh
./cmake-${CMAKE_VERSION}-Linux-x86_64.sh --prefix=/usr/local --skip-license
rm cmake-${CMAKE_VERSION}-Linux-x86_64.sh
popd
}

googletest_install() {
# Follows these instructions
# https://gist.github.com/dlime/313f74fd23e4267c4a915086b84c7d3d
tmp_dir=$(mktemp -d)
pushd $tmp_dir
wget https://github.com/google/googletest/archive/release-${GOOGLETEST_VERSION}.tar.gz
tar -xf release-${GOOGLETEST_VERSION}.tar.gz
cd googletest-release-${GOOGLETEST_VERSION}/
mkdir build && cd build
cmake .. -DBUILD_SHARED_LIBS=ON -DINSTALL_GTEST=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr
make -j $(nproc)
make install
ldconfig
popd
googletest_install()
{
# Follows these instructions
# https://gist.github.com/dlime/313f74fd23e4267c4a915086b84c7d3d
tmp_dir=$(mktemp -d)
pushd $tmp_dir
wget https://github.com/google/googletest/archive/${GOOGLETEST_VERSION_PATH}.tar.gz
tar -xf ${GOOGLETEST_VERSION_PATH}.tar.gz
cd ${GOOGLETEST_FOLDER_PATH}/
mkdir build && cd build
cmake .. -DBUILD_SHARED_LIBS=ON -DINSTALL_GTEST=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr
make -j $(nproc)
make install
ldconfig
popd
}

cmake_install

set +e
echo \
libbenchmark-dev \
zlib1g-dev \
sudo \
libcurl4-openssl-dev \
nlohmann-json-dev \
nlohmann-json3 \
nlohmann-json3-dev | xargs -n 1 apt-get install --ignore-missing --no-install-recommends --no-install-suggests -y
echo \
libbenchmark-dev \
zlib1g-dev \
sudo \
libcurl4-openssl-dev \
nlohmann-json-dev \
nlohmann-json3 \
nlohmann-json3-dev | xargs -n 1 apt-get install --ignore-missing --no-install-recommends --no-install-suggests -y
set -e

googletest_install
Loading