Skip to content

Update googletest to 1.15.2 #36699

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

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
aa0f563
Update googletest to 1.15.2
asedeno Oct 18, 2024
dfd9693
Adjust flags used by tests to accomodate googletest's move to absl flags
asedeno Oct 18, 2024
4574384
Use googletest's new(ish) FLAGS macros.
asedeno Oct 18, 2024
d79d2d3
DeathTest updates
asedeno Oct 18, 2024
5cc0564
Updates to DeathTest regular expressions to match multiline in re2
asedeno Oct 18, 2024
36349b0
Fix an ambiguous-reversed-operator issue
asedeno Oct 18, 2024
16b3729
Pick up a change from a previous attempt at updating googletest
asedeno Oct 18, 2024
b682527
googletest: load deps from googletest
asedeno Oct 18, 2024
9c6c7b0
Use GMOCK_FLAG_SET
asedeno Oct 18, 2024
41ab261
buffer_accounting_integration_test.cc: move deathtest alias and insta…
asedeno Oct 18, 2024
e8ee757
googletest patch: strip fuchsia out of BUILD.bazel
asedeno Oct 19, 2024
452d443
more resources for tests that fail to build
asedeno Oct 19, 2024
7b9e1a0
more resources for tests that fail to build
asedeno Oct 19, 2024
d9f0f95
more resources for tests that fail to build
asedeno Oct 21, 2024
70380f4
Merge branch 'main' into update_googletest
asedeno Oct 21, 2024
aa8fd76
more resources for tests that fail to build
asedeno Oct 21, 2024
1ae9162
more resources for tests that fail to build
asedeno Oct 21, 2024
3c1a085
more resources for tests that fail to build
asedeno Oct 22, 2024
44dc93d
more resources for tests that fail to build
asedeno Oct 22, 2024
3782561
more resources for tests that fail to build
asedeno Oct 22, 2024
7b83911
Mobile build pool doesn't have 2core/4core
asedeno Oct 22, 2024
5e0f84f
more resources for tests that fail to build
asedeno Oct 22, 2024
81863c8
more resources for tests that fail to build
asedeno Oct 22, 2024
a789e52
Merge branch 'main' into update_googletest
asedeno Oct 22, 2024
cb7205d
Merge branch 'main' into update_googletest
asedeno Oct 22, 2024
7eced89
one more rbe_pool 2core -> 6gig
asedeno Oct 22, 2024
6625d9b
Merge branch 'main' into update_googletest
asedeno Oct 23, 2024
d30def7
Merge branch 'main' into update_googletest
asedeno Oct 25, 2024
5588d1e
Merge branch 'main' into update_googletest
asedeno Nov 11, 2024
aa2b11d
more resources for tests that fail to build
asedeno Nov 14, 2024
d021654
define engflow_rbe in mobile RBE builds to make rbe_pool work
asedeno Nov 15, 2024
300cae1
more resources for tests that fail to build
asedeno Nov 15, 2024
225a29e
more resources for tests that fail to build
asedeno Nov 15, 2024
bfd66b9
mobile rbe_pool support for linux-asan only for now
asedeno Nov 15, 2024
6b081b6
more resources for tests that fail to build
asedeno Nov 15, 2024
3d04c4a
More DeathTest updates
asedeno Nov 15, 2024
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
2 changes: 1 addition & 1 deletion bazel/envoy_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def envoy_cc_test(
] + envoy_pch_deps(repository, "//test:test_pch"),
# from https://github.com/google/googletest/blob/6e1970e2376c14bf658eb88f655a054030353f9f/googlemock/src/gmock.cc#L51
# 2 - by default, mocks act as StrictMocks.
args = args + ["--gmock_default_mock_behavior=2"],
args = ["--gmock_default_mock_behavior=2"] + args,
tags = coverage_tags,
local = local,
shard_count = shard_count,
Expand Down
38 changes: 30 additions & 8 deletions bazel/googletest.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
diff --git a/BUILD.bazel b/BUILD.bazel
index 8099642a85..3598661079 100644
index e407ae29..b1e3b7fb 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -40,7 +40,7 @@ exports_files(["LICENSE"])

config_setting(
name = "windows",
- constraint_values = ["@bazel_tools//platforms:windows"],
+ constraint_values = ["@platforms//os:windows"],
@@ -56,12 +56,6 @@ config_setting(
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 = {
@@ -153,17 +147,6 @@ cc_library(
"@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": [],
}),
)

10 changes: 5 additions & 5 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -933,15 +933,15 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_url = "https://github.com/google/googletest",
# Pick up fix for MOCK_METHOD compilation with clang-cl for Windows (resolved after 1.10.0)
# see https://github.com/google/googletest/issues/2490
version = "a4ab0abb93620ce26efad9de9296b73b16e88588",
sha256 = "7897bfaa5ad39a479177cfb5c3ce010184dbaee22a7c3727b212282871918751",
version = "1.15.2",
sha256 = "7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926",
strip_prefix = "googletest-{version}",
urls = ["https://github.com/google/googletest/archive/{version}.tar.gz"],
release_date = "2020-09-10",
urls = ["https://github.com/google/googletest/releases/download/v{version}/googletest-{version}.tar.gz"],
release_date = "2024-07-31",
use_category = ["test_only"],
cpe = "cpe:2.3:a:google:google_test:*",
license = "BSD-3-Clause",
license_url = "https://github.com/google/googletest/blob/{version}/LICENSE",
license_url = "https://github.com/google/googletest/blob/v{version}/LICENSE",
),
com_google_protobuf = dict(
project_name = "Protocol Buffers",
Expand Down
5 changes: 5 additions & 0 deletions mobile/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ build:mobile-remote-ci-linux-asan --config=mobile-clang-asan
build:mobile-remote-ci-linux-asan --config=mobile-remote-ci-linux-clang
build:mobile-remote-ci-linux-asan --config=remote-ci
build:mobile-remote-ci-linux-asan --build_tests_only
# This is probably not the right place to put this, since this target
# isn't engflow-specific. However, we only need to enable rbe_pool for
# asan builds right now and this should help unblock testing on the PR.
# TODO(asedeno): Figure out something better before merging.
build:mobile-remote-ci-linux-asan --define=engflow_rbe=true
test:mobile-remote-ci-linux-asan --test_env=ENVOY_IP_TEST_VERSIONS=v4only

#############################################################################
Expand Down
1 change: 1 addition & 0 deletions mobile/test/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ envoy_cc_test(
envoy_cc_test(
name = "internal_engine_test",
srcs = ["internal_engine_test.cc"],
rbe_pool = "6gig",
repository = "@envoy",
deps = [
"//library/cc:engine_builder_lib",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ envoy_extension_cc_test(
"platform_bridge_filter_integration_test.cc",
],
extension_names = ["envoy.filters.http.platform_bridge"],
rbe_pool = "6gig",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wont work out of the box - what it actually needs to be is:

exec_properties = {"Pool": "6gig"}

probably it makes sense to set up a macro - so that you can set it as rbe_pool - see eg

exec_properties = exec_properties | select({
repository + "//bazel:engflow_rbe": {"Pool": rbe_pool} if rbe_pool else {},
"//conditions:default": {},
})

repository = "@envoy",
deps = [
"//library/common/api:external_api_lib",
Expand Down
3 changes: 3 additions & 0 deletions mobile/test/common/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ envoy_cc_test(
],
"//conditions:default": [],
}),
rbe_pool = "6gig",
repository = "@envoy",
shard_count = 6,
deps = [
Expand All @@ -46,6 +47,7 @@ envoy_cc_test_library(
hdrs = [
"base_client_integration_test.h",
],
rbe_pool = "6gig",
repository = "@envoy",
deps = [
"//library/cc:engine_builder_lib",
Expand All @@ -70,6 +72,7 @@ envoy_cc_test_library(
data = [
"@envoy//test/config/integration/certs",
],
rbe_pool = "6gig",
repository = "@envoy",
deps = [
"//library/common:engine_common_lib",
Expand Down
2 changes: 1 addition & 1 deletion test/common/buffer/owned_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ TEST_F(OwnedImplTest, PrependEmpty) {
EXPECT_EQ(0, buf.length());
}

TEST(OverflowDetectingUInt64, Arithmetic) {
TEST(OverflowDetectingUInt64DeathTest, Arithmetic) {
OverflowDetectingUInt64 length;
length += 1;
length -= 1;
Expand Down
10 changes: 8 additions & 2 deletions test/common/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ envoy_cc_test(
envoy_cc_test(
name = "log_verbosity_update_test",
srcs = ["log_verbosity_update_test.cc"],
args = ["--enable-fine-grain-logging"],
args = [
"--",
"--enable-fine-grain-logging",
],
rbe_pool = "6gig",
deps = [
"//source/common/common:minimal_logger_lib",
Expand All @@ -213,7 +216,10 @@ envoy_cc_test(
envoy_cc_test(
name = "fine_grain_log_macros_test",
srcs = ["log_macros_test.cc"],
args = ["--enable-fine-grain-logging"],
args = [
"--",
"--enable-fine-grain-logging",
],
rbe_pool = "6gig",
deps = [
"//source/common/common:minimal_logger_lib",
Expand Down
4 changes: 3 additions & 1 deletion test/common/event/dispatcher_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1600,6 +1600,8 @@ class DispatcherConnectionTest : public testing::Test {
DispatcherPtr dispatcher_;
};

using DispatcherConnectionDeathTest = DispatcherConnectionTest;

TEST_F(DispatcherConnectionTest, CreateTcpConnection) {
for (auto ip_version : TestEnvironment::getIpVersionsForTest()) {
SCOPED_TRACE(Network::Test::addressVersionAsString(ip_version));
Expand All @@ -1615,7 +1617,7 @@ TEST_F(DispatcherConnectionTest, CreateTcpConnection) {

// If the internal connection factory is not linked, envoy will be dead when creating connection to
// internal address.
TEST_F(DispatcherConnectionTest, CreateEnvoyInternalConnectionWhenFactoryNotExist) {
TEST_F(DispatcherConnectionDeathTest, CreateEnvoyInternalConnectionWhenFactoryNotExist) {
EXPECT_DEATH(
dispatcher_->createClientConnection(
std::make_shared<Network::Address::EnvoyInternalInstance>("listener_internal_address"),
Expand Down
2 changes: 1 addition & 1 deletion test/common/http/header_mutation_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ TEST(HeaderMutationsTest, BasicOrder) {
}
}

TEST(HeaderMutationTest, Death) {
TEST(HeaderMutationDeathTest, Death) {
ProtoHeaderMutatons proto_mutations;
proto_mutations.Add();

Expand Down
1 change: 1 addition & 0 deletions test/common/listener_manager/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ envoy_cc_test_library(
name = "listener_manager_impl_test_lib",
hdrs = ["listener_manager_impl_test.h"],
data = ["//test/common/tls/test_data:certs"],
rbe_pool = "6gig",
deps = [
":config_cc_proto",
"//source/common/formatter:formatter_extension_lib",
Expand Down
13 changes: 9 additions & 4 deletions test/common/quic/envoy_quic_client_session_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ class EnvoyQuicClientSessionTest : public testing::TestWithParam<quic::ParsedQui
INSTANTIATE_TEST_SUITE_P(EnvoyQuicClientSessionTests, EnvoyQuicClientSessionTest,
testing::ValuesIn(quic::CurrentSupportedHttp3Versions()));

using EnvoyQuicClientSessionDeathTest = EnvoyQuicClientSessionTest;

INSTANTIATE_TEST_SUITE_P(EnvoyQuicClientSessionTests, EnvoyQuicClientSessionDeathTest,
testing::ValuesIn(quic::CurrentSupportedHttp3Versions()));

TEST_P(EnvoyQuicClientSessionTest, ShutdownNoOp) { http_connection_->shutdownNotice(); }

TEST_P(EnvoyQuicClientSessionTest, NewStream) {
Expand Down Expand Up @@ -445,29 +450,29 @@ TEST_P(EnvoyQuicClientSessionTest, VerifyContext) {
EXPECT_TRUE(verify_context.extraValidationContext().callbacks->ioHandle().isOpen());
}

TEST_P(EnvoyQuicClientSessionTest, VerifyContextAbortOnRaiseEvent) {
TEST_P(EnvoyQuicClientSessionDeathTest, VerifyContextAbortOnRaiseEvent) {
auto& verify_context =
dynamic_cast<EnvoyQuicProofVerifyContext&>(crypto_stream_factory_.lastVerifyContext().ref());
EXPECT_DEATH(verify_context.extraValidationContext().callbacks->raiseEvent(
Network::ConnectionEvent::Connected),
"unexpectedly reached");
}

TEST_P(EnvoyQuicClientSessionTest, VerifyContextAbortOnShouldDrainReadBuffer) {
TEST_P(EnvoyQuicClientSessionDeathTest, VerifyContextAbortOnShouldDrainReadBuffer) {
auto& verify_context =
dynamic_cast<EnvoyQuicProofVerifyContext&>(crypto_stream_factory_.lastVerifyContext().ref());
EXPECT_DEATH(verify_context.extraValidationContext().callbacks->shouldDrainReadBuffer(),
"unexpectedly reached");
}

TEST_P(EnvoyQuicClientSessionTest, VerifyContextAbortOnSetTransportSocketIsReadable) {
TEST_P(EnvoyQuicClientSessionDeathTest, VerifyContextAbortOnSetTransportSocketIsReadable) {
auto& verify_context =
dynamic_cast<EnvoyQuicProofVerifyContext&>(crypto_stream_factory_.lastVerifyContext().ref());
EXPECT_DEATH(verify_context.extraValidationContext().callbacks->setTransportSocketIsReadable(),
"unexpectedly reached");
}

TEST_P(EnvoyQuicClientSessionTest, VerifyContextAbortOnFlushWriteBuffer) {
TEST_P(EnvoyQuicClientSessionDeathTest, VerifyContextAbortOnFlushWriteBuffer) {
auto& verify_context =
dynamic_cast<EnvoyQuicProofVerifyContext&>(crypto_stream_factory_.lastVerifyContext().ref());
EXPECT_DEATH(verify_context.extraValidationContext().callbacks->flushWriteBuffer(),
Expand Down
8 changes: 5 additions & 3 deletions test/common/quic/quic_filter_manager_connection_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class QuicFilterManagerConnectionImplTest : public ::testing::Test {
TestQuicFilterManagerConnectionImpl impl_;
};

using QuicFilterManagerConnectionImplDeathTest = QuicFilterManagerConnectionImplTest;

TEST_F(QuicFilterManagerConnectionImplTest, ConnectionInfoProviderSharedPtr) {
EXPECT_TRUE(impl_.connectionInfoProviderSharedPtr() != nullptr);
impl_.closeNow();
Expand Down Expand Up @@ -113,19 +115,19 @@ TEST_F(QuicFilterManagerConnectionImplTest, RawWrite) {
EXPECT_ENVOY_BUG(impl_.rawWrite(data, true), "unexpected call to rawWrite");
}

TEST_F(QuicFilterManagerConnectionImplTest, BufferLimit) {
TEST_F(QuicFilterManagerConnectionImplDeathTest, BufferLimit) {
EXPECT_DEATH(impl_.bufferLimit(), "not implemented");
}

TEST_F(QuicFilterManagerConnectionImplTest, SetBufferLimits) {
EXPECT_ENVOY_BUG(impl_.setBufferLimits(1), "unexpected call to setBufferLimits");
}

TEST_F(QuicFilterManagerConnectionImplTest, GetWriteBuffer) {
TEST_F(QuicFilterManagerConnectionImplDeathTest, GetWriteBuffer) {
EXPECT_DEATH(impl_.getWriteBuffer(), "not implemented");
}

TEST_F(QuicFilterManagerConnectionImplTest, EnableHalfClose) {
TEST_F(QuicFilterManagerConnectionImplDeathTest, EnableHalfClose) {
impl_.enableHalfClose(false); // No-op
EXPECT_DEATH(impl_.enableHalfClose(true), "Quic connection doesn't support half close.");
}
Expand Down
2 changes: 2 additions & 0 deletions test/common/runtime/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ envoy_cc_test(
name = "runtime_flag_override_test",
srcs = ["runtime_flag_override_test.cc"],
args = [
"--",
"--runtime-feature-override-for-tests=envoy.reloadable_features.test_feature_false",
"--runtime-feature-disable-for-tests=envoy.reloadable_features.test_feature_true",
],
Expand All @@ -78,6 +79,7 @@ envoy_cc_test(
name = "runtime_flag_override_noop_test",
srcs = ["runtime_flag_override_noop_test.cc"],
args = [
"--",
"--runtime-feature-override-for-tests=envoy.reloadable_features.test_feature_true",
"--runtime-feature-disable-for-tests=envoy.reloadable_features.test_feature_false",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ namespace {

class CrashIntegrationTest : public Event::TestUsingSimulatedTime,
public HttpProtocolIntegrationTest {
public:
void SetUp() override { GTEST_FLAG_SET(death_test_style, "threadsafe"); }

protected:
void initializeFilter(const std::string& filter_config) {
config_helper_.prependFilter(filter_config);
Expand Down Expand Up @@ -69,8 +72,8 @@ TEST_P(CrashIntegrationTestAllProtocols, UnwindsTrackedObjectStack) {
// - Http(1|2)::ConnectionImpl
// - Network::ConnectionImpl
const std::string death_string = GetParam().downstream_protocol == Http::CodecType::HTTP2
? "ActiveStream.*Http2::ConnectionImpl.*ConnectionImpl"
: "ActiveStream.*Http1::ConnectionImpl.*ConnectionImpl";
? "(?s)ActiveStream.*Http2::ConnectionImpl.*ConnectionImpl"
: "(?s)ActiveStream.*Http1::ConnectionImpl.*ConnectionImpl";
EXPECT_DEATH(sendRequestAndWaitForResponse(request_headers, 0, default_response_headers_, 1024),
death_string);
}
Expand All @@ -93,7 +96,7 @@ TEST_P(CrashIntegrationTestAllProtocols, ResponseCrashDumpsTheCorrespondingReque
// Check that we dump the downstream request
EXPECT_DEATH(
sendRequestAndWaitForResponse(default_request_headers_, 0, kill_response_headers, 1024),
"Dumping corresponding downstream request.*UpstreamRequest.*request_headers:");
"(?s)Dumping corresponding downstream request.*UpstreamRequest.*request_headers:");
}

TEST_P(CrashIntegrationTestAllProtocols, DecodeContinueDoesNotAddTrackedObjectIfExists) {
Expand Down Expand Up @@ -164,7 +167,7 @@ TEST_P(CrashIntegrationTestAllProtocols, DecodeContinueAddsCrashContextIfNoneExi
// - ActiveStream
// - Network::ConnectionImpl
EXPECT_DEATH(sendRequestAndWaitForResponse(request_headers, 0, default_response_headers_, 1024),
"ActiveStream.*.*ConnectionImpl");
"(?s)ActiveStream.*.*ConnectionImpl");
}

TEST_P(CrashIntegrationTestAllProtocols, EncodeContinueDoesNotAddTrackedObjectIfExists) {
Expand Down Expand Up @@ -231,7 +234,7 @@ TEST_P(CrashIntegrationTestAllProtocols, EncodeContinueAddsCrashContextIfNoneExi
// - ActiveStream
// - Network::ConnectionImpl
EXPECT_DEATH(sendRequestAndWaitForResponse(default_request_headers_, 0, kill_response_headers, 0),
"ActiveStream.*.*ConnectionImpl");
"(?s)ActiveStream.*.*ConnectionImpl");
}

#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace {

class KillRequestFilterIntegrationTest : public Event::TestUsingSimulatedTime,
public HttpProtocolIntegrationTest {
public:
void SetUp() override { GTEST_FLAG_SET(death_test_style, "threadsafe"); }

protected:
void initializeFilter(const std::string& filter_config) {
config_helper_.prependFilter(filter_config);
Expand Down
Loading