Skip to content

Commit 65b7cde

Browse files
committed
Fixup x test tier-check
1 parent a3ef817 commit 65b7cde

File tree

3 files changed

+40
-21
lines changed

3 files changed

+40
-21
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3248,9 +3248,15 @@ impl Step for Bootstrap {
32483248
}
32493249
}
32503250

3251+
fn get_compiler_to_test(builder: &Builder<'_>, target: TargetSelection) -> Compiler {
3252+
builder.compiler(builder.top_stage, target)
3253+
}
3254+
3255+
/// Tests the Platform Support page in the rustc book.
3256+
/// `test_compiler` is used to query the actual targets that are checked.
32513257
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
32523258
pub struct TierCheck {
3253-
pub compiler: Compiler,
3259+
test_compiler: Compiler,
32543260
}
32553261

32563262
impl Step for TierCheck {
@@ -3263,42 +3269,36 @@ impl Step for TierCheck {
32633269
}
32643270

32653271
fn make_run(run: RunConfig<'_>) {
3266-
let compiler = run.builder.compiler_for(
3267-
run.builder.top_stage,
3268-
run.builder.build.host_target,
3269-
run.target,
3270-
);
3271-
run.builder.ensure(TierCheck { compiler });
3272+
run.builder
3273+
.ensure(TierCheck { test_compiler: get_compiler_to_test(run.builder, run.target) });
32723274
}
32733275

3274-
/// Tests the Platform Support page in the rustc book.
32753276
fn run(self, builder: &Builder<'_>) {
3276-
builder.std(self.compiler, self.compiler.host);
3277+
let tool_build_compiler = builder.compiler(0, builder.host_target);
3278+
32773279
let mut cargo = tool::prepare_tool_cargo(
32783280
builder,
3279-
self.compiler,
3280-
Mode::ToolStd,
3281-
self.compiler.host,
3281+
tool_build_compiler,
3282+
Mode::ToolBootstrap,
3283+
tool_build_compiler.host,
32823284
Kind::Run,
32833285
"src/tools/tier-check",
32843286
SourceType::InTree,
32853287
&[],
32863288
);
32873289
cargo.arg(builder.src.join("src/doc/rustc/src/platform-support.md"));
3288-
cargo.arg(builder.rustc(self.compiler));
3290+
cargo.arg(builder.rustc(self.test_compiler));
32893291
if builder.is_verbose() {
32903292
cargo.arg("--verbose");
32913293
}
32923294

3293-
let _guard = builder.msg(
3294-
Kind::Test,
3295-
"platform support check",
3296-
None,
3297-
self.compiler,
3298-
self.compiler.host,
3299-
);
3295+
let _guard = builder.msg_test("platform support check", self.test_compiler);
33003296
BootstrapCommand::from(cargo).delay_failure().run(builder);
33013297
}
3298+
3299+
fn metadata(&self) -> Option<StepMetadata> {
3300+
Some(StepMetadata::test("tier-check", self.test_compiler.host))
3301+
}
33023302
}
33033303

33043304
#[derive(Debug, Clone, PartialEq, Eq, Hash)]

src/bootstrap/src/core/builder/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2125,7 +2125,7 @@ mod snapshot {
21252125
.render_steps(), @r"
21262126
[build] llvm <host>
21272127
[build] rustc 0 <host> -> rustc 1 <host>
2128-
[build] rustc 1 <host> -> std 1 <host>
2128+
[test] rustc 0 <host> -> tier-check 1 <host>
21292129
");
21302130
}
21312131

src/bootstrap/src/lib.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,25 @@ impl Build {
11591159
self.group(&msg)
11601160
}
11611161

1162+
/// Return a `Group` guard for a [`Step`] that tests `what` with the given `stage` and `target`
1163+
/// (determined by `host_and_stage`).
1164+
/// Use this instead of [`Builder::msg`] when there is no clear `build_compiler` to be
1165+
/// determined.
1166+
///
1167+
/// [`Step`]: crate::core::builder::Step
1168+
#[must_use = "Groups should not be dropped until the Step finishes running"]
1169+
#[track_caller]
1170+
fn msg_test(
1171+
&self,
1172+
what: impl Display,
1173+
host_and_stage: impl Into<HostAndStage>,
1174+
) -> Option<gha::Group> {
1175+
let HostAndStage { host, stage } = host_and_stage.into();
1176+
let action = Kind::Test.description();
1177+
let msg = format!("{action} stage{stage} {what} ({host})");
1178+
self.group(&msg)
1179+
}
1180+
11621181
/// Return a `Group` guard for a [`Step`] that is only built once and isn't affected by `--stage`.
11631182
///
11641183
/// [`Step`]: crate::core::builder::Step

0 commit comments

Comments
 (0)