Skip to content

Commit 5a71496

Browse files
committed
Fix tests
1 parent 1b36ddc commit 5a71496

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/testsuite/build_script_env.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,12 @@ fn rustc_bootstrap() {
128128
)
129129
.with_status(101)
130130
.run();
131-
// RUSTC_BOOTSTRAP unset on nightly should warn
131+
// nightly should warn whether or not RUSTC_BOOTSTRAP is set
132132
p.cargo("build")
133133
.masquerade_as_nightly_cargo()
134+
// NOTE: uses RUSTC_BOOTSTRAP so it will be propagated to rustc
135+
// (this matters when tests are being run with a beta or stable cargo)
136+
.env("RUSTC_BOOTSTRAP", "1")
134137
.with_stderr_contains("warning: Cannot set `RUSTC_BOOTSTRAP=1` [..]")
135138
.run();
136139
// RUSTC_BOOTSTRAP set to the name of the library should warn
@@ -151,21 +154,22 @@ fn rustc_bootstrap() {
151154
// Tests for binaries instead of libraries
152155
let p = project()
153156
.file("Cargo.toml", &basic_manifest("foo", "0.0.1"))
154-
.file("src/main.rs", "#![feature(rustc_attrs)] fn main()")
157+
.file("src/main.rs", "#![feature(rustc_attrs)] fn main() {}")
155158
.file("build.rs", build_rs)
156159
.build();
157-
// RUSTC_BOOTSTRAP unconditionally set when there's no library should warn
160+
// nightly should warn when there's no library whether or not RUSTC_BOOTSTRAP is set
158161
p.cargo("build")
159162
.masquerade_as_nightly_cargo()
163+
// NOTE: uses RUSTC_BOOTSTRAP so it will be propagated to rustc
164+
// (this matters when tests are being run with a beta or stable cargo)
165+
.env("RUSTC_BOOTSTRAP", "1")
160166
.with_stderr_contains("warning: Cannot set `RUSTC_BOOTSTRAP=1` [..]")
161167
.run();
162168
// RUSTC_BOOTSTRAP conditionally set when there's no library should error (regardless of the value)
163169
p.cargo("build")
164170
.env("RUSTC_BOOTSTRAP", "foo")
165171
.with_stderr_contains("error: Cannot set `RUSTC_BOOTSTRAP=1` [..]")
166-
.with_stderr_does_not_contain(
167-
"help: [..] set the environment variable `RUSTC_BOOTSTRAP=1` [..]",
168-
)
172+
.with_stderr_contains("help: [..] set the environment variable `RUSTC_BOOTSTRAP=1` [..]")
169173
.with_status(101)
170174
.run();
171175
}

0 commit comments

Comments
 (0)