diff --git a/test/core/http/request_fuzzer.cc b/test/core/http/request_fuzzer.cc index 368ac1b49db..9798cfb33c7 100644 --- a/test/core/http/request_fuzzer.cc +++ b/test/core/http/request_fuzzer.cc @@ -20,6 +20,7 @@ #include #include +#include #include #include "src/core/lib/http/parser.h" @@ -30,6 +31,7 @@ bool leak_check = true; extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_http_parser parser; grpc_http_request request; + grpc_init(); memset(&request, 0, sizeof(request)); grpc_http_parser_init(&parser, GRPC_HTTP_REQUEST, &request); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); @@ -38,5 +40,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_slice_unref(slice); grpc_http_parser_destroy(&parser); grpc_http_request_destroy(&request); + grpc_shutdown(); return 0; } diff --git a/test/core/http/response_fuzzer.cc b/test/core/http/response_fuzzer.cc index 2a793fddd4b..fc0904b1db7 100644 --- a/test/core/http/response_fuzzer.cc +++ b/test/core/http/response_fuzzer.cc @@ -19,6 +19,7 @@ #include #include +#include #include #include "src/core/lib/http/parser.h" @@ -29,6 +30,7 @@ bool leak_check = true; extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_http_parser parser; grpc_http_response response; + grpc_init(); memset(&response, 0, sizeof(response)); grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); @@ -37,5 +39,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_slice_unref(slice); grpc_http_parser_destroy(&parser); grpc_http_response_destroy(&response); + grpc_shutdown(); return 0; } diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc index 0ea57e22023..45a5e5a0b13 100644 --- a/test/core/iomgr/resolve_address_posix_test.cc +++ b/test/core/iomgr/resolve_address_posix_test.cc @@ -79,9 +79,9 @@ static grpc_millis n_sec_deadline(int seconds) { static void actually_poll(void* argsp) { args_struct* args = static_cast(argsp); - grpc_core::ExecCtx _local_exec_ctx; grpc_millis deadline = n_sec_deadline(10); while (true) { + grpc_core::ExecCtx _local_exec_ctx; bool done = gpr_atm_acq_load(&args->done_atm) != 0; if (done) { break; diff --git a/test/core/nanopb/fuzzer_response.cc b/test/core/nanopb/fuzzer_response.cc index 7039c801cb9..3a70dea5e98 100644 --- a/test/core/nanopb/fuzzer_response.cc +++ b/test/core/nanopb/fuzzer_response.cc @@ -19,6 +19,7 @@ #include #include +#include #include #include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h" @@ -29,6 +30,7 @@ bool leak_check = true; static void dont_log(gpr_log_func_args* args) {} extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + grpc_init(); if (squelch) gpr_set_log_function(dont_log); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); grpc_grpclb_initial_response* response; @@ -36,5 +38,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_grpclb_initial_response_destroy(response); } grpc_slice_unref(slice); + grpc_shutdown(); return 0; } diff --git a/test/core/nanopb/fuzzer_serverlist.cc b/test/core/nanopb/fuzzer_serverlist.cc index 0a6b1767a1a..d0af117ef96 100644 --- a/test/core/nanopb/fuzzer_serverlist.cc +++ b/test/core/nanopb/fuzzer_serverlist.cc @@ -19,6 +19,7 @@ #include #include +#include #include #include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h" @@ -29,6 +30,7 @@ bool leak_check = true; static void dont_log(gpr_log_func_args* args) {} extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + grpc_init(); if (squelch) gpr_set_log_function(dont_log); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); grpc_grpclb_serverlist* serverlist; @@ -36,5 +38,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_grpclb_destroy_serverlist(serverlist); } grpc_slice_unref(slice); + grpc_shutdown(); return 0; } diff --git a/test/core/surface/completion_queue_threading_test.cc b/test/core/surface/completion_queue_threading_test.cc index d923387e23e..8867ba88c3a 100644 --- a/test/core/surface/completion_queue_threading_test.cc +++ b/test/core/surface/completion_queue_threading_test.cc @@ -142,7 +142,6 @@ static void free_completion(void* arg, grpc_cq_completion* completion) { static void producer_thread(void* arg) { test_thread_options* opt = static_cast(arg); int i; - grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_INFO, "producer %d started", opt->id); gpr_event_set(&opt->on_started, (void*)(intptr_t)1); @@ -159,6 +158,7 @@ static void producer_thread(void* arg) { gpr_log(GPR_INFO, "producer %d phase 2", opt->id); for (i = 0; i < TEST_THREAD_EVENTS; i++) { + grpc_core::ExecCtx _local_exec_ctx; grpc_cq_end_op(opt->cc, (void*)(intptr_t)1, GRPC_ERROR_NONE, free_completion, nullptr, static_cast(