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

Bug: Cargo test where bin and lib have identical name #111

Closed
thehydroimpulse opened this issue Jul 2, 2014 · 3 comments · Fixed by #242
Closed

Bug: Cargo test where bin and lib have identical name #111

thehydroimpulse opened this issue Jul 2, 2014 · 3 comments · Fixed by #242

Comments

@thehydroimpulse
Copy link

When you have both [[bin]] and [[lib]] directives, the tests are only ran for binaries and not for the library.

@alexcrichton
Copy link
Member

Can you provide a way to reproduce this? For example, this works:

[project]

name = "test"
version = "0.1.0"
authors = []

[[lib]]

name = "foo"

[[bin]]

name = "bar"
$ cargo test                             
   Compiling test v0.1.0 (file:/home/alex/code/foo)

running 1 test
test bar ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured


running 1 test
test foo ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured

@thehydroimpulse
Copy link
Author

@alexcrichton Aha. It's when you have a binary with the same name as the library.

@alexcrichton
Copy link
Member

This appears to be because both the library and the executable output their tests to target/$name, where one just overrides the other.

@thehydroimpulse thehydroimpulse changed the title Cargo test w/ [[bin]] not running correctly Cargo test where bin and lib have identical name Jul 5, 2014
@thehydroimpulse thehydroimpulse changed the title Cargo test where bin and lib have identical name Bug: Cargo test where bin and lib have identical name Jul 5, 2014
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Jul 22, 2014
This was fixed when rustc properly added extra-filename to all temp outputs as
opposed to just libraries.

Closes rust-lang#111
bors added a commit that referenced this issue Jul 22, 2014
This was fixed when rustc properly added extra-filename to all temp outputs as
opposed to just libraries.

Closes #111
@bors bors closed this as completed in #242 Jul 22, 2014
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Sep 2, 2014
This was fixed when rustc properly added extra-filename to all temp outputs as
opposed to just libraries.

Closes rust-lang#111
bors added a commit to alexcrichton/cargo that referenced this issue Sep 2, 2014
This was fixed when rustc properly added extra-filename to all temp outputs as
opposed to just libraries.

Closes rust-lang#111
ehuss pushed a commit to ehuss/cargo that referenced this issue Nov 19, 2023
…rgo-fix-tests

Overwrite RUST_LOG env var in cargo-fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants