Skip to content

Commit 3dcc9b9

Browse files
committed
Fixup x test tier-check
1 parent 67d70fd commit 3dcc9b9

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
@@ -3217,9 +3217,15 @@ impl Step for Bootstrap {
32173217
}
32183218
}
32193219

3220+
fn get_compiler_to_test(builder: &Builder<'_>, target: TargetSelection) -> Compiler {
3221+
builder.compiler(builder.top_stage, target)
3222+
}
3223+
3224+
/// Tests the Platform Support page in the rustc book.
3225+
/// `test_compiler` is used to query the actual targets that are checked.
32203226
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
32213227
pub struct TierCheck {
3222-
pub compiler: Compiler,
3228+
test_compiler: Compiler,
32233229
}
32243230

32253231
impl Step for TierCheck {
@@ -3232,42 +3238,36 @@ impl Step for TierCheck {
32323238
}
32333239

32343240
fn make_run(run: RunConfig<'_>) {
3235-
let compiler = run.builder.compiler_for(
3236-
run.builder.top_stage,
3237-
run.builder.build.host_target,
3238-
run.target,
3239-
);
3240-
run.builder.ensure(TierCheck { compiler });
3241+
run.builder
3242+
.ensure(TierCheck { test_compiler: get_compiler_to_test(run.builder, run.target) });
32413243
}
32423244

3243-
/// Tests the Platform Support page in the rustc book.
32443245
fn run(self, builder: &Builder<'_>) {
3245-
builder.std(self.compiler, self.compiler.host);
3246+
let tool_build_compiler = builder.compiler(0, builder.host_target);
3247+
32463248
let mut cargo = tool::prepare_tool_cargo(
32473249
builder,
3248-
self.compiler,
3249-
Mode::ToolStd,
3250-
self.compiler.host,
3250+
tool_build_compiler,
3251+
Mode::ToolBootstrap,
3252+
tool_build_compiler.host,
32513253
Kind::Run,
32523254
"src/tools/tier-check",
32533255
SourceType::InTree,
32543256
&[],
32553257
);
32563258
cargo.arg(builder.src.join("src/doc/rustc/src/platform-support.md"));
3257-
cargo.arg(builder.rustc(self.compiler));
3259+
cargo.arg(builder.rustc(self.test_compiler));
32583260
if builder.is_verbose() {
32593261
cargo.arg("--verbose");
32603262
}
32613263

3262-
let _guard = builder.msg(
3263-
Kind::Test,
3264-
"platform support check",
3265-
None,
3266-
self.compiler,
3267-
self.compiler.host,
3268-
);
3264+
let _guard = builder.msg_test("platform support check", self.test_compiler);
32693265
BootstrapCommand::from(cargo).delay_failure().run(builder);
32703266
}
3267+
3268+
fn metadata(&self) -> Option<StepMetadata> {
3269+
Some(StepMetadata::test("tier-check", self.test_compiler.host))
3270+
}
32713271
}
32723272

32733273
#[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
@@ -1939,7 +1939,7 @@ mod snapshot {
19391939
.render_steps(), @r"
19401940
[build] llvm <host>
19411941
[build] rustc 0 <host> -> rustc 1 <host>
1942-
[build] rustc 1 <host> -> std 1 <host>
1942+
[test] rustc 0 <host> -> tier-check 1 <host>
19431943
");
19441944
}
19451945

src/bootstrap/src/lib.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,25 @@ impl Build {
11451145
self.group(&msg)
11461146
}
11471147

1148+
/// Return a `Group` guard for a [`Step`] that tests `what` with the given `stage` and `target`
1149+
/// (determined by `host_and_stage`).
1150+
/// Use this instead of [`Builder::msg`] when there is no clear `build_compiler` to be
1151+
/// determined.
1152+
///
1153+
/// [`Step`]: crate::core::builder::Step
1154+
#[must_use = "Groups should not be dropped until the Step finishes running"]
1155+
#[track_caller]
1156+
fn msg_test(
1157+
&self,
1158+
what: impl Display,
1159+
host_and_stage: impl Into<HostAndStage>,
1160+
) -> Option<gha::Group> {
1161+
let HostAndStage { host, stage } = host_and_stage.into();
1162+
let action = Kind::Test.description();
1163+
let msg = format!("{action} stage{stage} {what} ({host})");
1164+
self.group(&msg)
1165+
}
1166+
11481167
/// Return a `Group` guard for a [`Step`] that is only built once and isn't affected by `--stage`.
11491168
///
11501169
/// [`Step`]: crate::core::builder::Step

0 commit comments

Comments
 (0)