Skip to content

Commit

Permalink
Improve precision of host build.rustflags tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Gjengset committed Feb 24, 2022
1 parent b4ce8a8 commit 54674d3
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions tests/testsuite/rustflags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,26 +731,6 @@ fn build_rustflags_normal_source_with_target() {
.with_status(101)
.with_stderr_contains("[..]bogus[..]")
.run();

// With -Ztarget-applies-to-host build.rustflags should still not apply to build.rs, even when
// target == host, to match legacy Cargo behavior.
p.change_file("build.rs", "fn main() {}");
p.change_file(
".cargo/config",
r#"
target-applies-to-host = true
[build]
rustflags = ["-Z", "bogus"]
"#,
);
p.cargo("build --lib --target")
.arg(host)
.masquerade_as_nightly_cargo()
.arg("-Ztarget-applies-to-host")
.with_status(101)
.with_stderr_does_not_contain("[..]build_script_build[..]")
.run();
}

#[cargo_test]
Expand Down Expand Up @@ -1161,7 +1141,7 @@ fn build_rustflags_for_build_scripts() {
// With "legacy" behavior, build.rustflags should apply to build scripts without --target
p.cargo("build")
.with_status(101)
.with_stderr_does_not_contain("[..]build_script_build[..]")
.with_stderr_contains("[..]previous definition of the value `main` here[..]")
.run();

// But should _not_ apply _with_ --target
Expand All @@ -1172,7 +1152,7 @@ fn build_rustflags_for_build_scripts() {
.masquerade_as_nightly_cargo()
.arg("-Ztarget-applies-to-host")
.with_status(101)
.with_stderr_does_not_contain("[..]build_script_build[..]")
.with_stderr_contains("[..]previous definition of the value `main` here[..]")
.run();
p.cargo("build --target")
.arg(host)
Expand Down

0 comments on commit 54674d3

Please sign in to comment.