From 2507d53bb6deff86979f6f5dbcaed94cf498258d Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 29 Nov 2021 10:04:15 -0800 Subject: [PATCH] Fix some tests with output collisions. --- tests/testsuite/clean.rs | 2 +- tests/testsuite/doc.rs | 20 ++++++++++++++++++-- tests/testsuite/lto.rs | 10 ++++++---- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/tests/testsuite/clean.rs b/tests/testsuite/clean.rs index 6e4e4db5920..1f9313451cf 100644 --- a/tests/testsuite/clean.rs +++ b/tests/testsuite/clean.rs @@ -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", "") diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index 6bcdd2d02cf..4e5e6e68db4 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -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 . +[DOCUMENTING] bar v0.1.0 +[CHECKING] bar v0.1.0 +[DOCUMENTING] bar v0.1.0 [..] +[FINISHED] [..] +", + ) .run(); } diff --git a/tests/testsuite/lto.rs b/tests/testsuite/lto.rs index a7d92934d04..82494d4e7ce 100644 --- a/tests/testsuite/lto.rs +++ b/tests/testsuite/lto.rs @@ -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]