Skip to content

Commit fbca76f

Browse files
committed
Move {LintDocs,TierCheck} into doc_tool_tests
1 parent d6a9f7d commit fbca76f

File tree

2 files changed

+88
-87
lines changed

2 files changed

+88
-87
lines changed

src/bootstrap/src/core/build_steps/test/doc_tool_tests.rs

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
//! Auxiliary tools for checking various documentation.
22
33
use super::test_helpers::run_cargo_test;
4+
use crate::core::build_steps::compile;
45
use crate::core::build_steps::tool::{self, SourceType, Tool};
5-
use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
6+
use crate::core::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
67
use crate::core::config::TargetSelection;
7-
use crate::utils::exec::command;
8-
use crate::utils::helpers::{self};
8+
use crate::utils::exec::{BootstrapCommand, command};
9+
use crate::utils::helpers;
910
use crate::{DocTests, Mode};
1011

1112
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -139,3 +140,86 @@ impl Step for HtmlCheck {
139140
.run(builder);
140141
}
141142
}
143+
144+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
145+
pub struct TierCheck {
146+
pub compiler: Compiler,
147+
}
148+
149+
impl Step for TierCheck {
150+
type Output = ();
151+
const DEFAULT: bool = true;
152+
const ONLY_HOSTS: bool = true;
153+
154+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
155+
run.path("src/tools/tier-check")
156+
}
157+
158+
fn make_run(run: RunConfig<'_>) {
159+
let compiler =
160+
run.builder.compiler_for(run.builder.top_stage, run.builder.build.build, run.target);
161+
run.builder.ensure(TierCheck { compiler });
162+
}
163+
164+
/// Tests the Platform Support page in the rustc book.
165+
fn run(self, builder: &Builder<'_>) {
166+
builder.ensure(compile::Std::new(self.compiler, self.compiler.host));
167+
let mut cargo = tool::prepare_tool_cargo(
168+
builder,
169+
self.compiler,
170+
Mode::ToolStd,
171+
self.compiler.host,
172+
Kind::Run,
173+
"src/tools/tier-check",
174+
SourceType::InTree,
175+
&[],
176+
);
177+
cargo.arg(builder.src.join("src/doc/rustc/src/platform-support.md"));
178+
cargo.arg(builder.rustc(self.compiler));
179+
if builder.is_verbose() {
180+
cargo.arg("--verbose");
181+
}
182+
183+
let _guard = builder.msg(
184+
Kind::Test,
185+
self.compiler.stage,
186+
"platform support check",
187+
self.compiler.host,
188+
self.compiler.host,
189+
);
190+
BootstrapCommand::from(cargo).delay_failure().run(builder);
191+
}
192+
}
193+
194+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
195+
pub struct LintDocs {
196+
pub compiler: Compiler,
197+
pub target: TargetSelection,
198+
}
199+
200+
impl Step for LintDocs {
201+
type Output = ();
202+
const DEFAULT: bool = true;
203+
const ONLY_HOSTS: bool = true;
204+
205+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
206+
run.path("src/tools/lint-docs")
207+
}
208+
209+
fn make_run(run: RunConfig<'_>) {
210+
run.builder.ensure(LintDocs {
211+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
212+
target: run.target,
213+
});
214+
}
215+
216+
/// Tests that the lint examples in the rustc book generate the correct lints and have the
217+
/// expected format.
218+
fn run(self, builder: &Builder<'_>) {
219+
builder.ensure(crate::core::build_steps::doc::RustcBook {
220+
compiler: self.compiler,
221+
target: self.target,
222+
validate: true,
223+
});
224+
}
225+
}

src/bootstrap/src/core/build_steps/test/mod.rs

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -65,92 +65,9 @@ pub(crate) use compiletest_suites::{
6565
};
6666
pub(crate) use devtool_tests::{Cargo, Clippy, RustAnalyzer, Rustfmt};
6767
pub(crate) use dist_tool_tests::{CollectLicenseMetadata, Distcheck, RustInstaller};
68-
pub(crate) use doc_tool_tests::{HtmlCheck, Linkcheck};
68+
pub(crate) use doc_tool_tests::{HtmlCheck, Linkcheck, LintDocs, TierCheck};
6969
pub(crate) use miri_tests::{CargoMiri, Miri};
7070
pub(crate) use rustdoc_tests::{CrateRustdoc, CrateRustdocJsonTypes, RustdocTheme};
7171
pub(crate) use std_tests::TestFloatParse;
7272
pub(crate) use test_helpers::Crate;
7373
pub(crate) use tidy::Tidy;
74-
75-
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
76-
pub struct TierCheck {
77-
pub compiler: Compiler,
78-
}
79-
80-
impl Step for TierCheck {
81-
type Output = ();
82-
const DEFAULT: bool = true;
83-
const ONLY_HOSTS: bool = true;
84-
85-
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
86-
run.path("src/tools/tier-check")
87-
}
88-
89-
fn make_run(run: RunConfig<'_>) {
90-
let compiler =
91-
run.builder.compiler_for(run.builder.top_stage, run.builder.build.build, run.target);
92-
run.builder.ensure(TierCheck { compiler });
93-
}
94-
95-
/// Tests the Platform Support page in the rustc book.
96-
fn run(self, builder: &Builder<'_>) {
97-
builder.ensure(compile::Std::new(self.compiler, self.compiler.host));
98-
let mut cargo = tool::prepare_tool_cargo(
99-
builder,
100-
self.compiler,
101-
Mode::ToolStd,
102-
self.compiler.host,
103-
Kind::Run,
104-
"src/tools/tier-check",
105-
SourceType::InTree,
106-
&[],
107-
);
108-
cargo.arg(builder.src.join("src/doc/rustc/src/platform-support.md"));
109-
cargo.arg(builder.rustc(self.compiler));
110-
if builder.is_verbose() {
111-
cargo.arg("--verbose");
112-
}
113-
114-
let _guard = builder.msg(
115-
Kind::Test,
116-
self.compiler.stage,
117-
"platform support check",
118-
self.compiler.host,
119-
self.compiler.host,
120-
);
121-
BootstrapCommand::from(cargo).delay_failure().run(builder);
122-
}
123-
}
124-
125-
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
126-
pub struct LintDocs {
127-
pub compiler: Compiler,
128-
pub target: TargetSelection,
129-
}
130-
131-
impl Step for LintDocs {
132-
type Output = ();
133-
const DEFAULT: bool = true;
134-
const ONLY_HOSTS: bool = true;
135-
136-
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
137-
run.path("src/tools/lint-docs")
138-
}
139-
140-
fn make_run(run: RunConfig<'_>) {
141-
run.builder.ensure(LintDocs {
142-
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
143-
target: run.target,
144-
});
145-
}
146-
147-
/// Tests that the lint examples in the rustc book generate the correct lints and have the
148-
/// expected format.
149-
fn run(self, builder: &Builder<'_>) {
150-
builder.ensure(crate::core::build_steps::doc::RustcBook {
151-
compiler: self.compiler,
152-
target: self.target,
153-
validate: true,
154-
});
155-
}
156-
}

0 commit comments

Comments
 (0)