Fixup x test tier-check

This commit is contained in:
Jakub Beránek 2025-08-08 11:55:07 +02:00
parent a3ef8178d2
commit 65b7cde18c
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
3 changed files with 40 additions and 21 deletions

View file

@ -3248,9 +3248,15 @@ impl Step for Bootstrap {
}
}
fn get_compiler_to_test(builder: &Builder<'_>, target: TargetSelection) -> Compiler {
builder.compiler(builder.top_stage, target)
}
/// Tests the Platform Support page in the rustc book.
/// `test_compiler` is used to query the actual targets that are checked.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct TierCheck {
pub compiler: Compiler,
test_compiler: Compiler,
}
impl Step for TierCheck {
@ -3263,42 +3269,36 @@ impl Step for TierCheck {
}
fn make_run(run: RunConfig<'_>) {
let compiler = run.builder.compiler_for(
run.builder.top_stage,
run.builder.build.host_target,
run.target,
);
run.builder.ensure(TierCheck { compiler });
run.builder
.ensure(TierCheck { test_compiler: get_compiler_to_test(run.builder, run.target) });
}
/// Tests the Platform Support page in the rustc book.
fn run(self, builder: &Builder<'_>) {
builder.std(self.compiler, self.compiler.host);
let tool_build_compiler = builder.compiler(0, builder.host_target);
let mut cargo = tool::prepare_tool_cargo(
builder,
self.compiler,
Mode::ToolStd,
self.compiler.host,
tool_build_compiler,
Mode::ToolBootstrap,
tool_build_compiler.host,
Kind::Run,
"src/tools/tier-check",
SourceType::InTree,
&[],
);
cargo.arg(builder.src.join("src/doc/rustc/src/platform-support.md"));
cargo.arg(builder.rustc(self.compiler));
cargo.arg(builder.rustc(self.test_compiler));
if builder.is_verbose() {
cargo.arg("--verbose");
}
let _guard = builder.msg(
Kind::Test,
"platform support check",
None,
self.compiler,
self.compiler.host,
);
let _guard = builder.msg_test("platform support check", self.test_compiler);
BootstrapCommand::from(cargo).delay_failure().run(builder);
}
fn metadata(&self) -> Option<StepMetadata> {
Some(StepMetadata::test("tier-check", self.test_compiler.host))
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]

View file

@ -2125,7 +2125,7 @@ mod snapshot {
.render_steps(), @r"
[build] llvm <host>
[build] rustc 0 <host> -> rustc 1 <host>
[build] rustc 1 <host> -> std 1 <host>
[test] rustc 0 <host> -> tier-check 1 <host>
");
}

View file

@ -1159,6 +1159,25 @@ impl Build {
self.group(&msg)
}
/// Return a `Group` guard for a [`Step`] that tests `what` with the given `stage` and `target`
/// (determined by `host_and_stage`).
/// Use this instead of [`Builder::msg`] when there is no clear `build_compiler` to be
/// determined.
///
/// [`Step`]: crate::core::builder::Step
#[must_use = "Groups should not be dropped until the Step finishes running"]
#[track_caller]
fn msg_test(
&self,
what: impl Display,
host_and_stage: impl Into<HostAndStage>,
) -> Option<gha::Group> {
let HostAndStage { host, stage } = host_and_stage.into();
let action = Kind::Test.description();
let msg = format!("{action} stage{stage} {what} ({host})");
self.group(&msg)
}
/// Return a `Group` guard for a [`Step`] that is only built once and isn't affected by `--stage`.
///
/// [`Step`]: crate::core::builder::Step