Skip to content

Commit c63286f

Browse files
committed
test: use canonical bin path to surpress warnings
1 parent f188e4b commit c63286f

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

tests/testsuite/build.rs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,11 @@ fn build_with_symlink_to_path_dependency_with_build_script_in_git() {
8888
fn cargo_fail_with_no_stderr() {
8989
let p = project()
9090
.file("Cargo.toml", &basic_bin_manifest("foo"))
91-
.file("src/foo.rs", &String::from("refusal"))
91+
.file("src/main.rs", &String::from("refusal"))
9292
.build();
9393
p.cargo("build --message-format=json")
9494
.with_status(101)
9595
.with_stderr_data(str![[r#"
96-
[WARNING] path `src/foo.rs` was erroneously implicitly accepted for binary `foo`,
97-
please set bin.path in Cargo.toml
9896
[COMPILING] foo v0.5.0 ([ROOT]/foo)
9997
[ERROR] could not compile `foo` (bin "foo") due to 2 previous errors
10098
@@ -108,14 +106,12 @@ please set bin.path in Cargo.toml
108106
fn cargo_compile_incremental() {
109107
let p = project()
110108
.file("Cargo.toml", &basic_bin_manifest("foo"))
111-
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
109+
.file("src/main.rs", &main_file(r#""i am foo""#, &[]))
112110
.build();
113111

114112
p.cargo("build -v")
115113
.env("CARGO_INCREMENTAL", "1")
116114
.with_stderr_data(str![[r#"
117-
[WARNING] path `src/foo.rs` was erroneously implicitly accepted for binary `foo`,
118-
please set bin.path in Cargo.toml
119115
[COMPILING] foo v0.5.0 ([ROOT]/foo)
120116
[RUNNING] `rustc [..] -C incremental=[ROOT]/foo/target/debug/incremental[..]`
121117
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
@@ -126,8 +122,6 @@ please set bin.path in Cargo.toml
126122
p.cargo("test -v")
127123
.env("CARGO_INCREMENTAL", "1")
128124
.with_stderr_data(str![[r#"
129-
[WARNING] path `src/foo.rs` was erroneously implicitly accepted for binary `foo`,
130-
please set bin.path in Cargo.toml
131125
[COMPILING] foo v0.5.0 ([ROOT]/foo)
132126
[RUNNING] `rustc [..] -C incremental=[ROOT]/foo/target/debug/incremental[..]`
133127
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
@@ -825,14 +819,12 @@ fn cargo_compile_with_lowercase_cargo_toml() {
825819
fn cargo_compile_with_invalid_code() {
826820
let p = project()
827821
.file("Cargo.toml", &basic_bin_manifest("foo"))
828-
.file("src/foo.rs", "invalid rust code!")
822+
.file("src/main.rs", "invalid rust code!")
829823
.build();
830824

831825
p.cargo("build")
832826
.with_status(101)
833827
.with_stderr_data(str![[r#"
834-
[WARNING] path `src/foo.rs` was erroneously implicitly accepted for binary `foo`,
835-
please set bin.path in Cargo.toml
836828
[COMPILING] foo v0.5.0 ([ROOT]/foo)
837829
[ERROR] [..]
838830
...
@@ -894,13 +886,11 @@ fn cargo_compile_with_invalid_code_in_deps() {
894886
fn cargo_compile_with_warnings_in_the_root_package() {
895887
let p = project()
896888
.file("Cargo.toml", &basic_bin_manifest("foo"))
897-
.file("src/foo.rs", "fn main() {} fn dead() {}")
889+
.file("src/main.rs", "fn main() {} fn dead() {}")
898890
.build();
899891

900892
p.cargo("build")
901893
.with_stderr_data(str![[r#"
902-
[WARNING] path `src/foo.rs` was erroneously implicitly accepted for binary `foo`,
903-
please set bin.path in Cargo.toml
904894
[COMPILING] foo v0.5.0 ([ROOT]/foo)
905895
[WARNING] [..]dead[..]
906896
...
@@ -932,7 +922,7 @@ fn cargo_compile_with_warnings_in_a_dep_package() {
932922
name = "foo"
933923
"#,
934924
)
935-
.file("src/foo.rs", &main_file(r#""{}", bar::gimme()"#, &["bar"]))
925+
.file("src/main.rs", &main_file(r#""{}", bar::gimme()"#, &["bar"]))
936926
.file("bar/Cargo.toml", &basic_lib_manifest("bar"))
937927
.file(
938928
"bar/src/bar.rs",
@@ -948,8 +938,6 @@ fn cargo_compile_with_warnings_in_a_dep_package() {
948938

949939
p.cargo("build")
950940
.with_stderr_data(str![[r#"
951-
[WARNING] path `src/foo.rs` was erroneously implicitly accepted for binary `foo`,
952-
please set bin.path in Cargo.toml
953941
[LOCKING] 2 packages to latest compatible versions
954942
[COMPILING] bar v0.5.0 ([ROOT]/foo/bar)
955943
[WARNING] [..]dead[..]
@@ -2316,7 +2304,7 @@ fn ignore_broken_symlinks() {
23162304

23172305
let p = project()
23182306
.file("Cargo.toml", &basic_bin_manifest("foo"))
2319-
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
2307+
.file("src/main.rs", &main_file(r#""i am foo""#, &[]))
23202308
.symlink("Notafile", "bar")
23212309
// To hit the symlink directory, we need a build script
23222310
// to trigger a full scan of package files.
@@ -2326,8 +2314,6 @@ fn ignore_broken_symlinks() {
23262314

23272315
p.cargo("build")
23282316
.with_stderr_data(str![[r#"
2329-
[WARNING] path `src/foo.rs` was erroneously implicitly accepted for binary `foo`,
2330-
please set bin.path in Cargo.toml
23312317
[WARNING] File system loop found: [ROOT]/foo/a/b/c/d/foo points to an ancestor [ROOT]/foo/a/b
23322318
[COMPILING] foo v0.5.0 ([ROOT]/foo)
23332319
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s

0 commit comments

Comments
 (0)