diff options
author | Tanvi Jagtap <139093547+tanvi-jagtap@users.noreply.github.com> | 2024-04-05 23:11:51 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-04-05 23:14:29 -0700 |
commit | ddb785674ca6c21f9aeee4018b9ef4594ed41cc4 (patch) | |
tree | 83171d2b16cdf6affc0e2268904abdde6c7c73c6 | |
parent | 536899d998791187afc87ccdbf19d81473ae8efe (diff) | |
download | grpc-grpc-ddb785674ca6c21f9aeee4018b9ef4594ed41cc4.tar.gz |
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT (#36223)
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - GPR_ASSERT
Replacing GPR_ASSERT with absl CHECK
Will not be replacing CHECK with CHECK_EQ , CHECK_NE etc because there are too many callsites.
This could be done using Cider-V once these changes are submitted if we want to clean up later. Given that we have 4000+ instances of GPR_ASSERT to edit, Doing it manually is too much work for both the author and reviewer.
<!--
If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.
If your pull request is for a specific language, please add the appropriate
lang label.
-->
Closes #36223
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36223 from tanvi-jagtap:assert_grpclb 205ba1d023979dd7c3bd990a8da1161d4d2f38de
PiperOrigin-RevId: 622378411
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | build_autogenerated.yaml | 1 | ||||
-rw-r--r-- | test/cpp/grpclb/BUILD | 1 | ||||
-rw-r--r-- | test/cpp/grpclb/grpclb_api_test.cc | 5 |
4 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 569dc00b3c..3dbab63b09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16134,6 +16134,7 @@ target_include_directories(grpclb_api_test target_link_libraries(grpclb_api_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc++_test_util ) diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 0c8d3fc408..261214bcd6 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -10850,6 +10850,7 @@ targets: - test/cpp/grpclb/grpclb_api_test.cc deps: - gtest + - absl/log:check - grpc++_test_util - name: grpclb_end2end_test gtest: true diff --git a/test/cpp/grpclb/BUILD b/test/cpp/grpclb/BUILD index cc557badea..cf8c4b79c6 100644 --- a/test/cpp/grpclb/BUILD +++ b/test/cpp/grpclb/BUILD @@ -25,6 +25,7 @@ grpc_cc_test( name = "grpclb_api_test", srcs = ["grpclb_api_test.cc"], external_deps = [ + "absl/log:check", "gtest", ], deps = [ diff --git a/test/cpp/grpclb/grpclb_api_test.cc b/test/cpp/grpclb/grpclb_api_test.cc index 44401c290f..9999d3957d 100644 --- a/test/cpp/grpclb/grpclb_api_test.cc +++ b/test/cpp/grpclb/grpclb_api_test.cc @@ -18,6 +18,7 @@ #include <gtest/gtest.h> +#include "absl/log/check.h" #include "google/protobuf/duration.upb.h" #include "upb/mem/arena.hpp" @@ -45,7 +46,7 @@ class GrpclbTest : public ::testing::Test { std::string Ip4ToPackedString(const char* ip_str) { struct in_addr ip4; - GPR_ASSERT(inet_pton(AF_INET, ip_str, &ip4) == 1); + CHECK(inet_pton(AF_INET, ip_str, &ip4) == 1); return std::string(reinterpret_cast<const char*>(&ip4), sizeof(ip4)); } @@ -59,7 +60,7 @@ std::string PackedStringToIp(const grpc_core::GrpcLbServer& server) { } else { abort(); } - GPR_ASSERT(inet_ntop(af, (void*)server.ip_addr, ip_str, 46) != nullptr); + CHECK(inet_ntop(af, (void*)server.ip_addr, ip_str, 46) != nullptr); return ip_str; } |