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

<!--

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 #36365

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36365 from tanvi-jagtap:tjagtap_bad_client d769b84024
PiperOrigin-RevId: 625557190
pull/36350/head
Tanvi Jagtap 10 months ago committed by Copybara-Service
parent 0eb35d2baf
commit fceacd7a2c
  1. 12
      CMakeLists.txt
  2. 12
      build_autogenerated.yaml
  3. 43
      test/core/bad_client/bad_client.cc
  4. 4
      test/core/bad_client/generate_tests.bzl
  5. 8
      test/core/bad_client/tests/bad_streaming_id.cc
  6. 8
      test/core/bad_client/tests/badreq.cc
  7. 8
      test/core/bad_client/tests/connection_prefix.cc
  8. 12
      test/core/bad_client/tests/duplicate_header.cc
  9. 6
      test/core/bad_client/tests/head_of_line_blocking.cc
  10. 9
      test/core/bad_client/tests/headers.cc
  11. 17
      test/core/bad_client/tests/initial_settings_frame.cc
  12. 8
      test/core/bad_client/tests/out_of_bounds.cc
  13. 12
      test/core/bad_client/tests/server_registered_method.cc
  14. 24
      test/core/bad_client/tests/simple_request.cc
  15. 8
      test/core/bad_client/tests/unknown_frame.cc
  16. 8
      test/core/bad_client/tests/window_overflow.cc

12
CMakeLists.txt generated

