Skip to content

Commit 040f0d1

Browse files
author
Jon Gjengset
committed
Simplify unused build scripts in tests
The tests in question all tail to even build the build script, so the contents of `main` don't matter, and make the tests seem more complex than they really are.
1 parent 90a61d1 commit 040f0d1

File tree

1 file changed

+8
-61
lines changed

1 file changed

+8
-61
lines changed

tests/testsuite/build_script.rs

Lines changed: 8 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,7 @@ fn custom_build_env_var_rustc_linker_bad_host_target() {
355355
target
356356
),
357357
)
358-
.file(
359-
"build.rs",
360-
r#"
361-
use std::env;
362-
363-
fn main() {
364-
assert!(env::var("RUSTC_LINKER").unwrap().ends_with("/path/to/linker"));
365-
}
366-
"#,
367-
)
358+
.file("build.rs", "fn main() {}")
368359
.file("src/lib.rs", "")
369360
.build();
370361

@@ -467,16 +458,7 @@ fn custom_build_invalid_host_config_feature_flag() {
467458
target
468459
),
469460
)
470-
.file(
471-
"build.rs",
472-
r#"
473-
use std::env;
474-
475-
fn main() {
476-
assert!(env::var("RUSTC_LINKER").unwrap().ends_with("/path/to/linker"));
477-
}
478-
"#,
479-
)
461+
.file("build.rs", "fn main() {}")
480462
.file("src/lib.rs", "")
481463
.build();
482464

@@ -510,16 +492,7 @@ fn custom_build_env_var_rustc_linker_host_target_with_bad_host_config() {
510492
target
511493
),
512494
)
513-
.file(
514-
"build.rs",
515-
r#"
516-
use std::env;
517-
518-
fn main() {
519-
assert!(env::var("RUSTC_LINKER").unwrap().ends_with("/path/to/target/linker"));
520-
}
521-
"#,
522-
)
495+
.file("build.rs", "fn main() {}")
523496
.file("src/lib.rs", "")
524497
.build();
525498

@@ -554,16 +527,7 @@ fn custom_build_env_var_rustc_linker_bad_host() {
554527
target
555528
),
556529
)
557-
.file(
558-
"build.rs",
559-
r#"
560-
use std::env;
561-
562-
fn main() {
563-
assert!(env::var("RUSTC_LINKER").unwrap().ends_with("/path/to/target/linker"));
564-
}
565-
"#,
566-
)
530+
.file("build.rs", "fn main() {}")
567531
.file("src/lib.rs", "")
568532
.build();
569533

@@ -600,16 +564,7 @@ fn custom_build_env_var_rustc_linker_bad_host_with_arch() {
600564
target, target
601565
),
602566
)
603-
.file(
604-
"build.rs",
605-
r#"
606-
use std::env;
607-
608-
fn main() {
609-
assert!(env::var("RUSTC_LINKER").unwrap().ends_with("/path/to/target/linker"));
610-
}
611-
"#,
612-
)
567+
.file("build.rs", "fn main() {}")
613568
.file("src/lib.rs", "")
614569
.build();
615570

@@ -658,7 +613,8 @@ fn custom_build_env_var_rustc_linker_cross_arch_host() {
658613
.file("src/lib.rs", "")
659614
.build();
660615

661-
// build.rs should fail due to bad host linker being set
616+
// build.rs should be built fine since cross target != host target.
617+
// assertion should succeed since it's still passed the target linker
662618
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
663619
.arg(&target)
664620
.masquerade_as_nightly_cargo()
@@ -684,16 +640,7 @@ fn custom_build_env_var_rustc_linker_bad_cross_arch_host() {
684640
cross_target, target
685641
),
686642
)
687-
.file(
688-
"build.rs",
689-
r#"
690-
use std::env;
691-
692-
fn main() {
693-
assert!(env::var("RUSTC_LINKER").unwrap().ends_with("/path/to/target/linker"));
694-
}
695-
"#,
696-
)
643+
.file("build.rs", "fn main() {}")
697644
.file("src/lib.rs", "")
698645
.build();
699646

0 commit comments

Comments
 (0)