aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-05-21 22:05:12 -0700
committerGravatar Yash Tibrewal <yashkt@google.com>2018-05-22 11:27:32 -0700
commit19f0b1da674cefe1f2c79133aa4e754d885c7a8a (patch)
tree61967557634746a866b02f740a12fbacd0ed0002 /test
parent463e4d56193bbaec3977ce38fb8f0103d006794e (diff)
Fix for issue #15458
Diffstat (limited to 'test')
-rw-r--r--test/core/end2end/fuzzers/server_fuzzer.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/test/core/end2end/fuzzers/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc
index 5eb83ede7a..2de4ee55ed 100644
--- a/test/core/end2end/fuzzers/server_fuzzer.cc
+++ b/test/core/end2end/fuzzers/server_fuzzer.cc
@@ -103,15 +103,24 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_metadata_array_destroy(&request_metadata1);
grpc_server_shutdown_and_notify(server, cq, tag(0xdead));
grpc_server_cancel_all_calls(server);
+ grpc_millis deadline = grpc_core::ExecCtx::Get()->Now() + 100;
for (int i = 0; i <= requested_calls; i++) {
- ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME),
- nullptr);
+ do {
+ ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME),
+ nullptr);
+ grpc_core::ExecCtx::Get()->InvalidateNow();
+ } while (ev.type != GRPC_OP_COMPLETE &&
+ grpc_core::ExecCtx::Get()->Now() < deadline);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
}
grpc_completion_queue_shutdown(cq);
for (int i = 0; i <= requested_calls; i++) {
- ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME),
- nullptr);
+ do {
+ ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME),
+ nullptr);
+ grpc_core::ExecCtx::Get()->InvalidateNow();
+ } while (ev.type != GRPC_QUEUE_SHUTDOWN &&
+ grpc_core::ExecCtx::Get()->Now() < deadline);
GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
}
grpc_server_destroy(server);