@ -7763,6 +7763,7 @@ target_include_directories(bad_streaming_id_bad_client_test
target_link_libraries(bad_streaming_id_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)
@ -7807,6 +7808,7 @@ target_include_directories(badreq_bad_client_test
target_link_libraries(badreq_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)
@ -11394,6 +11396,7 @@ target_include_directories(connection_prefix_bad_client_test
target_link_libraries(connection_prefix_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)
@ -12451,6 +12454,7 @@ target_include_directories(duplicate_header_bad_client_test
target_link_libraries(duplicate_header_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)
@ -16519,6 +16523,7 @@ target_include_directories(head_of_line_blocking_bad_client_test
target_link_libraries(head_of_line_blocking_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)
@ -16563,6 +16568,7 @@ target_include_directories(headers_bad_client_test
target_link_libraries(headers_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)
@ -17560,6 +17566,7 @@ target_include_directories(initial_settings_frame_bad_client_test
target_link_libraries(initial_settings_frame_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)
@ -20788,6 +20795,7 @@ target_include_directories(out_of_bounds_bad_client_test
target_link_libraries(out_of_bounds_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)
@ -27177,6 +27185,7 @@ target_include_directories(server_registered_method_bad_client_test
target_link_libraries(server_registered_method_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)
@ -27922,6 +27931,7 @@ target_include_directories(simple_request_bad_client_test
target_link_libraries(simple_request_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)
@ -31826,6 +31836,7 @@ target_include_directories(unknown_frame_bad_client_test
target_link_libraries(unknown_frame_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)
@ -32300,6 +32311,7 @@ target_include_directories(window_overflow_bad_client_test
target_link_libraries(window_overflow_bad_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::check
grpc_test_util
)

@ -5976,6 +5976,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: badreq_bad_client_test
gtest: true
@ -5990,6 +5991,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: basic_work_queue_test
gtest: true
@ -8273,6 +8275,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: connection_refused_test
gtest: true
@ -8726,6 +8729,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: empty_batch_test
gtest: true
@ -11002,6 +11006,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: headers_bad_client_test
gtest: true
@ -11016,6 +11021,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: health_service_end2end_test
gtest: true
@ -11520,6 +11526,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: inproc_test
gtest: true
@ -13366,6 +13373,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: outlier_detection_lb_config_parser_test
gtest: true
@ -17608,6 +17616,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: server_request_call_test
gtest: true
@ -18082,6 +18091,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: simple_request_test
gtest: true
@ -19859,6 +19869,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: uri_parser_test
gtest: true
@ -20024,6 +20035,7 @@ targets:
- test/core/end2end/cq_verifier.cc
deps:
- gtest
- absl/log:check
- grpc_test_util
- name: windows_endpoint_test
gtest: true

@ -21,6 +21,8 @@
#include <inttypes.h>
#include <limits.h>
#include "absl/log/check.h"
#include <grpc/impl/channel_arg_names.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
@ -76,7 +78,7 @@ static void server_setup_transport(void* ts, grpc_core::Transport* transport) {
thd_args* a = static_cast<thd_args*>(ts);
grpc_core::ExecCtx exec_ctx;
grpc_core::Server* core_server = grpc_core::Server::FromC(a->server);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
CHECK(GRPC_LOG_IF_ERROR(
"SetupTransport",
core_server->SetupTransport(transport, /*accepting_pollset=*/nullptr,
core_server->channel_args(),
@ -135,8 +137,7 @@ void grpc_run_client_side_validator(grpc_bad_client_arg* arg, uint32_t flags,
// Await completion, unless the request is large and write may not finish
// before the peer shuts down.
if (!(flags & GRPC_BAD_CLIENT_LARGE_REQUEST)) {
GPR_ASSERT(
gpr_event_wait(&done_write, grpc_timeout_seconds_to_deadline(5)));
CHECK(gpr_event_wait(&done_write, grpc_timeout_seconds_to_deadline(5)));
}
if (flags & GRPC_BAD_CLIENT_DISCONNECT) {
@ -161,13 +162,13 @@ void grpc_run_client_side_validator(grpc_bad_client_arg* arg, uint32_t flags,
/*urgent=*/true, /*min_progress_size=*/1);
grpc_core::ExecCtx::Get()->Flush();
do {
GPR_ASSERT(gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) > 0);
CHECK_GT(gpr_time_cmp(deadline, gpr_now(deadline.clock_type)), 0);
// Perform a cq next just to provide a thread that can read incoming
// bytes on the client fd
GPR_ASSERT(grpc_completion_queue_next(
client_cq, grpc_timeout_milliseconds_to_deadline(100),
nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
client_cq, grpc_timeout_milliseconds_to_deadline(100),
nullptr)
.type == GRPC_QUEUE_TIMEOUT);
} while (!gpr_event_get(&read_done_event));
if (arg->client_validator(&incoming, arg->client_validator_arg)) break;
gpr_log(GPR_INFO,
@ -187,10 +188,9 @@ void grpc_run_client_side_validator(grpc_bad_client_arg* arg, uint32_t flags,
// Make sure that the client is done writing
while (!gpr_event_get(&done_write)) {
GPR_ASSERT(
grpc_completion_queue_next(
client_cq, grpc_timeout_milliseconds_to_deadline(100), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
client_cq, grpc_timeout_milliseconds_to_deadline(100), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
grpc_slice_buffer_destroy(&outgoing);
@ -238,7 +238,7 @@ void grpc_run_bad_client_test(
grpc_endpoint_add_to_pollset(sfd.server, grpc_cq_pollset(a.cq));
// Check a ground truth
GPR_ASSERT(grpc_core::Server::FromC(a.server)->HasOpenConnections());
CHECK(grpc_core::Server::FromC(a.server)->HasOpenConnections());
gpr_event_init(&a.done_thd);
a.validator = server_validator;
@ -251,17 +251,16 @@ void grpc_run_bad_client_test(
&sfd, client_cq);
}
// Wait for server thread to finish
GPR_ASSERT(gpr_event_wait(&a.done_thd, grpc_timeout_seconds_to_deadline(5)));
CHECK(gpr_event_wait(&a.done_thd, grpc_timeout_seconds_to_deadline(5)));
// Shutdown.
shutdown_client(&sfd.client);
server_validator_thd.Join();
shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
grpc_server_shutdown_and_notify(a.server, shutdown_cq, nullptr);
GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, nullptr,
grpc_timeout_seconds_to_deadline(1),
nullptr)
.type == GRPC_OP_COMPLETE);
CHECK(grpc_completion_queue_pluck(
shutdown_cq, nullptr, grpc_timeout_seconds_to_deadline(1), nullptr)
.type == GRPC_OP_COMPLETE);
grpc_completion_queue_destroy(shutdown_cq);
grpc_server_destroy(a.server);
grpc_completion_queue_destroy(a.cq);
@ -301,7 +300,7 @@ bool rst_stream_client_validator(grpc_slice_buffer* incoming, void* /*arg*/) {
grpc_slice_buffer_init(&last_frame_buffer);
grpc_slice_buffer_trim_end(incoming, kExpectedFrameLength,
&last_frame_buffer);
GPR_ASSERT(last_frame_buffer.count == 1);
CHECK_EQ(last_frame_buffer.count, 1u);
grpc_slice last_frame = last_frame_buffer.slices[0];
const uint8_t* p = GRPC_SLICE_START_PTR(last_frame);
@ -340,12 +339,12 @@ void server_verifier_request_call(grpc_server* server,
error = grpc_server_request_call(server, &s, &call_details,
&request_metadata_recv, cq, cq,
grpc_core::CqVerifier::tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
CHECK_EQ(error, GRPC_CALL_OK);
cqv.Expect(grpc_core::CqVerifier::tag(101), true);
cqv.Verify();
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.host, "localhost"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo/bar"));
CHECK_EQ(grpc_slice_str_cmp(call_details.host, "localhost"), 0);
CHECK_EQ(grpc_slice_str_cmp(call_details.method, "/foo/bar"), 0);
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_details_destroy(&call_details);

@ -51,6 +51,9 @@ def grpc_bad_client_tests():
"//test/core/end2end:cq_verifier",
"//:grpc_http_filters",
],
external_deps = [
"absl/log:check",
],
)
for t, topt in BAD_CLIENT_TESTS.items():
grpc_cc_test(
@ -59,6 +62,7 @@ def grpc_bad_client_tests():
deps = [":bad_client_test"],
tags = ["bad_client_test"],
external_deps = [
"absl/log:check",
"gtest",
],
)

@ -20,6 +20,8 @@
#include <gtest/gtest.h>
#include "absl/log/check.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
@ -80,9 +82,9 @@ namespace {
void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {
while (grpc_core::Server::FromC(server)->HasOpenConnections()) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}

@ -16,6 +16,8 @@
//
//
#include "absl/log/check.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
@ -30,9 +32,9 @@
static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {
while (grpc_core::Server::FromC(server)->HasOpenConnections()) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}

@ -16,6 +16,8 @@
//
//
#include "absl/log/check.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
@ -26,9 +28,9 @@
static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {
while (grpc_core::Server::FromC(server)->HasOpenConnections()) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}

@ -18,6 +18,8 @@
#include <string.h>
#include "absl/log/check.h"
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/status.h>
@ -70,7 +72,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
error = grpc_server_request_call(server, &s, &call_details,
&request_metadata_recv, cq, cq,
grpc_core::CqVerifier::tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
CHECK_EQ(error, GRPC_CALL_OK);
bool got = false;
cqv.Expect(grpc_core::CqVerifier::tag(101),
grpc_core::CqVerifier::Maybe{&got});
@ -84,8 +86,8 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
return;
}
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.host, "localhost"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo/bar"));
CHECK_EQ(grpc_slice_str_cmp(call_details.host, "localhost"), 0);
CHECK_EQ(grpc_slice_str_cmp(call_details.method, "/foo/bar"), 0);
memset(ops, 0, sizeof(ops));
op = ops;
@ -101,7 +103,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
op++;
error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops),
grpc_core::CqVerifier::tag(102), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CHECK_EQ(error, GRPC_CALL_OK);
cqv.Expect(grpc_core::CqVerifier::tag(102),
grpc_core::CqVerifier::AnyStatus());
@ -124,7 +126,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
op++;
error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops),
grpc_core::CqVerifier::tag(103), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CHECK_EQ(error, GRPC_CALL_OK);
cqv.Expect(grpc_core::CqVerifier::tag(103), true);
cqv.Verify();

@ -21,6 +21,8 @@
#include <algorithm>
#include "absl/log/check.h"
#include <grpc/byte_buffer.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
@ -85,11 +87,11 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
error = grpc_server_request_registered_call(
server, registered_method, &s, &deadline, &request_metadata_recv,
&payload, cq, cq, grpc_core::CqVerifier::tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
CHECK_EQ(error, GRPC_CALL_OK);
cqv.Expect(grpc_core::CqVerifier::tag(101), true);
cqv.Verify();
GPR_ASSERT(payload != nullptr);
CHECK_NE(payload, nullptr);
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_unref(s);

@ -16,8 +16,9 @@
//
//
#include "absl/log/check.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include "src/core/lib/surface/server.h"
#include "test/core/bad_client/bad_client.h"
@ -30,9 +31,9 @@
static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {
while (grpc_core::Server::FromC(server)->HasOpenConnections()) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}

@ -16,11 +16,11 @@
//
//
#include "absl/log/check.h"
#include "absl/strings/str_cat.h"
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include "src/core/lib/experiments/experiments.h"
#include "src/core/lib/surface/server.h"
@ -87,9 +87,9 @@
static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {
while (grpc_core::Server::FromC(server)->HasOpenConnections()) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}
@ -109,13 +109,14 @@ static void single_request_verifier(grpc_server* server,
error = grpc_server_request_call(server, &s, &call_details,
&request_metadata_recv, cq, cq,
grpc_core::CqVerifier::tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
CHECK_EQ(error, GRPC_CALL_OK);
cqv.Expect(grpc_core::CqVerifier::tag(101), true);
cqv.Verify();
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.host, "localhost"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method,
absl::StrCat("/foo/bar", i).c_str()));
CHECK_EQ(grpc_slice_str_cmp(call_details.host, "localhost"), 0);
CHECK_EQ(grpc_slice_str_cmp(call_details.method,
absl::StrCat("/foo/bar", i).c_str()),
0);
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_details_destroy(&call_details);

@ -20,6 +20,8 @@
#include <gtest/gtest.h>
#include "absl/log/check.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
@ -35,9 +37,9 @@ namespace {
void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {
while (grpc_core::Server::FromC(server)->HasOpenConnections()) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}

@ -16,6 +16,8 @@
//
//
#include "absl/log/check.h"
#include <grpc/byte_buffer.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
@ -55,11 +57,11 @@ static void verifier_succeeds(grpc_server* server, grpc_completion_queue* cq,
error = grpc_server_request_registered_call(
server, registered_method, &s, &deadline, &request_metadata_recv,
&payload, cq, cq, grpc_core::CqVerifier::tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
CHECK_EQ(error, GRPC_CALL_OK);
cqv.Expect(grpc_core::CqVerifier::tag(101), true);
cqv.Verify();
GPR_ASSERT(payload != nullptr);
CHECK_NE(payload, nullptr);
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_unref(s);
@ -69,9 +71,9 @@ static void verifier_succeeds(grpc_server* server, grpc_completion_queue* cq,
static void verifier_fails(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {
while (grpc_core::Server::FromC(server)->HasOpenConnections()) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/log/check.h"
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
@ -116,12 +118,12 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
error = grpc_server_request_call(server, &s, &call_details,
&request_metadata_recv, cq, cq,
grpc_core::CqVerifier::tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
CHECK_EQ(error, GRPC_CALL_OK);
cqv.Expect(grpc_core::CqVerifier::tag(101), true);
cqv.Verify();
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.host, "localhost"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo/bar"));
CHECK_EQ(grpc_slice_str_cmp(call_details.host, "localhost"), 0);
CHECK_EQ(grpc_slice_str_cmp(call_details.method, "/foo/bar"), 0);
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_details_destroy(&call_details);
@ -144,12 +146,12 @@ static void VerifyRpcDoesNotGetCanceled(grpc_server* server,
error = grpc_server_request_call(server, &s, &call_details,
&request_metadata_recv, cq, cq,
grpc_core::CqVerifier::tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
CHECK_EQ(error, GRPC_CALL_OK);
cqv.Expect(grpc_core::CqVerifier::tag(101), true);
cqv.Verify();
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.host, "localhost"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo/bar"));
CHECK_EQ(grpc_slice_str_cmp(call_details.host, "localhost"), 0);
CHECK_EQ(grpc_slice_str_cmp(call_details.method, "/foo/bar"), 0);
grpc_op* op;
grpc_op ops[6];
@ -176,13 +178,13 @@ static void VerifyRpcDoesNotGetCanceled(grpc_server* server,
op++;
error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops),
grpc_core::CqVerifier::tag(103), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CHECK_EQ(error, GRPC_CALL_OK);
cqv.Expect(grpc_core::CqVerifier::tag(103), true);
cqv.Verify();
// If the call had an error, `was_cancelled` would be 1.
// GPR_ASSERT(was_cancelled == 1);
// CHECK_EQ(was_cancelled, 1);
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_details_destroy(&call_details);
@ -192,9 +194,9 @@ static void VerifyRpcDoesNotGetCanceled(grpc_server* server,
static void failure_verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {
while (grpc_core::Server::FromC(server)->HasOpenConnections()) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}

@ -20,6 +20,8 @@
#include <gtest/gtest.h>
#include "absl/log/check.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
@ -30,9 +32,9 @@
static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {
while (grpc_core::Server::FromC(server)->HasOpenConnections()) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}

@ -17,6 +17,8 @@
#include <algorithm>
#include "absl/log/check.h"
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -45,9 +47,9 @@
static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {
while (grpc_core::Server::FromC(server)->HasOpenConnections()) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
CHECK(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}

Loading…
Cancel
Save