rust-fuzz / cargo-fuzz

Command line helpers for fuzzing
https://rust-fuzz.github.io/book/cargo-fuzz.html
Apache License 2.0
1.48k stars 108 forks source link

`cargo fuzz list` does not show targets auto-discovered by cargo #363

Open mauricelam opened 4 months ago

mauricelam commented 4 months ago

I have a project with the following structure:

project $ tree -I target -I artifacts -I corpus
.
├── Cargo.lock
├── Cargo.toml
├── fuzz
│   ├── Cargo.lock
│   ├── Cargo.toml
│   └── src
│       └── bin
│           ├── fuzz_test_1.rs
│           └──fuzz_test_2.rs
└── src
    └── lib.rs

where the fuzz_test_* files are placed in src/bin instead of the default fuzz_targets directory. Cargo can discover those targets automatically, as described in https://doc.rust-lang.org/cargo/reference/cargo-targets.html#target-auto-discovery.

cargo fuzz run fuzz_test_1 also works correctly.

But when I run cargo fuzz list, the returned result is empty.

I have to manually add entries to fuzz/Cargo.toml to let cargo fuzz list discover it.

[[bin]]
name = "fuzz_test_1"
[[bin]]
name = "fuzz_test_2"