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 prefers dylib over rlib in doc-tests #1496

Closed
crumblingstatue opened this issue Apr 8, 2015 · 0 comments · Fixed by #1501
Closed

cargo test prefers dylib over rlib in doc-tests #1496

crumblingstatue opened this issue Apr 8, 2015 · 0 comments · Fixed by #1501

Comments

@crumblingstatue
Copy link

If both dylib and rlib are specified as crate type, cargo test prefers the dylib over the rlib, making the doc tests fail due to (probably) linking failures.

Cargo.toml

[package]
name = "foo"
version = "0.0.1"

[lib]
name = "foo"
crate-type = ["dylib", "rlib"]

src/lib.rs

//! ```rust
//! extern crate foo;
//! ```

Output of cargo test --verbose:

   Compiling foo v0.0.1 (file:///home/snake/projects/temp/foo)
     Running `rustc src/lib.rs --crate-name foo --crate-type dylib --crate-type rlib -g -C metadata=03341f3fb3154edb -C extra-filename=-03341f3fb3154edb --out-dir /home/snake/projects/temp/foo/target/debug --emit=dep-info,link -L dependency=/home/snake/projects/temp/foo/target/debug -L dependency=/home/snake/projects/temp/foo/target/debug/deps`
     Running `rustc src/lib.rs --crate-name foo --crate-type dylib --crate-type rlib -g --test -C metadata=defca50fba1c8277 -C extra-filename=-defca50fba1c8277 --out-dir /home/snake/projects/temp/foo/target/debug --emit=dep-info,link -L dependency=/home/snake/projects/temp/foo/target/debug -L dependency=/home/snake/projects/temp/foo/target/debug/deps`
     Running `/home/snake/projects/temp/foo/target/debug/foo-defca50fba1c8277`

running 0 tests

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

   Doc-tests foo
     Running `rustdoc --test /home/snake/projects/temp/foo/src/lib.rs --crate-name foo -L dependency=/home/snake/projects/temp/foo/target/debug/deps --extern foo=/home/snake/projects/temp/foo/target/debug/libfoo-03341f3fb3154edb.so --extern foo=/home/snake/projects/temp/foo/target/debug/libfoo-03341f3fb3154edb.rlib`

running 1 test
test _0 ... FAILED

failures:

---- _0 stdout ----
    error: cannot satisfy dependencies so `std` only shows up once
note: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `core` only shows up once
note: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `collections` only shows up once
note: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `unicode` only shows up once
note: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `alloc` only shows up once
note: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `libc` only shows up once
note: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `rand` only shows up once
note: having upstream crates all available in one format will likely make this go away
error: aborting due to 7 previous errors
thread '_0' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:152



failures:
    _0

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Apr 9, 2015
This commit fixes two problems in Cargo:

1. Only libraries targets that produce an rlib can be doc tested
2. Only the rlib output can be doc tested

The rationale for this is listed in listed in the comments of the commit.

Closes rust-lang#1496
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Apr 9, 2015
This commit fixes two problems in Cargo:

1. Only libraries targets that produce an rlib can be doc tested
2. Only the rlib output can be doc tested

The rationale for this is listed in listed in the comments of the commit.

Closes rust-lang#1496
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Apr 10, 2015
This commit fixes two problems in Cargo:

1. Only libraries targets that produce an rlib can be doc tested
2. Only the rlib output can be doc tested

The rationale for this is listed in listed in the comments of the commit.

Closes rust-lang#1496
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Apr 10, 2015
This commit fixes two problems in Cargo:

1. Only libraries targets that produce an rlib can be doc tested
2. Only the rlib output can be doc tested

The rationale for this is listed in listed in the comments of the commit.

Closes rust-lang#1496
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Apr 10, 2015
This commit fixes two problems in Cargo:

1. Only libraries targets that produce an rlib can be doc tested
2. Only the rlib output can be doc tested

The rationale for this is listed in listed in the comments of the commit.

Closes rust-lang#1496
bors added a commit that referenced this issue Apr 10, 2015
This commit fixes two problems in Cargo:

1. Only libraries targets that produce an rlib can be doc tested
2. Only the rlib output can be doc tested

The rationale for this is listed in listed in the comments of the commit.

Closes #1496
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.

1 participant