rust/src/ci
Samuel Tardieu 202d1f5bf4
Rollup merge of #144675 - jieyouxu:compiletest-staging, r=Kobzol
Reject running `compiletest` self-tests against stage 0 rustc unless explicitly allowed

Currently, in `pr-check-1`, we run `python3 ../x.py test --stage 0 src/tools/compiletest`, which is `compiletest` self-tests against stage 0 rustc. This makes it very annoying for PRs wanting to change target spec JSON format, which `compiletest` depends on for target information, as otherwise `compiletest` would have to know how to handle 2 different target spec JSON formats and know when to pick which.

Instead of doing that, we change `compiletest` self-tests to reject running against stage 0 `rustc` *unless* explicitly allowed with `build.compiletest-allow-stage0=true`. `build.compiletest-allow-stage0` is a proper bootstrap config option in favor of the ad-hoc `COMPILETEST_FORCE_STAGE0` env var. This means that:

- `./x test src/tools/compiletest --stage=0` is not allowed, unless `build.compiletest-allow-stage0=true` is set. In this scenario, `compiletest` self-tests should be expected to fail unless the stage 0 `rustc` as provided is like codegen_cranelift where it's *actually* built from in-tree `rustc` sources.
- In CI, we change `./x test src/tools/compiletest --stage=0` to `./x test src/tools/compiletest --stage=1`, and move it to `pr-check-2`. Yes, this involves building the stage 1 compiler, but `pr-check-2` already has to build stage 1 compiler to test stage 1 library crates.
- Crucially, this means that **`compiletest` is only intended to support one target spec JSON format**, namely the one corresponding to the in-tree `rustc`.
- This should preserve the `compiletest-use-stage0-libtest` UX optimization where changing `compiler/` tree should still not require rebuilding `compiletest` as long as `build.compiletest-use-stage0-libtest=true`, as that should remain orthogonal. This is completely unlike my previous attempt at https://github.com/rust-lang/rust/pull/144563 that tries to do a way more invasive change which would cause the rebuild problem.

Best reviewed commit-by-commit.

---

r? `@Kobzol`
2025-07-30 19:49:03 +02:00
..
citool Enforce PR CI jobs are a subset of Auto CI jobs (modulo carve-outs) 2025-07-21 18:06:06 +08:00
docker Run compiletest self-tests against stage 1 rustc 2025-07-30 19:55:17 +08:00
github-actions Auto merge of #144305 - ChrisDenton:win-free-disk-space, r=marcoieni 2025-07-30 06:00:09 +00:00
scripts Auto merge of #144305 - ChrisDenton:win-free-disk-space, r=marcoieni 2025-07-30 06:00:09 +00:00
channel move the current channel to src/ci/channel 2021-05-06 17:11:12 +02:00
cpu-usage-over-time.py Migrate to modern datetime API 2025-05-14 08:41:30 -07:00
publish_toolstate.sh Fix publishing of toolstate history 2024-06-05 16:41:59 +02:00
run.sh Do not enable LLD by default in the dist profile 2025-07-01 08:19:34 +02:00
shared.sh CI: split x86_64-mingw job 2024-11-29 16:04:12 +01:00