about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-24 22:51:43 +0000
committerbors <bors@rust-lang.org>2024-09-24 22:51:43 +0000
commit3f99982c633dbca746140db60ed52ba7fa112803 (patch)
tree6421e88cf01795dd9d63bdf9531d8985ff9daa23 /src/tools
parent363ae4188316b8b22cf6c1890bc73d84d05f70a4 (diff)
parentf5482167286424fd25266d8202e8ded6655cc9ec (diff)
downloadrust-3f99982c633dbca746140db60ed52ba7fa112803.tar.gz
rust-3f99982c633dbca746140db60ed52ba7fa112803.zip
Auto merge of #130739 - jieyouxu:stage0_run_make, r=Kobzol
Fix cargo staging for run-make tests

Follow-up to https://github.com/rust-lang/rust/pull/130642#issuecomment-2366891866 to make sure that when

```
$ COMPILETEST_FORCE_STAGE0=1 ./x test run-make --stage 0
```

is used, bootstrap cargo is used in order to avoid building stage 1 rustc. Note that run-make tests are usually not written with `--stage 0` in mind and some tests may rely on stage1 rustc (nightly) behavior, and it is expected that some tests will fail under this invocation.

This PR also fixes `tool::Cargo` staging in compiletest when preparing for `run-make` test mode, by chopping off a stage from the `compiler` passed to `tool::Cargo` such that when the user invokes with stage `N`

```
./x test run-make --stage N
```

the `run-make` test suite will be tested against the cargo built by stage `N` compiler. Let's take `N=1`, i.e. `--stage 1`, without chopping off a stage, previously `./x test run-make --stage 1` will cause stage 1 rustc + std to be built, then stage 2 rustc, and cargo will be produced by the stage 2 rustc, which is clearly not what we want. By chopping off a stage, it means that cargo will be produced by the stage 1 rustc.

cc #119946, #59864.
See discussions regarding the tool staging at https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/.E2.9C.94.20stage1.20run-make.20tests.20now.20need.20stage2.20rustc.20built.20for.20c.2E.2E.2E.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/run-make-support/src/external_deps/cargo.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/run-make-support/src/external_deps/cargo.rs b/src/tools/run-make-support/src/external_deps/cargo.rs
index b0e045dc80b..e91d101cb99 100644
--- a/src/tools/run-make-support/src/external_deps/cargo.rs
+++ b/src/tools/run-make-support/src/external_deps/cargo.rs
@@ -1,7 +1,8 @@
 use crate::command::Command;
 use crate::env_var;
 
-/// Returns a command that can be used to invoke Cargo.
+/// Returns a command that can be used to invoke cargo. The cargo is provided by compiletest
+/// through the `CARGO` env var.
 pub fn cargo() -> Command {
-    Command::new(env_var("BOOTSTRAP_CARGO"))
+    Command::new(env_var("CARGO"))
 }