-
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
without cargo build
won't create target/debug/libfoo.rlib
while cargo build
does
#6131
Comments
cargo test
without cargo build
won't create target/debug/libfoo.so
while cargo build
doescargo test
without cargo build
won't create target/debug/libfoo.rlib
while cargo build
does
I wonder: why is this a problem? My thinking is, if |
Mhhh maybe? The reason I noticed this is because I am writing my own test runners which call rustc with an Of course, maybe I shouldn't use this file as it's implementation detail. That would be fine. So far I've been using the build-plan feature to get the correct path. But I still think it's strange that |
Perhaps you need something like [lib]
name = "foo"
path = "src/lib.rs"
test = true # <- |
Interesting! I don't think it's necessarily problematic that we don't do this but I don't see a great reason to not create these artifacts. Seems good to me to fix! |
I think this is behaving as expected. This is a result of #5460. Because the lib is not an explicit target in this case, it is not uplifted out of |
Heh I do flip flop a bit. If it can be made to work without uplifting then we shouldn't implement this, but if uplifting is required then I don't think it should be too much of a problem to do so. |
As far as I can tell, this is working as expected. |
Agree with closing. Thank you for the triage. |
I always expect that
cargo test
basically runs acargo build
before doing anything test specific. But that's apparently not the case.Minimal example:
Cargo.toml
src/lib.rs
tests/main.rs
Executing
cargo test
will compile thefoo
crate and execute tests. Fine. BUT:cargo clean && cargo test
won't create the filetarget/debug/libfoo.rlib
whilecargo clean && cargo build
does create that file. This is very unexpected.Tests on
rustc 1.31.0-nightly (5597ee8a6 2018-10-03)
The text was updated successfully, but these errors were encountered: