-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo test --all-targets also runs binaries marked as test=false #8338
Comments
I just ran into essentially this problem with my own fuzz targets, but not with
|
This works around a Cargo bug or infelicity rust-lang/cargo#8338 where `[[bin]] test = false` is sometimes ignored.
--all-targets activates bins, even if they have test = false Refs rust-lang/cargo#8338
--all-targets activates bins, even if they have test = false Refs rust-lang/cargo#8338
Problem
Running
cargo test --all-targets
apparently runs binaries even when markedtest=false
. This is a problem in particular withcargo fuzz
targets, that do some linker dark magic and start trying to fuzz during the test session, failing as it wasn't built for it.Steps
First, provision the following files:
Cargo.toml
:src/lib.rs
:example-bin/main.rs
:Then, running
cargo test --all-targets
should result in a message like the following:Possible Solution(s)
Maybe it'd be possible to just not call binaries that are tagged
test=false
, even when ran with--all-targets
, seeing astest=false
should clearly stipulate that there are no tests to be found here?Notes
Output of
cargo version
:cargo 1.41.0
Anyway, thank you for all you do on cargo! It's a great piece of software, and I just wanted to report this small hiccup :)
The text was updated successfully, but these errors were encountered: