aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/nanopb
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-29 11:55:32 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-29 11:55:32 -0800
commit26e934245d2af33f613f932f290315c5c9feca27 (patch)
tree5e559510196888f8aeaa53700228af48a14f5742 /test/core/nanopb
parent03412ee9de902e378bc4cea933397ebe5faddc29 (diff)
Fix race conditions and more grpc_inits required. csharp tests will be fixed in a different PR
Diffstat (limited to 'test/core/nanopb')
-rw-r--r--test/core/nanopb/fuzzer_response.cc3
-rw-r--r--test/core/nanopb/fuzzer_serverlist.cc3
2 files changed, 6 insertions, 0 deletions
diff --git a/test/core/nanopb/fuzzer_response.cc b/test/core/nanopb/fuzzer_response.cc
index 7039c801cb..3a70dea5e9 100644
--- a/test/core/nanopb/fuzzer_response.cc
+++ b/test/core/nanopb/fuzzer_response.cc
@@ -19,6 +19,7 @@
#include <stdint.h>
#include <string.h>
+#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#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 0a6b1767a1..d0af117ef9 100644
--- a/test/core/nanopb/fuzzer_serverlist.cc
+++ b/test/core/nanopb/fuzzer_serverlist.cc
@@ -19,6 +19,7 @@
#include <stdint.h>
#include <string.h>
+#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#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;
}