Skip to content

Commit

Permalink
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_AS…
Browse files Browse the repository at this point in the history
…SERT (grpc#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 grpc#36223

COPYBARA_INTEGRATE_REVIEW=grpc#36223 from tanvi-jagtap:assert_grpclb 205ba1d
PiperOrigin-RevId: 622378411
  • Loading branch information
tanvi-jagtap authored and copybara-github committed Apr 6, 2024
1 parent 536899d commit ddb7856
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build_autogenerated.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/cpp/grpclb/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ grpc_cc_test(
name = "grpclb_api_test",
srcs = ["grpclb_api_test.cc"],
external_deps = [
"absl/log:check",
"gtest",
],
deps = [
Expand Down
5 changes: 3 additions & 2 deletions test/cpp/grpclb/grpclb_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <gtest/gtest.h>

#include "absl/log/check.h"
#include "google/protobuf/duration.upb.h"
#include "upb/mem/arena.hpp"

Expand Down Expand Up @@ -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));
}

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

Expand Down

0 comments on commit ddb7856

Please sign in to comment.