[fuzzing] Allow memory quota fuzzer to supply config (#33243)

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
pull/33253/head
Craig Tiller 2 years ago committed by GitHub
parent eb57f2e910
commit efebae82f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      test/core/resource_quota/BUILD
  2. 4
      test/core/resource_quota/memory_quota_fuzzer.cc
  3. 3
      test/core/resource_quota/memory_quota_fuzzer.proto

@ -150,6 +150,7 @@ grpc_proto_fuzzer(
],
language = "C++",
proto = "memory_quota_fuzzer.proto",
proto_deps = ["//test/core/util:fuzz_config_vars_proto"],
tags = ["no_windows"],
uses_event_engine = False,
uses_polling = False,
@ -162,7 +163,9 @@ grpc_proto_fuzzer(
"//src/core:closure",
"//src/core:error",
"//src/core:event_engine_memory_allocator",
"//src/core:experiments",
"//src/core:memory_quota",
"//src/core:useful",
"//test/core/util:fuzz_config_vars",
],
)

@ -30,6 +30,7 @@
#include <grpc/support/log.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/experiments/config.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/iomgr/closure.h"
@ -39,6 +40,7 @@
#include "src/libfuzzer/libfuzzer_macro.h"
#include "test/core/resource_quota/call_checker.h"
#include "test/core/resource_quota/memory_quota_fuzzer.pb.h"
#include "test/core/util/fuzz_config_vars.h"
bool squelch = true;
bool leak_check = true;
@ -190,6 +192,8 @@ static void dont_log(gpr_log_func_args* /*args*/) {}
DEFINE_PROTO_FUZZER(const memory_quota_fuzzer::Msg& msg) {
if (squelch) gpr_set_log_function(dont_log);
grpc_core::ApplyFuzzConfigVars(msg.config_vars());
grpc_core::TestOnlyReloadExperimentsFromConfigVariables();
gpr_log_verbosity_init();
grpc_tracer_init();
grpc_core::testing::Fuzzer().Run(msg);

@ -16,6 +16,8 @@ syntax = "proto3";
package memory_quota_fuzzer;
import "test/core/util/fuzz_config_vars.proto";
message Empty {}
message Reclaimer {
@ -54,4 +56,5 @@ message Action {
message Msg {
repeated Action actions = 2;
grpc.testing.FuzzConfigVars config_vars = 3;
}

Loading…
Cancel
Save