Skip to content

forward the bootstrap runner to run-make #141856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

folkertdev
Copy link
Contributor

@folkertdev folkertdev commented Jun 1, 2025

The runner was already forwarded to compiletest, this just passes it on to run-make and uses it in the run functions.

The configuration can look like this

# in bootstrap.toml
[target.s390x-unknown-linux-gnu]
runner = "qemu-s390x -L /usr/s390x-linux-gnu"

Any C compilation automatically sets the correct target. Calls to rustc must use .target(target()). Then, a command like below will work by cross-compiling to the given target, and using the given runner for that target to execute the binary:

./x test tests/run-make/c-link-to-rust-va-list-fn --target s390x-unknown-linux-gnu

The runner can also be used for e.g. running with valgrind.

This PR also enables its use in the test case that I care about, hopefully that actually does work on the platforms that CI uses. We should probably run some try jobs to be sure?

r? @jieyouxu

try-job: test-various
try-job: armhf-gnu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 1, 2025

Some changes occurred in src/tools/compiletest

cc @jieyouxu

This PR modifies run-make tests.

cc @jieyouxu

The run-make-support library was changed

cc @jieyouxu

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, one nit

@jieyouxu
Copy link
Member

jieyouxu commented Jun 1, 2025

This PR also enables its use in the test case that I care about, hopefully that actually does work on the platforms that CI uses. We should probably run some try jobs to be sure?

Do you happen to know which CI jobs? armhf-gnu?

@folkertdev folkertdev force-pushed the run-make-forward-compiletest-runner branch from 3f206ce to ab6646a Compare June 1, 2025 13:39
@folkertdev
Copy link
Contributor Author

I really don't know what cross-compilation actually happens in our CI and would run this run-make test. I've locally run this test for powerpc and s390x. Testing it with a 32-bit arm sounds like a good idea at least.

@jieyouxu
Copy link
Member

jieyouxu commented Jun 1, 2025

Let's give it a try.
@bors try

bors added a commit that referenced this pull request Jun 1, 2025
…r, r=<try>

forward the bootstrap `runner` to `run-make`

The runner was already forwarded to `compiletest`, this just passes it on to `run-make` and uses it in the `run` functions.

The configuration can look like this

```toml
# in bootstrap.toml
[target.s390x-unknown-linux-gnu]
runner = "qemu-s390x -L /usr/s390x-linux-gnu"
```

Any C compilation automatically sets the correct target. Calls to rustc must use `.target(target())`. Then, a command like below will work by cross-compiling to the given target, and using the given runner for that target to execute the binary:

```
./x test tests/run-make/c-link-to-rust-va-list-fn --target s390x-unknown-linux-gnu
```

The runner can also be used for e.g. running with `valgrind`.

This PR also enables its use in the test case that I care about, hopefully that actually does work on the platforms that CI uses. We should probably run some try jobs to be sure?

r? `@jieyouxu`

try-job: test-various
try-job: armhf-gnu
@bors
Copy link
Collaborator

bors commented Jun 1, 2025

⌛ Trying commit ab6646a with merge 1d3fe3c...

@jieyouxu
Copy link
Member

jieyouxu commented Jun 1, 2025

Reminder (for myself): if try job fails, use @bors2 try to try out new bors

@rust-bors
Copy link

rust-bors bot commented Jun 1, 2025

Unknown command "try`".

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 1, 2025

💔 Test failed - checks-actions

@bors bors 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 Jun 1, 2025
@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Member

jieyouxu commented Jun 1, 2025

You probably need sth like //@ ignore-unknown (needs target std)

@folkertdev
Copy link
Contributor Author

Hmm, that directive is never actually used, and also does not solve the issue for that target. It is a known target, just not one that has std (just core I assume). None of the directives in the list seem to really capture this? Maybe needs-threads is a decent proxy but that's not ideal.

@jieyouxu
Copy link
Member

jieyouxu commented Jun 1, 2025

