Skip to content
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 runs disabled unit tests when arguments are pased via -- #11191

Closed
RalfJung opened this issue Oct 7, 2022 · 1 comment · Fixed by #11190
Closed

cargo runs disabled unit tests when arguments are pased via -- #11191

RalfJung opened this issue Oct 7, 2022 · 1 comment · Fixed by #11190
Labels
C-bug Category: bug

Comments

@RalfJung
Copy link
Member

RalfJung commented Oct 7, 2022

Problem

In a crate with

[lib]
test = false

usually cargo does not build and run the unit tests for the lib crate. However when doing cargo test -- x, they do get built and run. This seems to be a recent regression.

Steps

  1. cargo new --lib mylib, cd mylib
  2. edit Cargo.toml to add
[lib]
test = false
  1. Run cargo test. It only runs doctests:
   Doc-tests myib

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
  1. Run cargo test -- x. Now it runs the disabled unittests:
     Running unittests src/lib.rs (target/debug/deps/myib-81de13cd7bf5f5d9)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.00s

It also does not run the doctests.
(This only happens with nightly. With stable, it runs the doctests.)

I would expect it to behave like stable, where it runs the doctests (and passes x to the test runner as a filter).

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.66.0-nightly (0b84a35c2 2022-10-03)
release: 1.66.0-nightly
commit-hash: 0b84a35c2c7d70df4875a03eb19084b0e7a543ef
commit-date: 2022-10-03
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.15.0 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:OpenSSL/1.1.1q)
os: Debian testing (bookworm) [64-bit]
@RalfJung RalfJung added the C-bug Category: bug label Oct 7, 2022
@RalfJung RalfJung changed the title cargo runs disable tests when arguments are pased via -- cargo runs disabled unit tests when arguments are pased via -- Oct 7, 2022
RalfJung added a commit to RalfJung/miri that referenced this issue Oct 7, 2022
I think cargo has a bug here: rust-lang/cargo#11191
but for now we bless its output so that we can keep CI green
@epage
Copy link
Contributor

epage commented Oct 7, 2022

I think this might be the same issue discussed at rust-lang/rust#87586 (comment) and 69ba69f#r86078435 which is being fixed in #11190

@bors bors closed this as completed in 3cdf1ab Oct 7, 2022
RalfJung added a commit to RalfJung/miri that referenced this issue Oct 8, 2022
I think cargo has a bug here: rust-lang/cargo#11191
but for now we bless its output so that we can keep CI green
RalfJung added a commit to RalfJung/miri that referenced this issue Oct 8, 2022
I think cargo has a bug here: rust-lang/cargo#11191
but for now we bless its output so that we can keep CI green
RalfJung added a commit to RalfJung/rust that referenced this issue Oct 22, 2022
I think cargo has a bug here: rust-lang/cargo#11191
but for now we bless its output so that we can keep CI green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants