Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiller committed Jan 27, 2025
1 parent 4971b50 commit 668f7e6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 21 deletions.
8 changes: 8 additions & 0 deletions test/core/end2end/end2end_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "test/core/end2end/end2end_tests.h"

#include <google/protobuf/text_format.h>
#include <grpc/byte_buffer_reader.h>
#include <grpc/compression.h>
#include <grpc/grpc.h>
Expand All @@ -37,6 +38,7 @@
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/timer_manager.h"
#include "src/core/util/no_destruct.h"
#include "src/google/protobuf/_virtual_includes/protobuf/google/protobuf/text_format.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.h"
#include "test/core/test_util/fuzz_config_vars.h"
Expand Down Expand Up @@ -218,4 +220,10 @@ void CoreEnd2endTest::ForceInitialized() {
}
}

core_end2end_test_fuzzer::Msg ParseTestProto(std::string text) {
core_end2end_test_fuzzer::Msg msg;
CHECK(google::protobuf::TextFormat::ParseFromString(text, &msg));
return msg;
}

} // namespace grpc_core
38 changes: 20 additions & 18 deletions test/core/end2end/end2end_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,8 @@ DECLARE_SUITE(ProxyAuthTests);
#undef DECLARE_SUITE
// NOLINTEND(bugprone-macro-parentheses)

core_end2end_test_fuzzer::Msg ParseTestProto(std::string text);

} // namespace grpc_core

// If this test fixture is being run under minstack, skip the test.
Expand All @@ -677,15 +679,9 @@ DECLARE_SUITE(ProxyAuthTests);
#ifdef GRPC_END2END_TEST_NO_FUZZER
#define CORE_END2END_FUZZER(suite, name)
#else
#define CORE_END2END_FUZZER(suite, name) \
void suite##_##name(const grpc_core::CoreTestConfiguration* config, \
core_end2end_test_fuzzer::Msg msg) { \
if (absl::StartsWith(#name, "DISABLED_")) GTEST_SKIP() << "disabled test"; \
CoreEnd2endTest_##suite##_##name(config, &msg).RunTest(); \
grpc_event_engine::experimental::ShutdownDefaultEventEngine(); \
} \
FUZZ_TEST(Fuzzers, suite##_##name) \
.WithDomains(::fuzztest::ElementOf(suite::AllSuiteConfigs(true)), \
#define CORE_END2END_FUZZER(suite, name) \
FUZZ_TEST(Fuzzers, suite##_##name) \
.WithDomains(::fuzztest::ElementOf(suite::AllSuiteConfigs(true)), \
::fuzztest::Arbitrary<core_end2end_test_fuzzer::Msg>());
#endif

Expand Down Expand Up @@ -714,15 +710,21 @@ DECLARE_SUITE(ProxyAuthTests);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(suite);
#endif

#define CORE_END2END_TEST(suite, name) \
class CoreEnd2endTest_##suite##_##name final \
: public grpc_core::CoreEnd2endTest { \
public: \
using grpc_core::CoreEnd2endTest::CoreEnd2endTest; \
void RunTest(); \
}; \
CORE_END2END_TEST_P(suite, name) \
CORE_END2END_FUZZER(suite, name) \
#define CORE_END2END_TEST(suite, name) \
class CoreEnd2endTest_##suite##_##name final \
: public grpc_core::CoreEnd2endTest { \
public: \
using grpc_core::CoreEnd2endTest::CoreEnd2endTest; \
void RunTest(); \
}; \
void suite##_##name(const grpc_core::CoreTestConfiguration* config, \
core_end2end_test_fuzzer::Msg msg) { \
if (absl::StartsWith(#name, "DISABLED_")) GTEST_SKIP() << "disabled test"; \
CoreEnd2endTest_##suite##_##name(config, &msg).RunTest(); \
grpc_event_engine::experimental::ShutdownDefaultEventEngine(); \
} \
CORE_END2END_TEST_P(suite, name) \
CORE_END2END_FUZZER(suite, name) \
void CoreEnd2endTest_##suite##_##name::RunTest()

#define CORE_END2END_TEST_SUITE(suite, configs) \
Expand Down
18 changes: 15 additions & 3 deletions test/core/end2end/tests/no_logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ class VerifyLogNoiseLogSink : public absl::LogSink {
{"chaotic_good_server.cc",
std::regex("Failed to bind some addresses for.*")},
{"log.cc",
std::regex("Prefer WARNING or ERROR. However if you see this "
"message in a debug environment or test environment "
"it is safe to ignore this message.")},
std::regex(
"Prefer WARNING or ERROR. However if you see this "
"message in a debug environment or test environment "
"it is safe to ignore this message.|Unknown log verbosity:.*")},
{"chttp2_server.cc",
std::regex(
"Only [0-9]+ addresses added out of total [0-9]+ resolved")}});
Expand Down Expand Up @@ -179,4 +180,15 @@ CORE_END2END_TEST(NoLoggingTests, NoLoggingTest) {
}
}

TEST(Fuzzers, NoLoggingTests_NoLoggingTestRegression1) {
NoLoggingTests_NoLoggingTest(
CoreTestConfigurationNamed("Chttp2FullstackCompression"),
ParseTestProto(R"pb(config_vars {
verbosity: "\000"
dns_resolver: ""
trace: ""
experiments: 9223372036854775807
})pb"));
}

} // namespace grpc_core

0 comments on commit 668f7e6

Please sign in to comment.