Skip to content

Commit 245d2c9

Browse files
committed
Implement check::Compiletest using the tool_check_step macro
1 parent bb46b8c commit 245d2c9

File tree

2 files changed

+15
-57
lines changed

2 files changed

+15
-57
lines changed

src/bootstrap/src/core/build_steps/check.rs

Lines changed: 13 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -433,61 +433,6 @@ impl Step for RustAnalyzer {
433433
}
434434
}
435435

436-
/// Compiletest is implicitly "checked" when it gets built in order to run tests,
437-
/// so this is mainly for people working on compiletest to run locally.
438-
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
439-
pub struct Compiletest {
440-
pub target: TargetSelection,
441-
}
442-
443-
impl Step for Compiletest {
444-
type Output = ();
445-
const ONLY_HOSTS: bool = true;
446-
const DEFAULT: bool = false;
447-
448-
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
449-
run.path("src/tools/compiletest")
450-
}
451-
452-
fn make_run(run: RunConfig<'_>) {
453-
run.builder.ensure(Compiletest { target: run.target });
454-
}
455-
456-
fn run(self, builder: &Builder<'_>) {
457-
let mode = if builder.config.compiletest_use_stage0_libtest {
458-
Mode::ToolBootstrap
459-
} else {
460-
Mode::ToolStd
461-
};
462-
let build_compiler = prepare_compiler_for_check(builder, self.target, mode);
463-
464-
let mut cargo = prepare_tool_cargo(
465-
builder,
466-
build_compiler,
467-
mode,
468-
self.target,
469-
builder.kind,
470-
"src/tools/compiletest",
471-
SourceType::InTree,
472-
&[],
473-
);
474-
475-
cargo.allow_features(COMPILETEST_ALLOW_FEATURES);
476-
477-
cargo.arg("--all-targets");
478-
479-
let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, mode, self.target))
480-
.with_prefix("compiletest-check");
481-
482-
let _guard = builder.msg_check("compiletest artifacts", self.target, None);
483-
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
484-
}
485-
486-
fn metadata(&self) -> Option<StepMetadata> {
487-
Some(StepMetadata::check("compiletest", self.target))
488-
}
489-
}
490-
491436
macro_rules! tool_check_step {
492437
(
493438
$name:ident {
@@ -642,3 +587,16 @@ tool_check_step!(CoverageDump {
642587
mode: |_builder| Mode::ToolBootstrap,
643588
default: false
644589
});
590+
591+
// Compiletest is implicitly "checked" when it gets built in order to run tests,
592+
// so this is mainly for people working on compiletest to run locally.
593+
tool_check_step!(Compiletest {
594+
path: "src/tools/compiletest",
595+
mode: |builder: &Builder<'_>| if builder.config.compiletest_use_stage0_libtest {
596+
Mode::ToolBootstrap
597+
} else {
598+
Mode::ToolStd
599+
},
600+
allow_features: COMPILETEST_ALLOW_FEATURES,
601+
default: false,
602+
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,7 @@ mod snapshot {
15281528
insta::assert_snapshot!(
15291529
ctx.config("check")
15301530
.path("compiletest")
1531-
.render_steps(), @"[check] compiletest <host>");
1531+
.render_steps(), @"[check] rustc 0 <host> -> Compiletest 1 <host>");
15321532
}
15331533

15341534
#[test]
@@ -1542,7 +1542,7 @@ mod snapshot {
15421542
[build] llvm <host>
15431543
[build] rustc 0 <host> -> rustc 1 <host>
15441544
[build] rustc 1 <host> -> std 1 <host>
1545-
[check] compiletest <host>
1545+
[check] rustc 1 <host> -> Compiletest 2 <host>
15461546
");
15471547
}
15481548

0 commit comments

Comments
 (0)