[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT (#36406)

[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT
Replacing GPR_ASSERT with absl CHECK

These changes have been made using string replacement and regex.

Will not be replacing all instances of CHECK with CHECK_EQ , CHECK_NE etc because there are too many callsites. Only ones which are doable using very simple regex with least chance of failure will be replaced.

Given that we have 5000+ 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 #36406

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36406 from tanvi-jagtap:tjagtap_cpp_end2end b3412dc218
PiperOrigin-RevId: 627602203
pull/36399/head^2
Tanvi Jagtap 9 months ago committed by Copybara-Service
parent d61144ec51
commit 4f8b8aef83
  1. 2
      test/cpp/end2end/channelz_service_test.cc
  2. 4
      test/cpp/end2end/client_lb_end2end_test.cc
  3. 4
      test/cpp/end2end/grpclb_end2end_test.cc
  4. 2
      test/cpp/end2end/service_config_end2end_test.cc
  5. 4
      test/cpp/end2end/time_change_test.cc
  6. 2
      test/cpp/end2end/xds/xds_cluster_type_end2end_test.cc
  7. 2
      test/cpp/end2end/xds/xds_end2end_test_lib.h
  8. 2
      test/cpp/end2end/xds/xds_ring_hash_end2end_test.cc

@ -95,7 +95,7 @@ class Proxy : public grpc::testing::EchoTestService::Service {
std::unique_ptr<ClientContext> client_context =
ClientContext::FromServerContext(*server_context);
size_t idx = request->param().backend_channel_idx();
CHECK(idx < stubs_.size());
CHECK_LT(idx, stubs_.size());
return stubs_[idx]->Echo(client_context.get(), *request, response);
}

@ -239,7 +239,7 @@ class FakeResolverResponseGeneratorWrapper {
for (const int& port : ports) {
absl::StatusOr<grpc_core::URI> lb_uri =
grpc_core::URI::Parse(grpc_core::LocalIpUri(port));
CHECK(lb_uri.ok());
CHECK_OK(lb_uri);
grpc_resolved_address address;
CHECK(grpc_parse_uri(*lb_uri, &address));
result.addresses->emplace_back(address, per_address_args);
@ -3018,7 +3018,7 @@ class WeightedRoundRobinTest : public ClientLbEnd2endTest {
const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
const std::vector<size_t>& expected_weights, size_t total_passes = 3,
EchoRequest* request_ptr = nullptr, int timeout_ms = 15000) {
CHECK(expected_weights.size() == servers_.size());
CHECK_EQ(expected_weights.size(), servers_.size());
size_t total_picks_per_pass = 0;
for (size_t picks : expected_weights) {
total_picks_per_pass += picks;

@ -709,7 +709,7 @@ class GrpclbEnd2endTest : public ::testing::Test {
for (int port : ports) {
absl::StatusOr<grpc_core::URI> lb_uri =
grpc_core::URI::Parse(grpc_core::LocalIpUri(port));
CHECK(lb_uri.ok());
CHECK_OK(lb_uri);
grpc_resolved_address address;
CHECK(grpc_parse_uri(*lb_uri, &address));
grpc_core::ChannelArgs args;
@ -730,7 +730,7 @@ class GrpclbEnd2endTest : public ::testing::Test {
result.addresses = std::move(backends);
result.service_config = grpc_core::ServiceConfigImpl::Create(
grpc_core::ChannelArgs(), service_config_json);
CHECK(result.service_config.ok());
CHECK_OK(result.service_config);
result.args = grpc_core::SetGrpcLbBalancerAddresses(
grpc_core::ChannelArgs(), std::move(balancers));
response_generator_->SetResponseSynchronously(std::move(result));

@ -175,7 +175,7 @@ class ServiceConfigEnd2endTest : public ::testing::Test {
for (const int& port : ports) {
absl::StatusOr<grpc_core::URI> lb_uri =
grpc_core::URI::Parse(grpc_core::LocalIpUri(port));
CHECK(lb_uri.ok());
CHECK_OK(lb_uri);
grpc_resolved_address address;
CHECK(grpc_parse_uri(*lb_uri, &address));
result.addresses->emplace_back(address, grpc_core::ChannelArgs());

@ -58,7 +58,7 @@ static gpr_timespec now_impl(gpr_clock_type clock) {
return ts;
}
CHECK_GE(ts.tv_nsec, 0);
CHECK(ts.tv_nsec < GPR_NS_PER_SEC);
CHECK_LT(ts.tv_nsec, GPR_NS_PER_SEC);
gpr_mu_lock(&g_mu);
ts.tv_sec += g_time_shift_sec;
ts.tv_nsec += g_time_shift_nsec;
@ -126,7 +126,7 @@ TEST(TimespecTest, GrpcNegativeMillisToTimespec) {
.as_timespec(GPR_CLOCK_MONOTONIC);
CHECK(ts.tv_sec = -2);
CHECK(ts.tv_nsec = 5e8);
CHECK(ts.clock_type == GPR_CLOCK_MONOTONIC);
CHECK_EQ(ts.clock_type, GPR_CLOCK_MONOTONIC);
}
class TimeChangeTest : public ::testing::Test {

@ -64,7 +64,7 @@ class ClusterTypeTest : public XdsEnd2endTest {
for (int port : ports) {
absl::StatusOr<grpc_core::URI> lb_uri =
grpc_core::URI::Parse(grpc_core::LocalIpUri(port));
CHECK(lb_uri.ok());
CHECK_OK(lb_uri);
grpc_resolved_address address;
CHECK(grpc_parse_uri(*lb_uri, &address));
addresses.emplace_back(address, grpc_core::ChannelArgs());

@ -243,7 +243,7 @@ class XdsEnd2endTest : public ::testing::TestWithParam<XdsTestType>,
virtual ~ServerThread() {
// Shutdown should be called manually. Shutdown calls virtual methods and
// can't be called from the base class destructor.
GPR_ASSERT(!running_);
CHECK(!running_);
}
void Start();

@ -70,7 +70,7 @@ class RingHashTest : public XdsEnd2endTest {
for (int port : ports) {
absl::StatusOr<grpc_core::URI> lb_uri =
grpc_core::URI::Parse(grpc_core::LocalIpUri(port));
CHECK(lb_uri.ok());
CHECK_OK(lb_uri);
grpc_resolved_address address;
CHECK(grpc_parse_uri(*lb_uri, &address));
addresses.emplace_back(address, grpc_core::ChannelArgs());

Loading…
Cancel
Save