Skip to content

Commit 0b3c3c9

Browse files
authored
Rollup merge of #106334 - ehuss:fix-tidy-unittests, r=jyn514
Fix tidy unittest. The tidy unittests weren't compiling due to a change made a long while ago to the `Version` type.
2 parents 0a08ab1 + 59b80f5 commit 0b3c3c9

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
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

src/tools/tidy/src/features/version/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ fn test_try_from_invalid_version() {
1212

1313
#[test]
1414
fn test_try_from_single() {
15-
assert_eq!("1.32.0".parse(), Ok(Version { parts: [1, 32, 0] }));
16-
assert_eq!("1.0.0".parse(), Ok(Version { parts: [1, 0, 0] }));
15+
assert_eq!("1.32.0".parse(), Ok(Version::Explicit { parts: [1, 32, 0] }));
16+
assert_eq!("1.0.0".parse(), Ok(Version::Explicit { parts: [1, 0, 0] }));
1717
}
1818

1919
#[test]

0 commit comments

Comments
 (0)