Skip to content

Commit 7dd066a

Browse files
committed
Implement check::Compiletest using the tool_check_step macro
1 parent 9899d5b commit 7dd066a

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
@@ -421,61 +421,6 @@ impl Step for RustAnalyzer {
421421
}
422422
}
423423

424-
/// Compiletest is implicitly "checked" when it gets built in order to run tests,
425-
/// so this is mainly for people working on compiletest to run locally.
426-
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
427-
pub struct Compiletest {
428-
pub target: TargetSelection,
429-
}
430-
431-
impl Step for Compiletest {
432-
type Output = ();
433-
const ONLY_HOSTS: bool = true;
434-
const DEFAULT: bool = false;
435-
436-
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
437-
run.path("src/tools/compiletest")
438-
}
439-
440-
fn make_run(run: RunConfig<'_>) {
441-
run.builder.ensure(Compiletest { target: run.target });
442-
}
443-
444-
fn run(self, builder: &Builder<'_>) {
445-
let mode = if builder.config.compiletest_use_stage0_libtest {
446-
Mode::ToolBootstrap
447-
} else {
448-
Mode::ToolStd
449-
};
450-
let build_compiler = prepare_compiler_for_check(builder, self.target, mode);
451-
452-
let mut cargo = prepare_tool_cargo(
453-
builder,
454-
build_compiler,
455-
mode,
456-
self.target,
457-
builder.kind,
458-
"src/tools/compiletest",
459-
SourceType::InTree,
460-
&[],
461-
);
462-
463-
cargo.allow_features(COMPILETEST_ALLOW_FEATURES);
464-
465-
cargo.arg("--all-targets");
466-
467-
let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, mode, self.target))
468-
.with_prefix("compiletest-check");
469-
470-
let _guard = builder.msg_check("compiletest artifacts", self.target, None);
471-
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
472-
}
473-
474-
fn metadata(&self) -> Option<StepMetadata> {
475-
Some(StepMetadata::check("compiletest", self.target))
476-
}
477-
}
478-
479424
macro_rules! tool_check_step {
480425
(
481426
$name:ident {
@@ -630,3 +575,16 @@ tool_check_step!(CoverageDump {
630575
mode: |_builder| Mode::ToolBootstrap,
631576
default: false
632577
});
578+
579+
// Compiletest is implicitly "checked" when it gets built in order to run tests,
580+
// so this is mainly for people working on compiletest to run locally.
581+
tool_check_step!(Compiletest {
582+
path: "src/tools/compiletest",
583+
mode: |builder: &Builder<'_>| if builder.config.compiletest_use_stage0_libtest {
584+
Mode::ToolBootstrap
585+
} else {
586+
Mode::ToolStd
587+
},
588+
allow_features: COMPILETEST_ALLOW_FEATURES,
589+
default: false,
590+
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,7 @@ mod snapshot {
15051505
insta::assert_snapshot!(
15061506
ctx.config("check")
15071507
.path("compiletest")
1508-
.render_steps(), @"[check] compiletest <host>");
1508+
.render_steps(), @"[check] rustc 0 <host> -> Compiletest 1 <host>");
15091509
}
15101510

15111511
#[test]
@@ -1519,7 +1519,7 @@ mod snapshot {
15191519
[build] llvm <host>
15201520
[build] rustc 0 <host> -> rustc 1 <host>
15211521
[build] rustc 1 <host> -> std 1 <host>
1522-
[check] compiletest <host>
1522+
[check] rustc 1 <host> -> Compiletest 2 <host>
15231523
");
15241524
}
15251525

0 commit comments

Comments
 (0)