Description
Problem
Running cargo test --benches
is supposed to build all benchmarks in debug mode and run them. It does that. But if there are unit tests, then it runs them, too. It shouldn't do that. In a workspace the problem is more complicated, because it's possible that there are unit tests in subcrates that have no benchmarks. In that case, cargo test --benches --all
doesn't build those unit tests. But if they've already been built, then it will run them too.
Steps
- git clone https://github.com/carllerche/bytes.git
- cd bytes
- cargo +nightly test --benches --all
I would expect two executables to run, containing 36 and 20 tests with names like get_f32
and alloc_big
. Those are the benchmarks. But a third executable gets built and run, with two tests named bytes::test_original_capacity_from_repr
and bytes::test_original_capacity_to_repr
. Those are unit tests.
Here is another example, with a workspace repository.
Steps
- git clone https://github.com/tokio-rs/tokio.git
- cd tokio
- cargo +nightly test --all
- cargo +nightly test --benches --all
I expect that eighteen benchmarks would run and the unit tests would be ignored, just as if I had typed cargo +nightly bench --all
. But the unit tests don't get ignored, so a total of 26 tests and benchmarks get run.
Notes
Output of cargo version
:
On FreeBSD x86_64:
cargo 1.33.0-nightly (28fb200 2018-12-09)
And on Linux x86_64:
cargo 1.31.0-nightly (2d0863f 2018-10-20)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status