Add macro to define gtest death_test_style using an older syntax (#27042)

This temporarily unblocks a related gtest upgrade. The ultimate goal is
to upgraade our gtest dependencies, but I don't have the cycles to
manage a potentially messy migration until at least next week. This PR
is coordinated with an internal change.
pull/27051/head
AJ Heller 4 years ago committed by GitHub
parent c5b7d4101d
commit 58f8f5ced3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CMakeLists.txt
  2. 3
      build_autogenerated.yaml
  3. 2
      test/cpp/end2end/BUILD
  4. 3
      test/cpp/end2end/grpclb_end2end_test.cc
  5. 3
      test/cpp/end2end/xds_end2end_test.cc
  6. 1
      test/cpp/util/BUILD
  7. 3
      test/cpp/util/grpc_tool_test.cc
  8. 5
      test/cpp/util/test_config.h

3
CMakeLists.txt generated

@ -11628,6 +11628,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc++_reflection
grpc++_test_config
grpc++_test_util
)
@ -11725,6 +11726,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
target_link_libraries(grpclb_end2end_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc++_test_config
grpc++_test_util
)
@ -15762,6 +15764,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
target_link_libraries(xds_end2end_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc++_test_config
grpc++_test_util
)

@ -5531,6 +5531,7 @@ targets:
- test/cpp/util/service_describer.cc
deps:
- grpc++_reflection
- grpc++_test_config
- grpc++_test_util
platforms:
- linux
@ -5562,6 +5563,7 @@ targets:
- test/cpp/end2end/grpclb_end2end_test.cc
- test/cpp/end2end/test_service_impl.cc
deps:
- grpc++_test_config
- grpc++_test_util
platforms:
- linux
@ -7035,6 +7037,7 @@ targets:
- test/cpp/end2end/test_service_impl.cc
- test/cpp/end2end/xds_end2end_test.cc
deps:
- grpc++_test_config
- grpc++_test_util
platforms:
- linux

@ -506,6 +506,7 @@ grpc_cc_test(
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
)
@ -561,6 +562,7 @@ grpc_cc_test(
"//src/proto/grpc/testing/xds/v3:router_proto",
"//src/proto/grpc/testing/xds/v3:tls_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
)

@ -57,6 +57,7 @@
#include "test/core/util/resolve_localhost_ip46.h"
#include "test/core/util/test_config.h"
#include "test/cpp/end2end/test_service_impl.h"
#include "test/cpp/util/test_config.h"
#include "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
@ -958,7 +959,7 @@ TEST_F(SingleBalancerTest, SecureNaming) {
}
TEST_F(SingleBalancerTest, SecureNamingDeathTest) {
::testing::FLAGS_gtest_death_test_style = "threadsafe";
GRPC_GTEST_FLAG_SET_DEATH_TEST_STYLE("threadsafe");
// Make sure that we blow up (via abort() from the security connector) when
// the name from the balancer doesn't match expectations.
ASSERT_DEATH_IF_SUPPORTED(

@ -94,6 +94,7 @@
#include "test/core/util/resolve_localhost_ip46.h"
#include "test/core/util/test_config.h"
#include "test/cpp/end2end/test_service_impl.h"
#include "test/cpp/util/test_config.h"
#ifndef DISABLED_XDS_PROTO_IN_CC
#include "src/cpp/server/csds/csds.h"
@ -3579,7 +3580,7 @@ TEST_P(SecureNamingTest, TargetNameIsExpected) {
// Tests that secure naming check fails if target name is unexpected.
TEST_P(SecureNamingTest, TargetNameIsUnexpected) {
::testing::FLAGS_gtest_death_test_style = "threadsafe";
GRPC_GTEST_FLAG_SET_DEATH_TEST_STYLE("threadsafe");
SetNextResolution({});
SetNextResolutionForLbChannel({balancers_[0]->port()}, nullptr,
"incorrect_server_name");

@ -204,6 +204,7 @@ grpc_cc_test(
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing:simple_messages_proto",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_config",
],
)

@ -42,6 +42,7 @@
#include "test/core/util/test_config.h"
#include "test/cpp/util/cli_credentials.h"
#include "test/cpp/util/string_ref_helper.h"
#include "test/cpp/util/test_config.h"
#define CA_CERT_PATH "src/core/tsi/test_creds/ca.pem"
#define SERVER_CERT_PATH "src/core/tsi/test_creds/server1.pem"
@ -1345,6 +1346,6 @@ TEST_F(GrpcToolTest, ConfiguringDefaultServiceConfig) {
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
::testing::InitGoogleTest(&argc, argv);
::testing::FLAGS_gtest_death_test_style = "threadsafe";
GRPC_GTEST_FLAG_SET_DEATH_TEST_STYLE("threadsafe");
return RUN_ALL_TESTS();
}

@ -19,6 +19,11 @@
#ifndef GRPC_TEST_CPP_UTIL_TEST_CONFIG_H
#define GRPC_TEST_CPP_UTIL_TEST_CONFIG_H
#ifndef GRPC_GTEST_FLAG_SET_DEATH_TEST_STYLE
#define GRPC_GTEST_FLAG_SET_DEATH_TEST_STYLE(style) \
::testing::FLAGS_gtest_death_test_style = style
#endif // GRPC_GTEST_FLAG_SET_DEATH_TEST_STYLE
namespace grpc {
namespace testing {

Loading…
Cancel
Save