Expose test-float-parse
via bootstrap
With updates to `test-float-parse`, it is now possible to run as another Rust tool. Enable check, clippy, and test. Test runs the unit tests, as well as shorter parsing tests (takes approximately 1 minute).
This commit is contained in:
parent
51827ce4e4
commit
6062059ab0
@ -466,6 +466,7 @@ tool_check_step!(CargoMiri, "src/tools/miri/cargo-miri", SourceType::InTree);
|
||||
tool_check_step!(Rls, "src/tools/rls", SourceType::InTree);
|
||||
tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree);
|
||||
tool_check_step!(MiroptTestTools, "src/tools/miropt-test-tools", SourceType::InTree);
|
||||
tool_check_step!(TestFloatParse, "src/etc/test-float-parse", SourceType::InTree);
|
||||
|
||||
tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false);
|
||||
|
||||
|
@ -326,4 +326,5 @@ lint_any!(
|
||||
Rustfmt, "src/tools/rustfmt", "rustfmt";
|
||||
RustInstaller, "src/tools/rust-installer", "rust-installer";
|
||||
Tidy, "src/tools/tidy", "tidy";
|
||||
TestFloatParse, "src/etc/test-float-parse", "test-float-parse";
|
||||
);
|
||||
|
@ -3505,3 +3505,80 @@ impl Step for CodegenGCC {
|
||||
cargo.into_cmd().run(builder);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct TestFloatParse {
|
||||
path: PathBuf,
|
||||
host: TargetSelection,
|
||||
}
|
||||
|
||||
impl Step for TestFloatParse {
|
||||
type Output = ();
|
||||
const ONLY_HOSTS: bool = true;
|
||||
const DEFAULT: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
run.path("src/etc/test-float-parse")
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
for path in run.paths {
|
||||
let path = path.assert_single_path().path.clone();
|
||||
run.builder.ensure(Self { path, host: run.target });
|
||||
}
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let bootstrap_host = builder.config.build;
|
||||
let compiler = builder.compiler(0, bootstrap_host);
|
||||
let path = self.path.to_str().unwrap();
|
||||
let crate_name = self.path.components().last().unwrap().as_os_str().to_str().unwrap();
|
||||
|
||||
builder.ensure(compile::Std::new(compiler, self.host));
|
||||
|
||||
// Run any unit tests in the crate
|
||||
let cargo_test = tool::prepare_tool_cargo(
|
||||
builder,
|
||||
compiler,
|
||||
Mode::ToolStd,
|
||||
bootstrap_host,
|
||||
"test",
|
||||
path,
|
||||
SourceType::InTree,
|
||||
&[],
|
||||
);
|
||||
|
||||
run_cargo_test(
|
||||
cargo_test,
|
||||
&[],
|
||||
&[],
|
||||
crate_name,
|
||||
crate_name,
|
||||
compiler,
|
||||
bootstrap_host,
|
||||
builder,
|
||||
);
|
||||
|
||||
// Run the actual parse tests.
|
||||
let mut cargo_run = tool::prepare_tool_cargo(
|
||||
builder,
|
||||
compiler,
|
||||
Mode::ToolStd,
|
||||
bootstrap_host,
|
||||
"run",
|
||||
path,
|
||||
SourceType::InTree,
|
||||
&[],
|
||||
);
|
||||
|
||||
cargo_run.arg("--");
|
||||
if builder.config.args().is_empty() {
|
||||
// By default, exclude tests that take longer than ~1m.
|
||||
cargo_run.arg("--skip-huge");
|
||||
} else {
|
||||
cargo_run.args(builder.config.args());
|
||||
}
|
||||
|
||||
cargo_run.into_cmd().run(builder);
|
||||
}
|
||||
}
|
||||
|
@ -826,6 +826,7 @@ impl<'a> Builder<'a> {
|
||||
clippy::Rustdoc,
|
||||
clippy::Rustfmt,
|
||||
clippy::RustInstaller,
|
||||
clippy::TestFloatParse,
|
||||
clippy::Tidy,
|
||||
),
|
||||
Kind::Check | Kind::Fix => describe!(
|
||||
@ -840,6 +841,7 @@ impl<'a> Builder<'a> {
|
||||
check::Rls,
|
||||
check::Rustfmt,
|
||||
check::RustAnalyzer,
|
||||
check::TestFloatParse,
|
||||
check::Bootstrap,
|
||||
),
|
||||
Kind::Test => describe!(
|
||||
@ -901,6 +903,7 @@ impl<'a> Builder<'a> {
|
||||
test::RustdocJson,
|
||||
test::HtmlCheck,
|
||||
test::RustInstaller,
|
||||
test::TestFloatParse,
|
||||
// Run bootstrap close to the end as it's unlikely to fail
|
||||
test::Bootstrap,
|
||||
// Run run-make last, since these won't pass without make on Windows
|
||||
|
Loading…
x
Reference in New Issue
Block a user