Skip to content
Snippets Groups Projects
Commit 8da85117 authored by Craig Tiller's avatar Craig Tiller
Browse files

Expand corpus, make one-shot runners not self-check leaks (to give ASAN a chance)

parent 698d3e91
No related branches found
No related tags found
No related merge requests found
Showing
with 22 additions and 11 deletions
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
* *
*/ */
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
...@@ -38,6 +39,9 @@ ...@@ -38,6 +39,9 @@
#include "src/core/ext/client_config/uri_parser.h" #include "src/core/ext/client_config/uri_parser.h"
bool squelch = true;
bool leak_check = true;
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
char *s = gpr_malloc(size + 1); char *s = gpr_malloc(size + 1);
memcpy(s, data, size); memcpy(s, data, size);
......
...@@ -50,7 +50,8 @@ ...@@ -50,7 +50,8 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// logging // logging
static const bool squelch = true; bool squelch = true;
bool leak_check = true;
static void dont_log(gpr_log_func_args *args) {} static void dont_log(gpr_log_func_args *args) {}
......
...@@ -41,7 +41,8 @@ ...@@ -41,7 +41,8 @@
#include "test/core/util/memory_counters.h" #include "test/core/util/memory_counters.h"
#include "test/core/util/mock_endpoint.h" #include "test/core/util/mock_endpoint.h"
static const bool squelch = true; bool squelch = true;
bool leak_check = true;
static void discard_write(gpr_slice slice) {} static void discard_write(gpr_slice slice) {}
...@@ -53,7 +54,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ...@@ -53,7 +54,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_test_only_set_metadata_hash_seed(0); grpc_test_only_set_metadata_hash_seed(0);
struct grpc_memory_counters counters; struct grpc_memory_counters counters;
if (squelch) gpr_set_log_function(dont_log); if (squelch) gpr_set_log_function(dont_log);
grpc_memory_counters_init(); if (leak_check) grpc_memory_counters_init();
grpc_init(); grpc_init();
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
...@@ -156,8 +157,10 @@ done: ...@@ -156,8 +157,10 @@ done:
grpc_byte_buffer_destroy(response_payload_recv); grpc_byte_buffer_destroy(response_payload_recv);
} }
grpc_shutdown(); grpc_shutdown();
if (leak_check) {
counters = grpc_memory_counters_snapshot(); counters = grpc_memory_counters_snapshot();
grpc_memory_counters_destroy(); grpc_memory_counters_destroy();
GPR_ASSERT(counters.total_size_relative == 0); GPR_ASSERT(counters.total_size_relative == 0);
}
return 0; return 0;
} }
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
#include "test/core/util/memory_counters.h" #include "test/core/util/memory_counters.h"
#include "test/core/util/mock_endpoint.h" #include "test/core/util/mock_endpoint.h"
static const bool squelch = true; bool squelch = true;
bool leak_check = true;
static void discard_write(gpr_slice slice) {} static void discard_write(gpr_slice slice) {}
...@@ -51,7 +52,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ...@@ -51,7 +52,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_test_only_set_metadata_hash_seed(0); grpc_test_only_set_metadata_hash_seed(0);
struct grpc_memory_counters counters; struct grpc_memory_counters counters;
if (squelch) gpr_set_log_function(dont_log); if (squelch) gpr_set_log_function(dont_log);
grpc_memory_counters_init(); if (leak_check) grpc_memory_counters_init();
grpc_init(); grpc_init();
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
...@@ -120,8 +121,10 @@ done: ...@@ -120,8 +121,10 @@ done:
grpc_server_destroy(server); grpc_server_destroy(server);
grpc_completion_queue_destroy(cq); grpc_completion_queue_destroy(cq);
grpc_shutdown(); grpc_shutdown();
if (leak_check) {
counters = grpc_memory_counters_snapshot(); counters = grpc_memory_counters_snapshot();
grpc_memory_counters_destroy(); grpc_memory_counters_destroy();
GPR_ASSERT(counters.total_size_relative == 0); GPR_ASSERT(counters.total_size_relative == 0);
}
return 0; return 0;
} }
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment