Skip to content

Commit f0e62c8

Browse files
committed
Replace impl with Rust
Enable in bootstrap Bootstrap updates Update makefile Update spot check test and README Add a skip-huge option Remove unneeded Cargo.toml keys in test-float-parse Update wording and fuzz test count Add test-float-parse to the global workspace Update test-float-parse tests Add exceptions Update readme Update readme Update bootstrap tfp to --skip-huge instead of listing tests Remove `Tee`, since it turned out to not be very useful Check for rounding at the centerpoint Add a test for incorrect rounding to even Remove allow_nan because it isn't useful; adjust logic for number of fuzz tests
1 parent 99b7134 commit f0e62c8

37 files changed

+2773
-559
lines changed

Cargo.lock

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2580,12 +2580,76 @@ dependencies = [
25802580
"windows-sys 0.48.0",
25812581
]
25822582

2583+
[[package]]
2584+
name = "num"
2585+
version = "0.4.3"
2586+
source = "registry+https://github.com/rust-lang/crates.io-index"
2587+
checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23"
2588+
dependencies = [
2589+
"num-bigint",
2590+
"num-complex",
2591+
"num-integer",
2592+
"num-iter",
2593+
"num-rational",
2594+
"num-traits",
2595+
]
2596+
2597+
[[package]]
2598+
name = "num-bigint"
2599+
version = "0.4.6"
2600+
source = "registry+https://github.com/rust-lang/crates.io-index"
2601+
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
2602+
dependencies = [
2603+
"num-integer",
2604+
"num-traits",
2605+
]
2606+
2607+
[[package]]
2608+
name = "num-complex"
2609+
version = "0.4.6"
2610+
source = "registry+https://github.com/rust-lang/crates.io-index"
2611+
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
2612+
dependencies = [
2613+
"num-traits",
2614+
]
2615+
25832616
[[package]]
25842617
name = "num-conv"
25852618
version = "0.1.0"
25862619
source = "registry+https://github.com/rust-lang/crates.io-index"
25872620
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
25882621

2622+
[[package]]
2623+
name = "num-integer"
2624+
version = "0.1.46"
2625+
source = "registry+https://github.com/rust-lang/crates.io-index"
2626+
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
2627+
dependencies = [
2628+
"num-traits",
2629+
]
2630+
2631+
[[package]]
2632+
name = "num-iter"
2633+
version = "0.1.45"
2634+
source = "registry+https://github.com/rust-lang/crates.io-index"
2635+
checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
2636+
dependencies = [
2637+
"autocfg",
2638+
"num-integer",
2639+
"num-traits",
2640+
]
2641+
2642+
[[package]]
2643+
name = "num-rational"
2644+
version = "0.4.2"
2645+
source = "registry+https://github.com/rust-lang/crates.io-index"
2646+
checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
2647+
dependencies = [
2648+
"num-bigint",
2649+
"num-integer",
2650+
"num-traits",
2651+
]
2652+
25892653
[[package]]
25902654
name = "num-traits"
25912655
version = "0.2.19"
@@ -5586,6 +5650,17 @@ dependencies = [
55865650
"std",
55875651
]
55885652

5653+
[[package]]
5654+
name = "test-float-parse"
5655+
version = "0.1.0"
5656+
dependencies = [
5657+
"indicatif",
5658+
"num",
5659+
"rand",
5660+
"rand_chacha",
5661+
"rayon",
5662+
]
5663+
55895664
[[package]]
55905665
name = "textwrap"
55915666
version = "0.16.1"

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ members = [
44
"compiler/rustc",
55
"library/std",
66
"library/sysroot",
7+
"src/etc/test-float-parse",
78
"src/rustdoc-json-types",
89
"src/tools/build_helper",
910
"src/tools/cargotest",

src/bootstrap/mk/Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ check-aux:
5151
$(Q)$(BOOTSTRAP) test --stage 2 \
5252
src/tools/cargo \
5353
src/tools/cargotest \
54+
etc/etc/test-float-parse \
5455
$(BOOTSTRAP_ARGS)
5556
# Run standard library tests in Miri.
5657
$(Q)BOOTSTRAP_SKIP_TARGET_SANITY=1 \

src/bootstrap/src/core/build_steps/check.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ tool_check_step!(CargoMiri, "src/tools/miri/cargo-miri", SourceType::InTree);
466466
tool_check_step!(Rls, "src/tools/rls", SourceType::InTree);
467467
tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree);
468468
tool_check_step!(MiroptTestTools, "src/tools/miropt-test-tools", SourceType::InTree);
469+
tool_check_step!(TestFloatParse, "src/etc/test-float-parse", SourceType::InTree);
469470

