Fix some tests with output collisions.

This commit is contained in:
Eric Huss 2021-11-29 10:04:15 -08:00 committed by Pietro Albini
parent 7f08ace4f1
commit f01b232bc7
No known key found for this signature in database
GPG Key ID: CD76B35F7734769E
3 changed files with 25 additions and 7 deletions

View File

@ -416,7 +416,7 @@ fn package_cleans_all_the_things() {
"#,
)
.file("src/lib.rs", "")
.file("src/main.rs", "fn main() {}")
.file("src/lib/some-main.rs", "fn main() {}")
.file("src/bin/other-main.rs", "fn main() {}")
.file("examples/foo-ex-rlib.rs", "")
.file("examples/foo-ex-cdylib.rs", "")

View File

@ -1242,8 +1242,24 @@ fn doc_all_member_dependency_same_name() {
Package::new("bar", "0.1.0").publish();
p.cargo("doc --workspace")
.with_stderr_contains("[..] Updating `[..]` index")
.with_stderr_contains("[..] Documenting bar v0.1.0 ([..])")
.with_stderr_unordered(
"\
[UPDATING] [..]
[DOWNLOADING] crates ...
[DOWNLOADED] bar v0.1.0 (registry `dummy-registry`)
warning: output filename collision.
The lib target `bar` in package `bar v0.1.0` has the same output filename as \
the lib target `bar` in package `bar v0.1.0 ([ROOT]/foo/bar)`.
Colliding filename is: [ROOT]/foo/target/doc/bar/index.html
The targets should have unique names.
This is a known bug where multiple crates with the same name use
the same path; see <https://github.com/rust-lang/cargo/issues/6313>.
[DOCUMENTING] bar v0.1.0
[CHECKING] bar v0.1.0
[DOCUMENTING] bar v0.1.0 [..]
[FINISHED] [..]
",
)
.run();
}

View File

@ -177,7 +177,7 @@ fn complicated() {
)
.file("build.rs", "fn main() { dep_build::foo() }")
.file(
"src/main.rs",
"src/bin/foo-bin.rs",
"#[dep_proc_macro::foo] fn main() { dep_normal::foo() }",
)
.file(
@ -206,7 +206,9 @@ fn complicated() {
.with_stderr_contains(
"[..]`rustc[..]--crate-name dep_proc_macro [..]-C embed-bitcode=no[..]`",
)
.with_stderr_contains("[..]`rustc[..]--crate-name test [..]--crate-type bin[..]-C lto[..]`")
.with_stderr_contains(
"[..]`rustc[..]--crate-name foo_bin [..]--crate-type bin[..]-C lto[..]`",
)
.with_stderr_contains(
"[..]`rustc[..]--crate-name test [..]--crate-type cdylib[..]-C lto[..]`",
)
@ -753,7 +755,7 @@ fn dylib_rlib_bin() {
"#,
)
.file("src/lib.rs", "pub fn foo() { println!(\"hi!\"); }")
.file("src/main.rs", "fn main() { foo::foo(); }")
.file("src/bin/ferret.rs", "fn main() { foo::foo(); }")
.build();
let output = p.cargo("build --release -v").exec_with_output().unwrap();
@ -763,7 +765,7 @@ fn dylib_rlib_bin() {
"--crate-type dylib --crate-type rlib",
Lto::ObjectAndBitcode,
);
verify_lto(&output, "foo", "--crate-type bin", Lto::Run(None));
verify_lto(&output, "ferret", "--crate-type bin", Lto::Run(None));
}
#[cargo_test]