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

Fix some tests with output collisions. #10137

Merged
merged 1 commit into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/testsuite/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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", "")
Expand Down
20 changes: 18 additions & 2 deletions tests/testsuite/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
10 changes: 6 additions & 4 deletions tests/testsuite/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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[..]`",
)
Expand Down Expand Up @@ -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();
Expand All @@ -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]
Expand Down