Conversation
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.
|
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:
|
|
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 :) |
|
@bors try jobs=test-armhf-gnu |
This comment has been minimized.
This comment has been minimized.
bootstrap: Let test-float-parse follow --target try-job: test-armhf-gnu
| let target = run.target; | ||
|
|
||
| // The tool needs std, and it is executed on `target`. | ||
| if builder.no_std(target) == Some(true) { |
There was a problem hiding this comment.
Note: the no_std function is far from being the ground truth on whether the target actually has a standard library or not.
|
💔 Test for de16f0e failed: CI. Failed job:
|
|
The job Click to see the possible cause of the failure (guessed by this bot) |
TestFloatParsedeclaredIS_HOST = true, so it took--hostand ignored--target. The step tests std's float parsing, so it should follow--targetlike any other std test. Today
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_HOSTand skips targets that haveno 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-gnueabihfand so skipped the stepentirely. 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.