Yeah, a proper fix is sth like //@ needs-std, but for this PR, //@ ignore-none is a proxy for ignoring the *-unknown targets. I suppose //@ ignore-nvptx is better tho.

EDIT: opened #141863

@jieyouxu
Copy link
Member

jieyouxu commented Jun 1, 2025

Hmm, that directive is never actually used, and also does not solve the issue for that target. It is a known target, just not one that has std (just core I assume). None of the directives in the list seem to really capture this? Maybe needs-threads is a decent proxy but that's not ideal.

(Sorry, I wrote //@ ignore-unknown but I meant //@ ignore-none as a temporary directive to unblock this PR)

@folkertdev
Copy link
Contributor Author

Apparently you need to explicitly exluce nvptx (several other tests do this).

//@ ignore-none
// Reason: no-std is not supported
//@ ignore-nvptx64-nvidia-cuda
// Reason: can't find crate for 'std'

@folkertdev folkertdev force-pushed the run-make-forward-compiletest-runner branch from ab6646a to e3fee6a Compare June 1, 2025 15:52
@jieyouxu
Copy link
Member

jieyouxu commented Jun 1, 2025

Right. Because the nvptx64 target doesn't have a none in target name...

@rust-log-analyzer

This comment has been minimized.

@folkertdev folkertdev closed this Jun 1, 2025
@folkertdev folkertdev reopened this Jun 1, 2025
@folkertdev
Copy link
Contributor Author

@jieyouxu can you rerun the try jobs here?

@jieyouxu
Copy link
Member

jieyouxu commented Jun 2, 2025

Sure.
@bors2 try

@rust-bors

This comment was marked as off-topic.

rust-bors bot added a commit that referenced this pull request Jun 2, 2025
…r, r=<try>

forward the bootstrap `runner` to `run-make`

The runner was already forwarded to `compiletest`, this just passes it on to `run-make` and uses it in the `run` functions.

The configuration can look like this

```toml
# in bootstrap.toml
[target.s390x-unknown-linux-gnu]
runner = "qemu-s390x -L /usr/s390x-linux-gnu"
```

Any C compilation automatically sets the correct target. Calls to rustc must use `.target(target())`. Then, a command like below will work by cross-compiling to the given target, and using the given runner for that target to execute the binary:

```
./x test tests/run-make/c-link-to-rust-va-list-fn --target s390x-unknown-linux-gnu
```

The runner can also be used for e.g. running with `valgrind`.

This PR also enables its use in the test case that I care about, hopefully that actually does work on the platforms that CI uses. We should probably run some try jobs to be sure?

r? `@jieyouxu`

try-job: test-various
try-job: armhf-gnu
@rust-bors

This comment was marked as off-topic.

@jieyouxu
Copy link
Member

jieyouxu commented Jun 2, 2025

@bors2 try

@rust-bors
Copy link

rust-bors bot commented Jun 2, 2025

⌛ Trying commit e3fee6a with merge 6deab9d

rust-bors bot added a commit that referenced this pull request Jun 2, 2025
…r, r=<try>

forward the bootstrap `runner` to `run-make`

The runner was already forwarded to `compiletest`, this just passes it on to `run-make` and uses it in the `run` functions.

The configuration can look like this

```toml
# in bootstrap.toml
[target.s390x-unknown-linux-gnu]
runner = "qemu-s390x -L /usr/s390x-linux-gnu"
```

Any C compilation automatically sets the correct target. Calls to rustc must use `.target(target())`. Then, a command like below will work by cross-compiling to the given target, and using the given runner for that target to execute the binary:

```
./x test tests/run-make/c-link-to-rust-va-list-fn --target s390x-unknown-linux-gnu
```

The runner can also be used for e.g. running with `valgrind`.

This PR also enables its use in the test case that I care about, hopefully that actually does work on the platforms that CI uses. We should probably run some try jobs to be sure?

r? `@jieyouxu`

try-job: test-various
try-job: armhf-gnu
@rust-bors
Copy link

rust-bors bot commented Jun 2, 2025

💔 Test failed

@jieyouxu
Copy link
Member

jieyouxu commented Jun 2, 2025

Hmm

2025-06-02T12:31:25.8166441Z error: linking with `rust-lld` failed: exit status: 1
2025-06-02T12:31:25.8166509Z   |
2025-06-02T12:31:25.8168630Z   = note:  "rust-lld" "-flavor" "wasm" "--export" "foo" "-z" "stack-size=1048576" "--stack-first" "--allow-undefined" "--no-demangle" "<2 object files omitted>" "<sysroot>/lib/rustlib/wasm32-wasip1/lib/{libstd-*,libpanic_abort-*,libwasi-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*}.rlib" "-l" "c" "<sysroot>/lib/rustlib/wasm32-wasip1/lib/{liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/wasm-symbols-not-exported/rmake_out" "-L" "<sysroot>/lib/rustlib/wasm32-wasip1/lib/self-contained" "-o" "foo.wasm" "--gc-sections" "--no-entry" "-O0"
2025-06-02T12:31:25.8168950Z   = note: some arguments are omitted. use `--verbose` to show all linker arguments
2025-06-02T12:31:25.8169068Z   = note: rust-lld: error: unable to find library -lc

The runner was already forwarded to `compiletest`, this just passes it on to `run-make` and uses it in the `run` functions.
@folkertdev
Copy link
Contributor Author

That is weird, it does work for me locally:

> WASI_SDK_PATH="~/Downloads/wasi-sdk-24.0-x86_64-linux" ./x test tests/run-make/c-link-to-rust-va-list-fn --target wasm32-wasip1

...

Testing stage1 compiletest suite=run-make mode=run-make (x86_64-unknown-linux-gnu -> wasm32-wasip1)

running 1 tests

.

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 401 filtered out; finished in 348.41ms

Should we investigate that further, or just ignore wasm32 and wasm64 for now?

@jieyouxu
Copy link
Member

jieyouxu commented Jun 2, 2025

Should we investigate that further, or just ignore wasm32 and wasm64 for now?

That's a lot of tests, I don't particularly want to regress them like this. I'll try to take a look tmrw.

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 2, 2025
@folkertdev
Copy link
Contributor Author

Oh right, the test that I adjusted actually passes, but a bunch of others don't for a variety of reasons. That is really strange, the only thing that change there (I think) is that maybe the runner is set based on bootstrap.toml or other arguments to compiletest.

So the lld thing is weird, but these are even weirder: from alloc-no-oom-handling:

stdout: none
--- stderr -------------------------------
command failed at line 14
Command { cmd: LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/alloc-no-oom-handling/rmake_out:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/alloc-no-oom-handling/rmake_out" "--edition" "2021" "-Dwarnings" "--crate-type" "rlib" "/checkout/library/alloc/src/lib.rs" "--cfg" "no_global_oom_handling", stdin_buf: None, stdin: None, stdout: None, stderr: None, drop_bomb: DropBomb { command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc", defused: true, armed_location: Location { file: "/checkout/tests/run-make/alloc-no-oom-handling/rmake.rs", line: 8, col: 5 } }, already_executed: true }
output status: `exit status: 1`
=== STDOUT ===



=== STDERR ===
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-unknown-linux-gnu` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-unknown-linux-gnu`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0463`.

One difference I'm seeing is that locally I use stage1 but CI uses stage2. I don't see why that would matter though. In any case I'll push a rebase with the new stage0 machinery.

@folkertdev folkertdev force-pushed the run-make-forward-compiletest-runner branch from e3fee6a to 272dfe8 Compare June 2, 2025 17:24
@jieyouxu
Copy link
Member

jieyouxu commented Jun 4, 2025

(A bit caught up with other things, I'll take a look on Saturday.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants