Skip to content

Commit 59b80f5

Browse files
committed
Run cargo test on tidy itself.
1 parent 4620f82 commit 59b80f5

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

src/bootstrap/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ impl<'a> Builder<'a> {
662662
crate::toolstate::ToolStateCheck,
663663
test::ExpandYamlAnchors,
664664
test::Tidy,
665+
test::TidySelfTest,
665666
test::Ui,
666667
test::RunPassValgrind,
667668
test::MirOpt,

src/bootstrap/test.rs

+34
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,40 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy`
11431143
}
11441144
}
11451145

1146+
/// Runs tidy's own tests.
1147+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1148+
pub struct TidySelfTest;
1149+
1150+
impl Step for TidySelfTest {
1151+
type Output = ();
1152+
const DEFAULT: bool = true;
1153+
const ONLY_HOSTS: bool = true;
1154+
1155+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
1156+
run.alias("tidyselftest")
1157+
}
1158+
1159+
fn make_run(run: RunConfig<'_>) {
1160+
run.builder.ensure(TidySelfTest);
1161+
}
1162+
1163+
fn run(self, builder: &Builder<'_>) {
1164+
let bootstrap_host = builder.config.build;
1165+
let compiler = builder.compiler(0, bootstrap_host);
1166+
let cargo = tool::prepare_tool_cargo(
1167+
builder,
1168+
compiler,
1169+
Mode::ToolBootstrap,
1170+
bootstrap_host,
1171+
"test",
1172+
"src/tools/tidy",
1173+
SourceType::InTree,
1174+
&[],
1175+
);
1176+
try_run(builder, &mut cargo.into());
1177+
}
1178+
}
1179+
11461180
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
11471181
pub struct ExpandYamlAnchors;
11481182

src/ci/docker/host-x86_64/mingw-check-tidy/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
3333
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/
3434

3535
ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
36-
ENV SCRIPT python3 ../x.py test --stage 0 src/tools/tidy
36+
ENV SCRIPT python3 ../x.py test --stage 0 src/tools/tidy tidyselftest

0 commit comments

Comments
 (0)