Skip to content

Commit

Permalink
[tests] Update Googletest to 1.5.2 (#1263)
Browse files Browse the repository at this point in the history
Now we aren't blocked by NaCl's level of C++ support (which
was partial C++11) anymore.
  • Loading branch information
emaxx-google authored Nov 28, 2024
1 parent 7894127 commit 3371c04
Show file tree
Hide file tree
Showing 244 changed files with 25,496 additions and 28,720 deletions.
4 changes: 2 additions & 2 deletions third_party/googletest/README.google
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
URL: https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.zip
Version: 2021.06.11
URL: https://github.com/google/googletest/releases/download/v1.15.2/googletest-1.15.2.tar.gz
Version: 1.15.2
License: BSD
License File: LICENSE
Description:
Expand Down
4 changes: 0 additions & 4 deletions third_party/googletest/src/.clang-format

This file was deleted.

43 changes: 0 additions & 43 deletions third_party/googletest/src/.github/ISSUE_TEMPLATE/00-bug_report.md

This file was deleted.

This file was deleted.

This file was deleted.

84 changes: 0 additions & 84 deletions third_party/googletest/src/.gitignore

This file was deleted.

50 changes: 48 additions & 2 deletions third_party/googletest/src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,38 @@
#
# Bazel Build for Google C++ Testing Framework(Google Test)

load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")

package(default_visibility = ["//visibility:public"])

licenses(["notice"])

exports_files(["LICENSE"])

config_setting(
name = "qnx",
constraint_values = ["@platforms//os:qnx"],
)

config_setting(
name = "windows",
constraint_values = ["@platforms//os:windows"],
)

config_setting(
name = "freebsd",
constraint_values = ["@platforms//os:freebsd"],
)

config_setting(
name = "openbsd",
constraint_values = ["@platforms//os:openbsd"],
)

# NOTE: Fuchsia is not an officially supported platform.
config_setting(
name = "fuchsia",
constraint_values = ["@platforms//os:fuchsia"],
)

config_setting(
name = "msvc_compiler",
flag_values = {
Expand Down Expand Up @@ -86,6 +105,7 @@ cc_library(
"googlemock/include/gmock/*.h",
]),
copts = select({
":qnx": [],
":windows": [],
"//conditions:default": ["-pthread"],
}),
Expand All @@ -104,18 +124,44 @@ cc_library(
"googletest/include",
],
linkopts = select({
":qnx": ["-lregex"],
":windows": [],
":freebsd": [
"-lm",
"-pthread",
],
":openbsd": [
"-lm",
"-pthread",
],
"//conditions:default": ["-pthread"],
}),
deps = select({
":has_absl": [
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/debugging:failure_signal_handler",
"@com_google_absl//absl/debugging:stacktrace",
"@com_google_absl//absl/debugging:symbolize",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/flags:reflection",
"@com_google_absl//absl/flags:usage",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:any",
"@com_google_absl//absl/types:optional",
"@com_google_absl//absl/types:variant",
"@com_googlesource_code_re2//:re2",
],
"//conditions:default": [],
}) + select({
# `gtest-death-test.cc` has `EXPECT_DEATH` that spawns a process,
# expects it to crash and inspects its logs with the given matcher,
# so that's why these libraries are needed.
# Otherwise, builds targeting Fuchsia would fail to compile.
":fuchsia": [
"@fuchsia_sdk//pkg/fdio",
"@fuchsia_sdk//pkg/syslog",
"@fuchsia_sdk//pkg/zx",
],
"//conditions:default": [],
}),
Expand Down
26 changes: 15 additions & 11 deletions third_party/googletest/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
# Note: CMake support is community-based. The maintainers do not use CMake
# internally.

cmake_minimum_required(VERSION 2.8.12)

if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
cmake_minimum_required(VERSION 3.13)

project(googletest-distribution)
set(GOOGLETEST_VERSION 1.11.0)
set(GOOGLETEST_VERSION 1.15.2)

if (CMAKE_VERSION VERSION_GREATER "3.0.2")
if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

enable_testing()

include(CMakeDependentOption)
include(GNUInstallDirs)

#Note that googlemock target already builds googletest
# Note that googlemock target already builds googletest.
option(BUILD_GMOCK "Builds the googlemock subproject" ON)
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
option(GTEST_HAS_ABSL "Use Abseil and RE2. Requires Abseil and RE2 to be separately added to the build." OFF)

if(GTEST_HAS_ABSL)
if(NOT TARGET absl::base)
find_package(absl REQUIRED)
endif()
if(NOT TARGET re2::re2)
find_package(re2 REQUIRED)
endif()
endif()

if(BUILD_GMOCK)
add_subdirectory( googlemock )
Expand Down
Loading

0 comments on commit 3371c04

Please sign in to comment.