[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 205ba1d023
PiperOrigin-RevId: 622378411
pull/36216/head
Tanvi Jagtap 8 months ago committed by Copybara-Service
parent 536899d998
commit ddb785674c
  1. 1
      CMakeLists.txt
  2. 1
      build_autogenerated.yaml
  3. 1
      test/cpp/grpclb/BUILD
  4. 5
      test/cpp/grpclb/grpclb_api_test.cc

1
CMakeLists.txt generated

@ -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
)

@ -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

@ -25,6 +25,7 @@ grpc_cc_test(
name = "grpclb_api_test",
srcs = ["grpclb_api_test.cc"],
external_deps = [
"absl/log:check",
"gtest",
],
deps = [

@ -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;
}

Loading…
Cancel
Save