chore: update build_script_env test to use check

This commit is contained in:
Scott Schafer 2023-02-15 15:49:38 -06:00
parent 7fcb542f7f
commit e9838a50ee

View File

@ -18,7 +18,7 @@ fn rerun_if_env_changes() {
)
.build();
p.cargo("build")
p.cargo("check")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -26,7 +26,7 @@ fn rerun_if_env_changes() {
",
)
.run();
p.cargo("build")
p.cargo("check")
.env("FOO", "bar")
.with_stderr(
"\
@ -35,7 +35,7 @@ fn rerun_if_env_changes() {
",
)
.run();
p.cargo("build")
p.cargo("check")
.env("FOO", "baz")
.with_stderr(
"\
@ -44,11 +44,11 @@ fn rerun_if_env_changes() {
",
)
.run();
p.cargo("build")
p.cargo("check")
.env("FOO", "baz")
.with_stderr("[FINISHED] [..]")
.run();
p.cargo("build")
p.cargo("check")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -74,7 +74,7 @@ fn rerun_if_env_or_file_changes() {
.file("foo", "")
.build();
p.cargo("build")
p.cargo("check")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -82,7 +82,7 @@ fn rerun_if_env_or_file_changes() {
",
)
.run();
p.cargo("build")
p.cargo("check")
.env("FOO", "bar")
.with_stderr(
"\
@ -91,13 +91,13 @@ fn rerun_if_env_or_file_changes() {
",
)
.run();
p.cargo("build")
p.cargo("check")
.env("FOO", "bar")
.with_stderr("[FINISHED] [..]")
.run();
sleep_ms(1000);
p.change_file("foo", "");
p.cargo("build")
p.cargo("check")
.env("FOO", "bar")
.with_stderr(
"\
@ -121,7 +121,7 @@ fn rustc_bootstrap() {
.file("build.rs", build_rs)
.build();
// RUSTC_BOOTSTRAP unset on stable should error
p.cargo("build")
p.cargo("check")
.with_stderr_contains("error: Cannot set `RUSTC_BOOTSTRAP=1` [..]")
.with_stderr_contains(
"help: [..] set the environment variable `RUSTC_BOOTSTRAP=has_dashes` [..]",
@ -129,7 +129,7 @@ fn rustc_bootstrap() {
.with_status(101)
.run();
// nightly should warn whether or not RUSTC_BOOTSTRAP is set
p.cargo("build")
p.cargo("check")
.masquerade_as_nightly_cargo(&["RUSTC_BOOTSTRAP"])
// NOTE: uses RUSTC_BOOTSTRAP so it will be propagated to rustc
// (this matters when tests are being run with a beta or stable cargo)
@ -137,12 +137,12 @@ fn rustc_bootstrap() {
.with_stderr_contains("warning: Cannot set `RUSTC_BOOTSTRAP=1` [..]")
.run();
// RUSTC_BOOTSTRAP set to the name of the library should warn
p.cargo("build")
p.cargo("check")
.env("RUSTC_BOOTSTRAP", "has_dashes")
.with_stderr_contains("warning: Cannot set `RUSTC_BOOTSTRAP=1` [..]")
.run();
// RUSTC_BOOTSTRAP set to some random value should error
p.cargo("build")
p.cargo("check")
.env("RUSTC_BOOTSTRAP", "bar")
.with_stderr_contains("error: Cannot set `RUSTC_BOOTSTRAP=1` [..]")
.with_stderr_contains(
@ -158,7 +158,7 @@ fn rustc_bootstrap() {
.file("build.rs", build_rs)
.build();
// nightly should warn when there's no library whether or not RUSTC_BOOTSTRAP is set
p.cargo("build")
p.cargo("check")
.masquerade_as_nightly_cargo(&["RUSTC_BOOTSTRAP"])
// NOTE: uses RUSTC_BOOTSTRAP so it will be propagated to rustc
// (this matters when tests are being run with a beta or stable cargo)
@ -166,7 +166,7 @@ fn rustc_bootstrap() {
.with_stderr_contains("warning: Cannot set `RUSTC_BOOTSTRAP=1` [..]")
.run();
// RUSTC_BOOTSTRAP conditionally set when there's no library should error (regardless of the value)
p.cargo("build")
p.cargo("check")
.env("RUSTC_BOOTSTRAP", "foo")
.with_stderr_contains("error: Cannot set `RUSTC_BOOTSTRAP=1` [..]")
.with_stderr_contains("help: [..] set the environment variable `RUSTC_BOOTSTRAP=1` [..]")
@ -202,7 +202,7 @@ fn build_script_sees_cfg_target_feature() {
.file("build.rs", build_rs)
.build();
p.cargo("build -vv")
p.cargo("check -vv")
.with_stderr_contains("[foo 0.0.1] CARGO_CFG_TARGET_FEATURE=[..]sse4.2[..]")
.with_stderr_contains("[..]-Ctarget-feature=[..]+sse4.2[..]")
.run();
@ -233,7 +233,7 @@ fn cfg_paradox() {
.file("build.rs", build_rs)
.build();
p.cargo("build -vv")
p.cargo("check -vv")
.with_stderr_contains("[WARNING] non-trivial mutual dependency between target-specific configuration and RUSTFLAGS")
.with_stderr_contains("[foo 0.0.1] cfg!(bertrand)=true")
.with_stderr_contains("[..]--cfg=bertrand[..]")