cargo-fuzz
cargo-fuzz copied to clipboard
Mistaking `dev-dependencies` for features?
I'm in a workspace, which understands where my fuzz crate is.
After running the
rustup override set nightly
cargo install -f cargo-fuzz
In the root of the work space I do:
$ cargo fuzz init
Error: ${SNIP}/rust_project/compressor/Cargo.toml (package.name) is malformed
$ cd fuzz
$ cargo fuzz init
Error: ${SNIP}/rust_project/compressor/Cargo.toml (package.name) is malformed
Hmm, okay. So I try another avenue
$ cargo fuzz list
fuzz_xxhash32_reference
fuzz_xxhash32_stream
$ cargo fuzz run fuzz_xxhash32_reference
error: failed to select a version for `xxhash`.
. . . required by package `fuzz v0.1.0 (${SNIP}/rust_projects/compressor/fuzz)`
versions that meet the requirements `=0.1.0` are: 0.10
the package `fuzz` depends on `xxhash`, with features: `twox-hash, getrandom` but `xxhash` does not have these features.
The xxhash/Cargo.toml
which I'm depending on. The confusion is two fold:
- These aren't features. These are
dev-dependencies
which are feature gated. - Within the
fuzz/Cargo.toml
I am indeed setting features.
So why am I importing dev-dependencies
with default features? How do I fix this?
One other bug report:
If the crate which is preforming the fuzzing isn't named fuzz
then you just can't do anything. I wanted to have a separate xxhash-fuzz
. As lumping all local workspace crates into same fuzz-crate seemed wrong, namely separation of concerns.
Error: ${SNIP}/rust_project/compressor/Cargo.toml (package.name) is malformed
cargo fuzz init
should be run in the directory of your cargo project, not your cargo workspace
though maybe we can ease that constraint, since it's sorta arbitrary
cargo fuzz init
should be run in the directory of your cargo project, not your cargo workspace
I change directory within the example:
$ cargo fuzz init
Error: ${SNIP}/rust_project/compressor/Cargo.toml (package.name) is malformed
$ cd fuzz
$ cargo fuzz init
Error: ${SNIP}/rust_project/compressor/Cargo.toml (package.name) is malformed
The error is the same irregardless of if I run it within the crate
or workspace
directory. Provided the crate
is a member of a workspace
.
My workspace Cargo.toml
was well formed (as way my Cargo.toml
within the fuzz
crate), given the fact I could run $ cargo fuzz list
within my fuzz
crate, as well as other normal cargo workflow operations.
cargo fuzz init
should be run in the directory of your cargo project, not your cargo workspaceI change directory within the example:
$ cargo fuzz init Error: ${SNIP}/rust_project/compressor/Cargo.toml (package.name) is malformed $ cd fuzz $ cargo fuzz init Error: ${SNIP}/rust_project/compressor/Cargo.toml (package.name) is malformed
The error is the same irregardless of if I run it within the
crate
orworkspace
directory. Provided thecrate
is a member of aworkspace
.My workspace
Cargo.toml
was well formed (as way myCargo.toml
within thefuzz
crate), given the fact I could run$ cargo fuzz list
within myfuzz
crate, as well as other normal cargo workflow operations.
I'm getting the same issue with my Cargo.toml
looking like:
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
documentation.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true