Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiller committed Jan 28, 2025
1 parent 90d33ff commit 892a475
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
23 changes: 15 additions & 8 deletions test/core/event_engine/work_queue/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//test/core/test_util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_proto_library","grpc_internal_proto_library","grpc_package")
load("//test/core/test_util:grpc_fuzzer.bzl", "grpc_fuzz_test")

licenses(["notice"])

Expand All @@ -35,19 +35,26 @@ grpc_cc_test(
],
)

grpc_internal_proto_library(
name = "work_queue_fuzzer_proto",
srcs = ["work_queue_fuzzer.proto"],
)

grpc_cc_proto_library(
name = "work_queue_fuzzer_cc_proto",
deps = ["work_queue_fuzzer_proto"]
)

# TODO(hork): the same fuzzer configuration should work trivially for all
# WorkQueue implementations. Generalize it when another implementation is
# written.
grpc_proto_fuzzer(
grpc_fuzz_test(
name = "basic_work_queue_fuzzer",
srcs = ["basic_work_queue_fuzzer.cc"],
corpus = "corpora",
proto = "work_queue_fuzzer.proto",
tags = ["no_windows"],
uses_event_engine = False,
uses_polling = False,
deps = [
"//src/core:event_engine_basic_work_queue",
"//test/core/test_util:grpc_test_util",
"work_queue_fuzzer_cc_proto",
],
external_deps = ["gtest", "fuzztest", "fuzztest_main"],
)
14 changes: 6 additions & 8 deletions test/core/event_engine/work_queue/basic_work_queue_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@
#include <utility>

#include "absl/functional/any_invocable.h"
#include "fuzztest/fuzztest.h"
#include "src/core/lib/event_engine/common_closures.h"
#include "src/core/lib/event_engine/work_queue/basic_work_queue.h"
#include "src/libfuzzer/libfuzzer_macro.h"
#include "test/core/event_engine/work_queue/work_queue_fuzzer.pb.h"

bool squelch = true;
bool leak_check = true;

namespace grpc_event_engine {
namespace experimental {

Expand Down Expand Up @@ -131,11 +128,12 @@ class WorkQueueFuzzer {
std::optional<int> last_executed_key_;
};

} // namespace experimental
} // namespace grpc_event_engine

DEFINE_PROTO_FUZZER(const work_queue_fuzzer::Msg& msg) {
void Fuzz(const work_queue_fuzzer::Msg& msg) {
for (const auto& action : msg.actions()) {
grpc_event_engine::experimental::WorkQueueFuzzer().Run(action);
}
}
FUZZ_TEST(WorkQueueFuzzer, Fuzz);

} // namespace experimental
} // namespace grpc_event_engine
Empty file.

0 comments on commit 892a475

Please sign in to comment.