Skip to content

Commit

Permalink
bytes: bazelize iobuf_fuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
IoannisRP committed Dec 19, 2024
1 parent 63dec6a commit 2992a1a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 16 additions & 1 deletion src/v/bytes/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//bazel:test.bzl", "redpanda_cc_btest", "redpanda_cc_gtest")
load("//bazel:test.bzl", "redpanda_cc_btest", "redpanda_cc_fuzz_test", "redpanda_cc_gtest")

redpanda_cc_btest(
name = "iobuf_test",
Expand Down Expand Up @@ -76,3 +76,18 @@ redpanda_cc_btest(
"@seastar//:testing",
],
)

redpanda_cc_fuzz_test(
name = "iobuf_fuzz",
timeout = "short",
srcs = ["iobuf_fuzz.cc"],
args = [
"-max_total_time=30",
"-rss_limit_mb=8192",
],
deps = [
"//src/v/base",
"//src/v/bytes:iobuf",
"//src/v/bytes:scattered_message",
],
)
4 changes: 2 additions & 2 deletions src/v/bytes/tests/iobuf_fuzz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* -format=html ../src/v/bytes/iobuf.h ../src/v/bytes/iobuf.cc > cov.html
*/
#include "base/vassert.h"
#include "bytes/bytes.h"
#include "bytes/iobuf.h"
#include "bytes/scattered_message.h"

#include <exception>
#include <numeric>

/*
Expand Down Expand Up @@ -508,7 +508,7 @@ class driver {

template<typename T>
T read() {
if (std::distance(pc_, program_.cend()) < sizeof(T)) {
if (std::cmp_less(std::distance(pc_, program_.cend()), sizeof(T))) {
throw end_of_program();
}
T ret;
Expand Down

0 comments on commit 2992a1a

Please sign in to comment.