Skip to content

Commit

Permalink
build(fuzz): Add fuzz targets to workspace (#1117)
Browse files Browse the repository at this point in the history
`cargo-fuzz` recommends adding the `fuzz` crate to the workspace. It seems the problem of not compiling is fixed with recent dependencies.

source: https://github.com/rust-fuzz/cargo-fuzz?tab=readme-ov-file#usage
  • Loading branch information
caspermeijn authored Aug 16, 2024
1 parent d38072f commit b5c3525
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ members = [
"tests-2015",
"tests-no-std",
"tests/single-include",
]

exclude = [
# The fuzz crate can't be compiled or tested without the 'cargo fuzz' command,
# so exclude it from normal builds.
"fuzz",
]

Expand Down
15 changes: 8 additions & 7 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
name = "fuzz"
version = "0.0.0"
publish = false
edition = "2021"
authors = [
"Dan Burkert <dan@danburkert.com>",
"Lucio Franco <luciofranco14@gmail.com>",
"Casper Meijn <casper@meijn.net>",
"Tokio Contributors <team@tokio.rs>",
]
edition.workspace = true
authors.workspace = true

[package.metadata]
cargo-fuzz = true
Expand All @@ -21,7 +16,13 @@ protobuf = { path = "../protobuf" }
[[bin]]
name = "proto3"
path = "fuzzers/proto3.rs"
test = false
doc = false
bench = false

[[bin]]
name = "proto2"
path = "fuzzers/proto2.rs"
test = false
doc = false
bench = false
1 change: 0 additions & 1 deletion fuzz/fuzzers/proto2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ use tests::roundtrip;
fuzz_target!(|data: &[u8]| {
let _ = roundtrip::<TestAllTypesProto2>(data).unwrap_error();
});

0 comments on commit b5c3525

Please sign in to comment.