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

Test harness is injected on --cfg test #33670

Closed
alexcrichton opened this issue May 16, 2016 · 2 comments
Closed

Test harness is injected on --cfg test #33670

alexcrichton opened this issue May 16, 2016 · 2 comments

Comments

@alexcrichton
Copy link
Member

Cargo has an issue (rust-lang/cargo#2305) with a proposed fix (rust-lang/cargo#2469), but it unfortunately can't land because the compiler currently considers --test and --cfg test synonymous.

I'm... surprised by this behavior, and I'd expect --cfg test to only pass the test cfg.

@alexcrichton
Copy link
Member Author

Ah, and the steps to reproduce:

$ touch bar.rs
$ rustc --cfg test bar.rs
$ ./bar

running 0 tests

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

@sanxiyn
Copy link
Member

sanxiyn commented May 17, 2016

I looked at the history. Originally, test harness was only injected for --test, not for --cfg test. Then b808eab (in 2012!) explicitly changed this, with comments (but without rationale...). Fix seems to be a matter of reverting that commit.

bors added a commit that referenced this issue May 28, 2016
Do not inject test harness for --cfg test

Fix #33670.
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

No branches or pull requests

2 participants