Skip to content

cargo test --all-targets does not work exactly as advertised #5178

Closed
@infinity0

Description

@infinity0

Dummy crate, from test::test_then_build:

$ cat src/lib.rs 
#[test]
fn foo() {}
$ cat Cargo.toml 
[package]
name = "foo"
version = "0.0.1"
authors = []

Running cargo test --all-targets seems to test even less than cargo test.

$ cargo test
   Compiling foo v0.0.1 (file://$PWD)
    Finished dev [unoptimized + debuginfo] target(s) in 0.36 secs
     Running target/debug/deps/foo-32de61ba59a5bc99
running 1 test
[..]
   Doc-tests foo
running 0 tests
$ cargo test --all-targets
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running target/debug/deps/foo-32de61ba59a5bc99
running 1 test
[..]
     Running target/debug/deps/foo-32de61ba59a5bc99
running 1 test
[..]
     Running target/debug/deps/foo-32de61ba59a5bc99

Affects at least cargo 0.24.0 all the way up to current HEAD.

Uncovered by proposed additions to #5146.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions