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

cargo test -p foo ignores [dev-dependendencies] #2620

Closed
SimonSapin opened this issue Apr 26, 2016 · 2 comments
Closed

cargo test -p foo ignores [dev-dependendencies] #2620

SimonSapin opened this issue Apr 26, 2016 · 2 comments

Comments

@SimonSapin
Copy link
Contributor

Test case:

cargo new a
cargo new a/b
echo 'b = {path = "./b"}'>>a/Cargo.toml
echo '[dev-dependencies]'>>a/b/Cargo.toml
echo 'matches = "*"'>>a/b/Cargo.toml
echo '#[cfg(test)] extern crate matches;'>>a/b/src/lib.rs
(cd a && cargo test -v -p b)
rm -r a

Output with cargo 0.11.0-nightly (6151a85 2016-04-25):

   Compiling b v0.1.0 (file:///tmp/aaa/a/b)
     Running `rustc b/src/lib.rs --crate-name b --crate-type lib -g --test -C metadata=75e04c9cbb004a98 -C extra-filename=-75e04c9cbb004a98 --out-dir /tmp/aaa/a/target/debug/deps --emit=dep-info,link -L dependency=/tmp/aaa/a/target/debug/deps -L dependency=/tmp/aaa/a/target/debug/deps`
     Running `rustc b/src/lib.rs --crate-name b --crate-type lib -g -C metadata=6811c2c4848be05c -C extra-filename=-6811c2c4848be05c --out-dir /tmp/aaa/a/target/debug/deps --emit=dep-info,link -L dependency=/tmp/aaa/a/target/debug/deps -L dependency=/tmp/aaa/a/target/debug/deps`
b/src/lib.rs:7:14: 7:35 error: can't find crate for `matches` [E0463]
b/src/lib.rs:7 #[cfg(test)] extern crate matches;
                            ^~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
error: Could not compile `b`.

Caused by:
  Process didn't exit successfully: `rustc b/src/lib.rs --crate-name b --crate-type lib -g --test -C metadata=75e04c9cbb004a98 -C extra-filename=-75e04c9cbb004a98 --out-dir /tmp/aaa/a/target/debug/deps --emit=dep-info,link -L dependency=/tmp/aaa/a/target/debug/deps -L dependency=/tmp/aaa/a/target/debug/deps` (exit code: 101)

(Using (cd a/b && cargo test -v) instead works as expected, but uses a different target directory.)

@alexcrichton
Copy link
Member

I believe that this is a dupe of #860, but thanks for the report!

@alexcrichton
Copy link
Member

(also note that this should be fixed with workspaces)

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