Skip to content

bootstrap: Let test-float-parse follow --target - #162934

Open
mattst88 wants to merge 2 commits into
rust-lang:mainfrom
mattst88:test-float-parse-target
Open

mattst88 wants to merge 2 commits into
rust-lang:mainfrom
mattst88:test-float-parse-target

Conversation

@mattst88

Copy link
Copy Markdown

TestFloatParse declared IS_HOST = true, so it took --host and ignored
--target. The step tests std's float parsing, so it should follow --target
like any other std test. Today

./x test src/tools/test-float-parse --target <cross target>

tests the host and reports a pass without exercising the target at all.

First commit is preparation with no functional change: run the tool through the
target's configured runner, and start the emulator or remote test server when
the target needs one. Second commit flips IS_HOST and skips targets that have
no std or whose binaries we cannot run.

This has a cost worth flagging. The step is a default step, so the
test-armhf-gnu job will now run the tests under QEMU. It passes
--host= --target arm-unknown-linux-gnueabihf and so skipped the step
entirely. I measured 35 minutes with qemu-user and the single thread that job's
emulator gives us; qemu-system-arm on CI will be slower. 90% of it is the f32
and f64 subnormal generators, so excluding those two would recover most of it
if the added time is not acceptable.

Only the unit tests went through prepare_cargo_test, which sets
CARGO_TARGET_<triple>_RUNNER. The parse tests are run by a separate
`cargo run` invocation, which did not, so cargo would have tried to
execute a cross-compiled binary natively.

Extract the runner setup so both invocations share it, and ensure
RemoteCopyLibs so that the emulator or remote test server is actually
running by the time cargo needs it.

No functional change yet: the step still takes --host, so its target is
always the host.
TestFloatParse declared IS_HOST = true, so it took --host and ignored
--target. The step tests std's float parsing, so it should follow
--target like any other std test. Running

    ./x test src/tools/test-float-parse --target <cross target>

previously tested the host and reported a pass without exercising the
target at all.

The tool itself still runs on the host, so take the build compiler from
--host rather than --target. get_compiler_to_test() names that parameter
`target`, which is what made this easy to get wrong; rename it to `host`.

Skip targets that have no std, and targets whose binaries we have no way
to run, announcing the skip as the other test steps do. The predicate for
the latter is shared as Session::can_run_binaries(), since it is not
specific to this step.

The step is a default step, so this also means a plain
./x test --target <cross target> now selects it. Notably, the
test-armhf-gnu CI job passes --host= --target arm-unknown-linux-gnueabihf
and so skipped this step entirely; it will now run the tests under QEMU.
That costs 35 minutes under qemu-user with the single thread the job's
emulator gives us, 90% of it in the f32 and f64 subnormal generators;
CI's qemu-system-arm will be slower still.
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc 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 Sep 18, 2026
@rustbot

rustbot commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @Mark-Simulacrum (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions and our LLM policy for more information.

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

@mattst88

Copy link
Copy Markdown
Author

Hey, this is my first contribution and something that I noticed when working on adding support for a new architecture to Rust. I'm not confident that this is correct (or desirable... see the note about the execution time under qemu). Feel free to say this is garbage and close it :)

@Zalathar

Copy link
Copy Markdown
Member

@bors try jobs=test-armhf-gnu

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 18, 2026
bootstrap: Let test-float-parse follow --target


try-job: test-armhf-gnu

@Kobzol Kobzol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The change seems reasonable, though using LLMs to modify non-trivial bootstrap code feels iffy.

Let's see how long CI takes.

View changes since this review

let target = run.target;

// The tool needs std, and it is executed on `target`.
if builder.no_std(target) == Some(true) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note: the no_std function is far from being the ground truth on whether the target actually has a standard library or not.

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 18, 2026
@rust-bors

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

💔 Test for de16f0e failed: CI. Failed job:

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-armhf-gnu failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

running 6 tests
test validate::tests::test_decode ... ok
test validate::tests::test_parse_rational ... ok
validate::tests invoked oom-killer: gfp_mask=0x14200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null),  order=0, oom_score_adj=0
validate::tests cpuset=/ mems_allowed=0
CPU: 0 PID: 26026 Comm: validate::tests Not tainted 4.14.336 #1
Hardware name: ARM-Versatile Express
[<8010ea04>] (unwind_backtrace) from [<8010ae10>] (show_stack+0x10/0x14)
[<8010ae10>] (show_stack) from [<806e1354>] (dump_stack+0x8c/0xa0)
[<806e1354>] (dump_stack) from [<806dd4f4>] (dump_header.constprop.0+0x94/0x1b4)
[<806dd4f4>] (dump_header.constprop.0) from [<801e8358>] (oom_kill_process+0x198/0x510)
[<801e8358>] (oom_kill_process) from [<801e8e68>] (out_of_memory+0x1d0/0x40c)
[<801e8e68>] (out_of_memory) from [<801ee358>] (__alloc_pages_nodemask+0xe70/0x112c)
[<801ee358>] (__alloc_pages_nodemask) from [<8021721c>] (handle_mm_fault+0x3dc/0xa08)
[<8021721c>] (handle_mm_fault) from [<80112dfc>] (do_page_fault+0x114/0x394)
[<80112dfc>] (do_page_fault) from [<80101330>] (do_DataAbort+0x3c/0xbc)
[<80101330>] (do_DataAbort) from [<8010bc9c>] (__dabt_usr+0x3c/0x40)
Exception stack(0x8b751fb0 to 0x8b751ff8)
1fa0:                                     3d79f370 0000165d 00000641 3d79f368
1fc0: 76200018 00001658 3d7a09c0 00001c99 3d79f368 00001668 76e9e000 000a1000
1fe0: 00598e3c 7677ae58 76de77c5 76de7628 80070030 ffffffff
Mem-Info:
active_anon:235362 inactive_anon:0 isolated_anon:0
 active_file:0 inactive_file:0 isolated_file:0
 unevictable:17775 dirty:0 writeback:0 unstable:0
 slab_reclaimable:1283 slab_unreclaimable:820
 mapped:1043 shmem:0 pagetables:489 bounce:0
 free:899 free_pcp:43 free_cma:0
Node 0 active_anon:941448kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:71100kB isolated(anon):0kB isolated(file):0kB mapped:4172kB dirty:0kB writeback:0kB shmem:0kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no
Normal free:3596kB min:3940kB low:4924kB high:5908kB active_anon:941160kB inactive_anon:0kB active_file:328kB inactive_file:100kB unevictable:71064kB writepending:0kB present:1048576kB managed:1030552kB mlocked:0kB kernel_stack:352kB pagetables:1956kB bounce:0kB free_pcp:172kB local_pcp:172kB free_cma:0kB
lowmem_reserve[]: 0 0
Normal: 1*4kB (M) 1*8kB (M) 0*16kB 0*32kB 0*64kB 2*128kB (UM) 1*256kB (U) 2*512kB (UM) 2*1024kB (UM) 0*2048kB 0*4096kB = 3596kB
17778 total pagecache pages
0 pages in swap cache
Swap cache stats: add 0, delete 0, find 0/0
Free swap  = 0kB
Total swap = 0kB
262144 pages RAM
0 pages HighMem/MovableOnly
4506 pages reserved
0 pages cma reserved
[ pid ]   uid  tgid total_vm      rss nr_ptes nr_pmds swapents oom_score_adj name
[  759]     0   759     5228      328      13       0        0             0 testd
[  760]     0   760      448       15       2       0        0             0 init
[  761]     0   761      448       15       2       0        0             0 init
[  762]     0   762      448       15       2       0        0             0 init
[  763]     0   763      448       15       2       0        0             0 init
[26021]     0 26021   238603   235445     470       0        0             0 test_float_pars
Out of memory: Kill process 26021 (test_float_pars) score 888 or sacrifice child
Killed process 26021 (test_float_pars) total-vm:954412kB, anon-rss:940692kB, file-rss:1088kB, shmem-rss:0kB
oom_reaper: reaped process 26021 (test_float_pars), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
died due to signal 9
error: test failed, to rerun pass `--lib`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-client run 0 /checkout/obj/build/x86_64-unknown-linux-gnu/stage3-tools/arm-unknown-linux-gnueabihf/release/build/test-float-parse/0f98e1569fb47e9f/out/test_float_parse-0f98e1569fb47e9f -Z unstable-options --format json` (exit status: 137)
note: test exited abnormally; to see the full output pass --no-capture to the harness.
Bootstrap failed while executing `--stage 2 test --host= --target arm-unknown-linux-gnueabihf`
Currently active steps:
test::TestFloatParse { build_compiler: Compiler { stage: 2, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: arm-unknown-linux-gnueabihf } at src/bootstrap/src/core/build_steps/test.rs:4635
Build completed unsuccessfully in 1:15:07
  local time: Fri Sep 18 08:07:20 UTC 2026

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

Labels

A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

6 participants