[fuzzing] Add ability for api-fuzzer to create inproc channels (#35277)

Closes #35277

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35277 from ctiller:inproc-fuzzing 853c11f144
PiperOrigin-RevId: 590420030
pull/35300/head
Craig Tiller 1 year ago committed by Copybara-Service
parent 12c0058bf2
commit 03403724f5
  1. 20
      test/core/end2end/fuzzers/api_fuzzer.cc
  2. 1
      test/core/end2end/fuzzers/api_fuzzer.proto

@ -40,6 +40,7 @@
#include <grpc/support/string_util.h>
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/ext/transport/inproc/inproc_transport.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/event_engine/default_event_engine.h"
@ -54,7 +55,6 @@
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/resolved_address.h"
#include "src/core/lib/resolver/endpoint_addresses.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/libfuzzer/libfuzzer_macro.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/end2end/fuzzers/api_fuzzer.pb.h"
@ -416,13 +416,17 @@ ApiFuzzer::Result ApiFuzzer::CreateChannel(
fuzzing_env.resource_quota = resource_quota();
ChannelArgs args = testing::CreateChannelArgsFromFuzzingConfiguration(
create_channel.channel_args(), fuzzing_env);
grpc_channel_credentials* creds =
create_channel.has_channel_creds()
? ReadChannelCreds(create_channel.channel_creds())
: grpc_insecure_credentials_create();
channel_ = grpc_channel_create(create_channel.target().c_str(), creds,
args.ToC().get());
grpc_channel_credentials_release(creds);
if (create_channel.inproc()) {
channel_ = grpc_inproc_channel_create(server_, args.ToC().get(), nullptr);
} else {
grpc_channel_credentials* creds =
create_channel.has_channel_creds()
? ReadChannelCreds(create_channel.channel_creds())
: grpc_insecure_credentials_create();
channel_ = grpc_channel_create(create_channel.target().c_str(), creds,
args.ToC().get());
grpc_channel_credentials_release(creds);
}
GPR_ASSERT(channel_ != nullptr);
channel_force_delete_ = false;
return Result::kComplete;

@ -94,6 +94,7 @@ message CreateChannel {
string target = 1;
grpc.testing.FuzzingChannelArgs channel_args = 2;
ChannelCreds channel_creds = 3;
bool inproc = 4;
}
message Http2ServerPort {

Loading…
Cancel
Save