Skip to content
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

Make compiletest aware of targets without dynamic linking #112454

Merged
merged 3 commits into from
Jun 28, 2023

Conversation

pietroalbini
Copy link
Member

Some parts of the compiletest internals and some tests require dynamic linking to work, which is not supported by all targets. Before this PR, this was handled by if branches matching on the target name.

This PR loads whether a target supports dynamic linking or not from the target spec, and adds a // needs-dynamic-linking attribute for tests that require it. Note that I was not able to replace all the old conditions based on the target name, as some targets have dynamic_linking: true in their spec but pretend they don't have it in compiletest.

Also, to get this to work I had to partially revert #111472 (cc @djkoloski @tmandry @bjorn3). On one hand, only the target spec contains whether a target supports dynamic linking, but on the other hand a subset of the fields can be overridden through -C flags (as far as I'm aware only -C panic=$strategy). The solution I came up with is to take the target spec as the base, and then override the panic strategy based on --print=cfg. Hopefully that should not break y'all again.

@rustbot
Copy link
Collaborator

rustbot commented Jun 9, 2023

r? @compiler-errors

(rustbot has picked a reviewer for you, use r? to override)

@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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 9, 2023
@pietroalbini pietroalbini force-pushed the pa-compiletest-dynamic-linking branch from 7b818da to 53f96bb Compare June 9, 2023 10:36
@djkoloski
Copy link
Contributor

This should be fine for us!

@pietroalbini pietroalbini force-pushed the pa-compiletest-dynamic-linking branch 2 times, most recently from 4b74ffa to de7eecf Compare June 14, 2023 10:43
@bors
Copy link
Contributor

bors commented Jun 14, 2023

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

@compiler-errors
Copy link
Member

r? compiler

@rustbot rustbot assigned davidtwco and unassigned compiler-errors Jun 15, 2023
@pietroalbini pietroalbini force-pushed the pa-compiletest-dynamic-linking branch from de7eecf to 767c4b9 Compare June 20, 2023 15:21
@pietroalbini
Copy link
Member Author

Rebased to fix conflict.

@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 27, 2023

📌 Commit 767c4b9 has been approved by davidtwco

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 27, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 27, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#112207 (Add trustzone and virtualization target features for aarch32.)
 - rust-lang#112454 (Make compiletest aware of targets without dynamic linking)
 - rust-lang#112628 (Allow comparing `Box`es with different allocators)
 - rust-lang#112692 (Provide more context for `rustc +nightly -Zunstable-options` on stable)
 - rust-lang#112972 (Make `UnwindAction::Continue` explicit in MIR dump)
 - rust-lang#113020 (Add tests impl via obj unless denied)
 - rust-lang#113084 (Simplify some conditions)
 - rust-lang#113103 (Normalize types when applying uninhabited predicate.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 353dd71 into rust-lang:master Jun 28, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 28, 2023
@oli-obk
Copy link
Contributor

oli-obk commented Jun 28, 2023

Did this break running mir-opt tests locally? I am getting

Testing stage1 compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu -> i686-unknown-linux-gnu-synthetic-miropt-abort(/home/ubuntu/rust12/build/synthetic-target-specs/i686-unknown-linux-gnu-synthetic-miropt-abort.json))
thread 'main' panicked at 'target /home/ubuntu/rust12/build/synthetic-target-specs/i686-unknown-linux-gnu-synthetic-miropt-abort.json is not part of [

after I rebased today

@pietroalbini pietroalbini deleted the pa-compiletest-dynamic-linking branch June 30, 2023 11:04
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 30, 2023
…i-obk

Fix loading target specs in compiletest not working with custom targets

In rust-lang#112454 (comment) it was pointed out that the PR broke blessing mir-opt tests. Since rust-lang#112418, blessing mir-opt tests generates "synthetic targets", which are custom target specs. Those specs are not included in `--print=all-target-specs-json`, and rust-lang#112454 required that the current target was returned by that flag.

This PR fixes the breakage by loading the target spec for the current target explicitly, if a custom target is detected.

r? `@oli-obk`
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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

8 participants