[fuzzing] Avoid initialization order fiasco in core_end2end_test_fuzzer (#33108)

pull/33109/head
Craig Tiller 2 years ago committed by GitHub
parent a9f3c4031d
commit 18d369a6f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      test/core/end2end/end2end_test_fuzzer.cc

@ -61,16 +61,7 @@ extern bool g_event_engine_supports_fd;
bool squelch = true; bool squelch = true;
static void dont_log(gpr_log_func_args* /*args*/) {} static void dont_log(gpr_log_func_args* /*args*/) {}
int force_experiments = []() {
grpc_event_engine::experimental::g_event_engine_supports_fd = false;
grpc_core::ForceEnableExperiment("event_engine_client", true);
grpc_core::ForceEnableExperiment("event_engine_listener", true);
return 1;
}();
DEFINE_PROTO_FUZZER(const core_end2end_test_fuzzer::Msg& msg) { DEFINE_PROTO_FUZZER(const core_end2end_test_fuzzer::Msg& msg) {
grpc_core::g_is_fuzzing_core_e2e_tests = true;
struct Test { struct Test {
std::string name; std::string name;
absl::AnyInvocable<std::unique_ptr<grpc_core::CoreEnd2endTest>() const> absl::AnyInvocable<std::unique_ptr<grpc_core::CoreEnd2endTest>() const>
@ -80,6 +71,11 @@ DEFINE_PROTO_FUZZER(const core_end2end_test_fuzzer::Msg& msg) {
static const auto all_tests = static const auto all_tests =
grpc_core::CoreEnd2endTestRegistry::Get().AllTests(); grpc_core::CoreEnd2endTestRegistry::Get().AllTests();
static const auto tests = []() { static const auto tests = []() {
grpc_core::g_is_fuzzing_core_e2e_tests = true;
grpc_event_engine::experimental::g_event_engine_supports_fd = false;
grpc_core::ForceEnableExperiment("event_engine_client", true);
grpc_core::ForceEnableExperiment("event_engine_listener", true);
auto only_suite = grpc_core::GetEnv("GRPC_TEST_FUZZER_SUITE"); auto only_suite = grpc_core::GetEnv("GRPC_TEST_FUZZER_SUITE");
auto only_test = grpc_core::GetEnv("GRPC_TEST_FUZZER_TEST"); auto only_test = grpc_core::GetEnv("GRPC_TEST_FUZZER_TEST");
auto only_config = grpc_core::GetEnv("GRPC_TEST_FUZZER_CONFIG"); auto only_config = grpc_core::GetEnv("GRPC_TEST_FUZZER_CONFIG");

Loading…
Cancel
Save