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

Feature selection when testing specific packages has no effect #5909

Closed
SergioBenitez opened this issue Aug 18, 2018 · 1 comment
Closed

Comments

@SergioBenitez
Copy link
Contributor

I have a workspace with two crates: foo, and bar. The crate foo has 3 features, a, b, and c. I wrote a shell script that tests that each feature works when individually enabled. The script is run from the crate root. It is:

FEATURES=(a b c)
for feature in "${FEATURES[@]}"; do
  cargo test -v -p foo --no-default-features --features "${feature}"
done

Instead of compiling the crate with each feature individually enabled and running those tests, cargo seems to always compile the crate with the default set of features. Here's what the verbose output emits when feature c is being tested, where a and b are default features:

> cargo test -v -p foo --no-default-features --features c
rustc --crate-name foo lib.rs --emit=dep-info,link -C debuginfo=2 --test --cfg 'feature="default"' --cfg 'feature="a"' --cfg 'feature="b"''

Note that feature="c" isn't enabled at all, and the default features are enabled. Everything works fine if I run cargo test --no-default-features --features "${feature}" from the root of the foo crate.

@alexcrichton
Copy link
Member

I believe this is a duplicate of #5849, but thanks for the report!

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