Skip to content

Commit

Permalink
serde: bazelize serde_test
Browse files Browse the repository at this point in the history
  • Loading branch information
IoannisRP committed Nov 21, 2024
1 parent 365da65 commit 5967185
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
42 changes: 42 additions & 0 deletions src/v/serde/test/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
load("//bazel:test.bzl", "redpanda_cc_btest")

redpanda_cc_btest(
name = "serde_test",
timeout = "short",
srcs = [
"serde_test.cc",
],
defines = [
"SERDE_TEST",
],
deps = [
"//src/v/bytes:random",
"//src/v/container:fragmented_vector",
"//src/v/hashing:crc32c",
"//src/v/model",
"//src/v/random:generators",
"//src/v/serde",
"//src/v/serde:array",
"//src/v/serde:bool_class",
"//src/v/serde:bytes",
"//src/v/serde:chrono",
"//src/v/serde:enum",
"//src/v/serde:inet_address",
"//src/v/serde:iobuf",
"//src/v/serde:map",
"//src/v/serde:set",
"//src/v/serde:sstring",
"//src/v/serde:variant",
"//src/v/test_utils:random",
"//src/v/test_utils:seastar_boost",
"//src/v/utils:tristate",
"@abseil-cpp//absl/container:btree",
"@abseil-cpp//absl/container:flat_hash_map",
"@abseil-cpp//absl/container:node_hash_map",
"@abseil-cpp//absl/container:node_hash_set",
"@boost//:container_hash",
"@boost//:test",
"@seastar",
"@seastar//:testing",
],
)
17 changes: 15 additions & 2 deletions src/v/serde/test/serde_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,21 @@
#include "model/fundamental.h"
#include "model/metadata.h"
#include "random/generators.h"
#include "serde/async.h"
#include "serde/peek.h"
#include "serde/rw/array.h"
#include "serde/rw/bool_class.h"
#include "serde/rw/bytes.h"
#include "serde/rw/chrono.h"
#include "serde/rw/enum.h"
#include "serde/rw/envelope.h"
#include "serde/rw/inet_address.h"
#include "serde/rw/iobuf.h"
#include "serde/rw/map.h"
#include "serde/rw/rw.h"
#include "serde/rw/set.h"
#include "serde/rw/sstring.h"
#include "serde/rw/variant.h"
#include "serde/serde.h"
#include "test_utils/randoms.h"
#include "utils/tristate.h"

Expand All @@ -36,6 +48,7 @@
#include <limits>
#include <optional>
#include <ratio>
#include <utility>

struct custom_read_write {
friend inline void read_nested(
Expand Down Expand Up @@ -468,7 +481,7 @@ ss::future<> test_snapshot_header::serde_async_read(
crc.extend(ss::cpu_to_le(version));
crc.extend(ss::cpu_to_le(metadata_size));

if (header_crc != crc.value()) {
if (std::cmp_not_equal(header_crc, crc.value())) {
throw std::runtime_error(fmt::format(
"Corrupt snapshot. Failed to verify header crc: {} != "
"{}: path?",
Expand Down

0 comments on commit 5967185

Please sign in to comment.