Skip to content

Commit

Permalink
inject fuzzing EE actions into xds client fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
markdroth committed Sep 10, 2024
1 parent 06bbc20 commit 8c5e9be
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions test/core/xds/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ grpc_proto_fuzzer(
proto = "xds_client_fuzzer.proto",
proto_deps = [
"//src/proto/grpc/testing/xds/v3:discovery_proto",
"//test/core/event_engine/fuzzing_event_engine:fuzzing_event_engine_proto",
],
tags = ["no_windows"],
uses_event_engine = True,
Expand Down
8 changes: 5 additions & 3 deletions test/core/xds/xds_client_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ namespace grpc_core {

class Fuzzer {
public:
explicit Fuzzer(absl::string_view bootstrap_json) {
Fuzzer(absl::string_view bootstrap_json,
const fuzzing_event_engine::Actions& fuzzing_ee_actions) {
event_engine_ = std::make_shared<FuzzingEventEngine>(
FuzzingEventEngine::Options(), fuzzing_event_engine::Actions());
FuzzingEventEngine::Options(), fuzzing_ee_actions);
grpc_timer_manager_set_start_threaded(false);
grpc_init();
auto bootstrap = GrpcXdsBootstrap::Create(bootstrap_json);
Expand Down Expand Up @@ -354,7 +355,8 @@ class Fuzzer {
bool squelch = true;

DEFINE_PROTO_FUZZER(const xds_client_fuzzer::Msg& message) {
grpc_core::Fuzzer fuzzer(message.bootstrap());
grpc_core::Fuzzer fuzzer(message.bootstrap(),
message.fuzzing_event_engine_actions());
for (int i = 0; i < message.actions_size(); i++) {
fuzzer.Act(message.actions(i));
}
Expand Down
2 changes: 2 additions & 0 deletions test/core/xds/xds_client_fuzzer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ syntax = "proto3";
package xds_client_fuzzer;

import "src/proto/grpc/testing/xds/v3/discovery.proto";
import "test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto";

// We'd ideally like to use google.rpc.Status instead of creating our
// own proto for this, but that winds up causing all sorts of dependency
Expand Down Expand Up @@ -120,4 +121,5 @@ message Action {
message Msg {
string bootstrap = 1;
repeated Action actions = 2;
fuzzing_event_engine.Actions fuzzing_event_engine_actions = 3;
}

0 comments on commit 8c5e9be

Please sign in to comment.