Skip to content

Commit

Permalink
add TestFloatParse to tools for bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
lucarlig committed Oct 15, 2024
1 parent 88f3114 commit e730fcc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3550,7 +3550,7 @@ impl Step for TestFloatParse {
let crate_name = self.path.components().last().unwrap().as_os_str().to_str().unwrap();

if !builder.download_rustc() {
builder.ensure(compile::Std::new(compiler, self.host));
builder.ensure(tool::TestFloatParse { path: path.into(), host: self.host });
}

// Run any unit tests in the crate
Expand Down
44 changes: 44 additions & 0 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,50 @@ tool_extended!((self, builder),
Rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, add_bins_to_sysroot = ["rustfmt", "cargo-fmt"];
);

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct TestFloatParse {
pub path: PathBuf,
pub 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(builder.top_stage, bootstrap_host);
let path: &'static str =
Box::leak(self.path.to_str().unwrap().to_string().into_boxed_str());

if !builder.download_rustc() {
builder.ensure(ToolBuild {
compiler,
target: bootstrap_host,
tool: "test-float-parse",
mode: Mode::ToolStd,
path,
source_type: SourceType::InTree,
extra_features: Vec::new(),
allow_features: "",
cargo_args: Vec::new(),
});
}
}
}

impl<'a> Builder<'a> {
/// Gets a `BootstrapCommand` which is ready to run `tool` in `stage` built for
/// `host`.
Expand Down

0 comments on commit e730fcc

Please sign in to comment.