470471
tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false);
471472

src/bootstrap/src/core/build_steps/clippy.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,4 +326,5 @@ lint_any!(
326326
Rustfmt, "src/tools/rustfmt", "rustfmt";
327327
RustInstaller, "src/tools/rust-installer", "rust-installer";
328328
Tidy, "src/tools/tidy", "tidy";
329+
TestFloatParse, "src/etc/test-float-parse", "test-float-parse";
329330
);

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

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3466,3 +3466,79 @@ impl Step for CodegenGCC {
34663466
cargo.into_cmd().run(builder);
34673467
}
34683468
}
3469+
3470+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3471+
pub struct TestFloatParse {
3472+
path: PathBuf,
3473+
}
3474+
3475+
impl Step for TestFloatParse {
3476+
type Output = ();
3477+
const ONLY_HOSTS: bool = true;
3478+
const DEFAULT: bool = true;
3479+
3480+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
3481+
run.path("src/etc/test-float-parse")
3482+
}
3483+
3484+
fn make_run(run: RunConfig<'_>) {
3485+
for path in run.paths {
3486+
let path = path.assert_single_path().path.clone();
3487+
run.builder.ensure(Self { path });
3488+
}
3489+
}
3490+
3491+
fn run(self, builder: &Builder<'_>) {
3492+
let bootstrap_host = builder.config.build;
3493+
let compiler = builder.compiler(0, bootstrap_host);
3494+
let path = self.path.to_str().unwrap();
3495+
let crate_name = self.path.components().last().unwrap().as_os_str().to_str().unwrap();
3496+
3497+
// Run any unit tests in the crate
3498+
let cargo_test = tool::prepare_tool_cargo(
3499+
builder,
3500+
compiler,
3501+
// todo: seems like this should be `Mode::Std`
3502+
// Mode::Std,
3503+
Mode::ToolBootstrap,
3504+
bootstrap_host,
3505+
"test",
3506+
path,
3507+
SourceType::InTree,
3508+
&[],
3509+
);
3510+
3511+
run_cargo_test(
3512+
cargo_test,
3513+
&[],
3514+
&[],
3515+
crate_name,
3516+
crate_name,
3517+
compiler,
3518+
bootstrap_host,
3519+
builder,
3520+
);
3521+
3522+
// Run the actual parse tests.
3523+
let mut cargo_run = tool::prepare_tool_cargo(
3524+
builder,
3525+
compiler,
3526+
Mode::ToolBootstrap,
3527+
bootstrap_host,
3528+
"run",
3529+
path,
3530+
SourceType::InTree,
3531+
&[],
3532+
);
3533+
3534+
cargo_run.arg("--");
3535+
if builder.config.args().is_empty() {
3536+
// By default, exclude tests that take longer than ~1m.
3537+
cargo_run.arg("--skip-huge");
3538+
} else {
3539+
cargo_run.args(builder.config.args());
3540+
}
3541+
3542+
cargo_run.into_cmd().run(builder);
3543+
}
3544+
}

src/bootstrap/src/core/builder.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ impl<'a> Builder<'a> {
794794
clippy::Rustdoc,
795795
clippy::Rustfmt,
796796
clippy::RustInstaller,
797+
clippy::TestFloatParse,
797798
clippy::Tidy,
798799
),
799800
Kind::Check | Kind::Fix => describe!(
@@ -808,6 +809,7 @@ impl<'a> Builder<'a> {
808809
check::Rls,
809810
check::Rustfmt,
810811
check::RustAnalyzer,
812+
check::TestFloatParse,
811813
check::Bootstrap,
812814
),
813815
Kind::Test => describe!(
@@ -868,6 +870,7 @@ impl<'a> Builder<'a> {
868870
test::RustdocJson,
869871
test::HtmlCheck,
870872
test::RustInstaller,
873+
test::TestFloatParse,
871874
// Run bootstrap close to the end as it's unlikely to fail
872875
test::Bootstrap,
873876
// Run run-make last, since these won't pass without make on Windows

0 commit comments

Comments
 (0)