Skip to content

Doc tests are not built with specified features #1277

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

Closed
apasel422 opened this issue Feb 5, 2015 · 6 comments
Closed

Doc tests are not built with specified features #1277

apasel422 opened this issue Feb 5, 2015 · 6 comments
Labels
Command-test E-easy Experience: Easy

Comments

@apasel422
Copy link
Contributor

With https://github.com/apasel422/foo and cargo 0.0.1-pre-nightly (2b9a3d6 2015-01-30 02:47:30 +0000)

> cargo --test --features bar
   Compiling foo v0.0.1 (file:///home/andrew/foo)
     Running target/foo-d486511c73453e56

running 0 tests

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

   Doc-tests foo

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
@apasel422
Copy link
Contributor Author

The verbose output makes it clear that the rustdoc command is not being invoked with the correct features:

cargo test --features bar --verbose
   Compiling foo v0.0.1 (file:///home/andrew/foo)
     Running `rustc src/lib.rs --crate-name foo --crate-type lib -g --cfg feature="bar" -C metadata=7cf71ac9a7d9fc8e -C extra-filename=-7cf71ac9a7d9fc8e --out-dir /home/andrew/foo/target --emit=dep-info,link -L dependency=/home/andrew/foo/target -L dependency=/home/andrew/foo/target/deps`
     Running `rustc src/lib.rs --crate-name foo --crate-type lib -g --test --cfg feature="bar" -C metadata=d486511c73453e56 -C extra-filename=-d486511c73453e56 --out-dir /home/andrew/foo/target --emit=dep-info,link -L dependency=/home/andrew/foo/target -L dependency=/home/andrew/foo/target/deps`
     Running `/home/andrew/foo/target/foo-d486511c73453e56`

running 0 tests

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

   Doc-tests foo
     Running `rustdoc --test /home/andrew/foo/src/lib.rs --crate-name foo -L /home/andrew/foo/target -L /home/andrew/foo/target/deps --extern foo=/home/andrew/foo/target/libfoo-7cf71ac9a7d9fc8e.rlib`

running 0 tests

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

@apasel422
Copy link
Contributor Author

@apasel422
Copy link
Contributor Author

I'm trying to fix this myself, but I don't see how to get access to the list of features without a Context.

@alexcrichton
Copy link
Member

You'll probably have to add a field to the Compilation and just fill it in as part of one of the steps in the cargo_rustc module (the Context can't live past that module).

@apasel422
Copy link
Contributor Author

This depends on rust-lang/rust#22131.

bors added a commit that referenced this issue Feb 14, 2015
This is a WIP for #1277. I would like to add a test for the new behavior in `tests/test_cargo_test.rs`, but I'm having a hard time getting the output to match.

Some feedback would be great to see if this is even the right approach.
@alexcrichton
Copy link
Member

I belive this was fixed back in #1284

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-test E-easy Experience: Easy
Projects
None yet
Development

No branches or pull requests

2 participants