Expose test-float-parse via bootstrap · rust-lang/rust@6062059 (original) (raw)

4 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -466,6 +466,7 @@ tool_check_step!(CargoMiri, "src/tools/miri/cargo-miri", SourceType::InTree);
466 466 tool_check_step!(Rls, "src/tools/rls", SourceType::InTree);
467 467 tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree);
468 468 tool_check_step!(MiroptTestTools, "src/tools/miropt-test-tools", SourceType::InTree);
469 +tool_check_step!(TestFloatParse, "src/etc/test-float-parse", SourceType::InTree);
469 470
470 471 tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false);
471 472
Original file line number Diff line number Diff line change
@@ -326,4 +326,5 @@ lint_any!(
326 326 Rustfmt, "src/tools/rustfmt", "rustfmt";
327 327 RustInstaller, "src/tools/rust-installer", "rust-installer";
328 328 Tidy, "src/tools/tidy", "tidy";
329 +TestFloatParse, "src/etc/test-float-parse", "test-float-parse";
329 330 );
Original file line number Diff line number Diff line change
@@ -3505,3 +3505,80 @@ impl Step for CodegenGCC {
3505 3505 cargo.into_cmd().run(builder);
3506 3506 }
3507 3507 }
3508 +
3509 +#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3510 +pub struct TestFloatParse {
3511 +path: PathBuf,
3512 +host: TargetSelection,
3513 +}
3514 +
3515 +impl Step for TestFloatParse {
3516 +type Output = ();
3517 +const ONLY_HOSTS: bool = true;
3518 +const DEFAULT: bool = true;
3519 +
3520 +fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
3521 + run.path("src/etc/test-float-parse")
3522 +}
3523 +
3524 +fn make_run(run: RunConfig<'_>) {
3525 +for path in run.paths {
3526 +let path = path.assert_single_path().path.clone();
3527 + run.builder.ensure(Self { path, host: run.target });
3528 +}
3529 +}
3530 +
3531 +fn run(self, builder: &Builder<'_>) {
3532 +let bootstrap_host = builder.config.build;
3533 +let compiler = builder.compiler(0, bootstrap_host);
3534 +let path = self.path.to_str().unwrap();
3535 +let crate_name = self.path.components().last().unwrap().as_os_str().to_str().unwrap();
3536 +
3537 + builder.ensure(compile::Std::new(compiler, self.host));
3538 +
3539 +// Run any unit tests in the crate
3540 +let cargo_test = tool::prepare_tool_cargo(
3541 + builder,
3542 + compiler,
3543 +Mode::ToolStd,
3544 + bootstrap_host,
3545 +"test",
3546 + path,
3547 +SourceType::InTree,
3548 +&[],
3549 +);
3550 +
3551 +run_cargo_test(
3552 + cargo_test,
3553 +&[],
3554 +&[],
3555 + crate_name,
3556 + crate_name,
3557 + compiler,
3558 + bootstrap_host,
3559 + builder,
3560 +);
3561 +
3562 +// Run the actual parse tests.
3563 +let mut cargo_run = tool::prepare_tool_cargo(
3564 + builder,
3565 + compiler,
3566 +Mode::ToolStd,
3567 + bootstrap_host,
3568 +"run",
3569 + path,
3570 +SourceType::InTree,
3571 +&[],
3572 +);
3573 +
3574 + cargo_run.arg("--");
3575 +if builder.config.args().is_empty() {
3576 +// By default, exclude tests that take longer than ~1m.
3577 + cargo_run.arg("--skip-huge");
3578 +} else {
3579 + cargo_run.args(builder.config.args());
3580 +}
3581 +
3582 + cargo_run.into_cmd().run(builder);
3583 +}
3584 +}
Original file line number Diff line number Diff line change
@@ -826,6 +826,7 @@ impl<'a> Builder<'a> {
826 826 clippy::Rustdoc,
827 827 clippy::Rustfmt,
828 828 clippy::RustInstaller,
829 + clippy::TestFloatParse,
829 830 clippy::Tidy,
830 831 ),
831 832 Kind::Check | Kind::Fix => describe!(
@@ -840,6 +841,7 @@ impl<'a> Builder<'a> {
840 841 check::Rls,
841 842 check::Rustfmt,
842 843 check::RustAnalyzer,
844 + check::TestFloatParse,
843 845 check::Bootstrap,
844 846 ),
845 847 Kind::Test => describe!(
@@ -901,6 +903,7 @@ impl<'a> Builder<'a> {
901 903 test::RustdocJson,
902 904 test::HtmlCheck,
903 905 test::RustInstaller,
906 + test::TestFloatParse,
904 907 // Run bootstrap close to the end as it's unlikely to fail
905 908 test::Bootstrap,
906 909 // Run run-make last, since these won't pass without make on Windows