Skip to content

Commit fd87f50

Browse files
committed
add TestFloatParse to tools for bootstrap
1 parent 06d261d commit fd87f50

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3550,7 +3550,7 @@ impl Step for TestFloatParse {
35503550
let crate_name = self.path.components().last().unwrap().as_os_str().to_str().unwrap();
35513551

35523552
if !builder.download_rustc() {
3553-
builder.ensure(compile::Std::new(compiler, self.host));
3553+
builder.ensure(tool::TestFloatParse { path: path.into(), host: self.host });
35543554
}
35553555

35563556
// Run any unit tests in the crate

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,50 @@ tool_extended!((self, builder),
10961096
Rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, add_bins_to_sysroot = ["rustfmt", "cargo-fmt"];
10971097
);
10981098

1099+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1100+
pub struct TestFloatParse {
1101+
pub path: PathBuf,
1102+
pub host: TargetSelection,
1103+
}
1104+
1105+
impl Step for TestFloatParse {
1106+
type Output = ();
1107+
const ONLY_HOSTS: bool = true;
1108+
const DEFAULT: bool = true;
1109+
1110+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
1111+
run.path("src/etc/test-float-parse")
1112+
}
1113+
1114+
fn make_run(run: RunConfig<'_>) {
1115+
for path in run.paths {
1116+
let path = path.assert_single_path().path.clone();
1117+
run.builder.ensure(Self { path, host: run.target });
1118+
}
1119+
}
1120+
1121+
fn run(self, builder: &Builder<'_>) {
1122+
let bootstrap_host = builder.config.build;
1123+
let compiler = builder.compiler(builder.top_stage, bootstrap_host);
1124+
let path: &'static str =
1125+
Box::leak(self.path.to_str().unwrap().to_string().into_boxed_str());
1126+
1127+
if !builder.download_rustc() {
1128+
builder.ensure(ToolBuild {
1129+
compiler,
1130+
target: bootstrap_host,
1131+
tool: "test-float-parse",
1132+
mode: Mode::ToolStd,
1133+
path,
1134+
source_type: SourceType::InTree,
1135+
extra_features: Vec::new(),
1136+
allow_features: "",
1137+
cargo_args: Vec::new(),
1138+
});
1139+
}
1140+
}
1141+
}
1142+
10991143
impl Builder<'_> {
11001144
/// Gets a `BootstrapCommand` which is ready to run `tool` in `stage` built for
11011145
/// `host`.

0 commit comments

Comments
 (0)