aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-28 18:06:23 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-28 18:06:23 -0800
commit03412ee9de902e378bc4cea933397ebe5faddc29 (patch)
tree8976a958d4c9855481425452e578ab4a4e315ad0 /test/core
parent81fc8c9c336fab7a71b448f748a32d680301277c (diff)
Remove TLS_NO_SUPPORT and always use GPR_TLS. Reorder statements in grpc_init and grpc_shutdown. Add grpc_init and grpc_shutdown in failing test/cpp tests
Diffstat (limited to 'test/core')
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.cc2
-rw-r--r--test/core/http/httpscli_test.cc6
-rw-r--r--test/core/slice/percent_decode_fuzzer.cc3
-rw-r--r--test/core/slice/percent_encode_fuzzer.cc3
-rw-r--r--test/core/util/one_corpus_entry_fuzzer.cc2
5 files changed, 10 insertions, 6 deletions
diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc
index f3127e92cc..ce916bd341 100644
--- a/test/core/end2end/fuzzers/api_fuzzer.cc
+++ b/test/core/end2end/fuzzers/api_fuzzer.cc
@@ -745,8 +745,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
input_stream inp = {data, data + size};
grpc_tcp_client_connect_impl = my_tcp_client_connect;
gpr_now_impl = now_impl;
- grpc_timer_manager_set_threading(false);
grpc_init();
+ grpc_timer_manager_set_threading(false);
{
grpc_core::ExecCtx _local_exec_ctx;
grpc_executor_set_threading(false);
diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc
index ee2bff18db..418afb6992 100644
--- a/test/core/http/httpscli_test.cc
+++ b/test/core/http/httpscli_test.cc
@@ -89,7 +89,7 @@ static void test_get(int port) {
"pollset_work", grpc_pollset_work(grpc_polling_entity_pollset(&g_pops),
&worker, n_seconds_time(1))));
gpr_mu_unlock(g_mu);
-
+ grpc_core::ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -129,7 +129,7 @@ static void test_post(int port) {
"pollset_work", grpc_pollset_work(grpc_polling_entity_pollset(&g_pops),
&worker, n_seconds_time(1))));
gpr_mu_unlock(g_mu);
-
+ grpc_core::ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -144,7 +144,6 @@ static void destroy_pops(void* p, grpc_error* error) {
int main(int argc, char** argv) {
grpc_closure destroyed;
- grpc_core::ExecCtx _local_exec_ctx;
gpr_subprocess* server;
char* me = argv[0];
char* lslash = strrchr(me, '/');
@@ -196,6 +195,7 @@ int main(int argc, char** argv) {
test_post(port);
{
+ grpc_core::ExecCtx _local_exec_ctx;
grpc_httpcli_context_destroy(&g_context);
GRPC_CLOSURE_INIT(&destroyed, destroy_pops, &g_pops,
grpc_schedule_on_exec_ctx);
diff --git a/test/core/slice/percent_decode_fuzzer.cc b/test/core/slice/percent_decode_fuzzer.cc
index 3603177c47..81eb031014 100644
--- a/test/core/slice/percent_decode_fuzzer.cc
+++ b/test/core/slice/percent_decode_fuzzer.cc
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <string.h>
+#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -31,6 +32,7 @@ bool leak_check = true;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
struct grpc_memory_counters counters;
+ grpc_init();
grpc_memory_counters_init();
grpc_slice input = grpc_slice_from_copied_buffer((const char*)data, size);
grpc_slice output;
@@ -46,6 +48,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_slice_unref(input);
counters = grpc_memory_counters_snapshot();
grpc_memory_counters_destroy();
+ grpc_shutdown();
GPR_ASSERT(counters.total_size_relative == 0);
return 0;
}
diff --git a/test/core/slice/percent_encode_fuzzer.cc b/test/core/slice/percent_encode_fuzzer.cc
index c8e3849fc8..201ae2790e 100644
--- a/test/core/slice/percent_encode_fuzzer.cc
+++ b/test/core/slice/percent_encode_fuzzer.cc
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <string.h>
+#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -31,6 +32,7 @@ bool leak_check = true;
static void test(const uint8_t* data, size_t size, const uint8_t* dict) {
struct grpc_memory_counters counters;
+ grpc_init();
grpc_memory_counters_init();
grpc_slice input = grpc_slice_from_copied_buffer((const char*)data, size);
grpc_slice output = grpc_percent_encode_slice(input, dict);
@@ -48,6 +50,7 @@ static void test(const uint8_t* data, size_t size, const uint8_t* dict) {
grpc_slice_unref(permissive_decoded_output);
counters = grpc_memory_counters_snapshot();
grpc_memory_counters_destroy();
+ grpc_shutdown();
GPR_ASSERT(counters.total_size_relative == 0);
}
diff --git a/test/core/util/one_corpus_entry_fuzzer.cc b/test/core/util/one_corpus_entry_fuzzer.cc
index fc75125a9b..c745eb5dc6 100644
--- a/test/core/util/one_corpus_entry_fuzzer.cc
+++ b/test/core/util/one_corpus_entry_fuzzer.cc
@@ -36,12 +36,10 @@ int main(int argc, char** argv) {
/* TODO(yashkt) Calling grpc_init breaks tests. Fix the tests and replace
* grpc_core::ExecCtx::GlobalInit with grpc_init and GlobalShutdown with
* grpc_shutdown */
- grpc_core::ExecCtx::GlobalInit();
GPR_ASSERT(
GRPC_LOG_IF_ERROR("load_file", grpc_load_file(argv[1], 0, &buffer)));
LLVMFuzzerTestOneInput(GRPC_SLICE_START_PTR(buffer),
GRPC_SLICE_LENGTH(buffer));
- grpc_core::ExecCtx::GlobalShutdown();
grpc_core::ExecCtx::GlobalInit();
grpc_slice_unref(buffer);
grpc_core::ExecCtx::GlobalShutdown();