Skip to content

Comments

test-float-parse: Use an overrideable random seed#152598

Open
tgross35 wants to merge 3 commits intorust-lang:mainfrom
tgross35:test-float-parse-updates
Open

test-float-parse: Use an overrideable random seed#152598
tgross35 wants to merge 3 commits intorust-lang:mainfrom
tgross35:test-float-parse-updates

Conversation

@tgross35
Copy link
Contributor

Currently test-float-parse is mostly random tests which take a fixed
seed, meaning the same set of values get tested for each invocation.
This isn't ideal because we don't get the true benefit of randomness,
which is to have better coverage over time.

Improve this by using a randomly generated seed, which can also be set
via env. The seed is printed at the beginning of each run so it is easy
to reproduce failures using the same test set, if needed.

Typically it isn't great to have fuzzing randomness in tests that get
run in CI because it can lead to spurious failures. However, this is a
test for which failure should never happen becasue the algorithms are
reasonably well proven, so if one does occur it represents a very
unexpected bug that needs to be addressed. The error message is updated
to strongly recommend reporting before retrying and to include details
on how to reproduce.

Additionally there are two other commits with less notable changes,
details are in the messages there.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Feb 14, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 14, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @Mark-Simulacrum

@rust-log-analyzer

This comment has been minimized.

@tgross35 tgross35 force-pushed the test-float-parse-updates branch from e82bcb2 to 5939d5d Compare February 14, 2026 00:53
@rust-log-analyzer

This comment has been minimized.

Currently we warn if `debug_assertions` is set, but this isn't always
accurate because debug assertions can be on at higher optimization
levels. Forward some information from the build script and print it to
tell a better story, and update the warning to act on opt-level and
profile rather than `debug_assertions`.
Currently `test-float-parse` is mostly random tests which take a fixed
seed, meaning the same set of values get tested for each invocation.
This isn't ideal because we don't get the true benefit of randomness,
which is to have better coverage over time.

Improve this by using a randomly generated seed, which can also be set
via env. The seed is printed at the beginning of each run so it is easy
to reproduce failures using the same test set, if needed.

Typically it isn't great to have fuzzing randomness in tests that get
run in CI because it can lead to spurious failures. However, this is a
test for which failure should never happen becasue the algorithms are
reasonably well proven, so if one does occur it represents a very
unexpected bug that needs to be addressed. The error message is updated
to strongly recommend reporting before retrying and to include details
on how to reproduce.
@tgross35 tgross35 force-pushed the test-float-parse-updates branch from 5939d5d to b99607f Compare February 14, 2026 02:46
@tgross35
Copy link
Contributor Author

The new version of indicatif pulls in a new wasm dep tree, which we don't really need. Looks like they made these optional in 0.18.4 but it hasn't been released yet console-rs/indicatif#766, so can probably just wait for that.

@rust-log-analyzer
Copy link
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[TIMING:end] tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
fmt: checked 6702 files
tidy check
tidy [deps]: proc-macro crate dependency `unicode-xid` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `ryu` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `wasm-encoder` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `wasm-metadata` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `itoa` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `semver` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `allocator-api2` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `bitflags` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `wasmparser` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `id-arena` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `wit-component` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `anyhow` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `wit-bindgen-rust` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `serde_json` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `prettyplease` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `log` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `leb128fmt` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `wit-parser` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: proc-macro crate dependency `wit-bindgen-core` is not registered in `src/bootstrap/src/utils/proc_macro_deps.rs`
tidy [deps]: Run `./x.py test tidy --bless` to regenerate the list
tidy [deps]: FAIL
tidy [rustdoc_json (src)]: `rustdoc-json-types` modified, checking format version
tidy: Skipping binary file check, read-only filesystem
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
---
info: ES-Check: there were no ES version matching errors!  🎉
typechecking javascript files
tidy: The following check failed: deps
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy --root-path=/checkout --cargo-path=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo --output-dir=/checkout/obj/build --concurrency=4 --npm-path=/node/bin/yarn --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1612:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1365:29

Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:02:58
  local time: Sat Feb 14 02:53:19 UTC 2026
  network time: Sat, 14 Feb 2026 02:53:19 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"

Copy link
Member

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me either way, mostly just nits

View changes since this review

fn main() {
// Forward the opt level so we can warn if the tests are going to be slow.
let opt = env::var("OPT_LEVEL").expect("OPT_LEVEL unset");
let profile = env::var("PROFILE").expect("PROFILE unset");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to tell Cargo that we read these environment variables, or is that assumed?

const SEED: [u8; 32] = *b"3.141592653589793238462643383279";
const SEED_ENV: &str = "TEST_FLOAT_PARSE_SEED";

/// Seed for tests that use a deterministic RNG, and its b64 representation for printing. Taken
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe save the dependency and just hex-dump? Should be fairly easy with something like {:#032x}{:032x} with u128...

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 21, 2026

☔ The latest upstream changes (presumably #152934) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants