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

compiletest: Add a //@ needs-threads directive #122109

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

alexcrichton
Copy link
Member

This commit is extracted from #122036 and adds a new directive to the compiletest test runner, //@ needs-threads. This is intended to capture the need that a target must implement threading to execute a specific test, typically one that uses std::thread. This is primarily done for WebAssembly targets which currently do not have threads by default. This enables transitioning a lot of //@ ignore-wasm*-style ignores into a more self-documenting //@ needs-threads directive. Additionally the wasm32-wasi-preview1-threads target, for example, does actually have threads, but isn't tested in CI at this time. This change enables running these tests for that target, but not other wasm targets.

@rustbot
Copy link
Collaborator

rustbot commented Mar 6, 2024

r? @cjgillot

rustbot has assigned @cjgillot.
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

@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 Mar 6, 2024
This commit is extracted from rust-lang#122036 and adds a new directive to the
`compiletest` test runner, `//@ needs-threads`. This is intended to
capture the need that a target must implement threading to execute a
specific test, typically one that uses `std::thread`. This is primarily
done for WebAssembly targets which currently do not have threads by
default. This enables transitioning a lot of `//@ ignore-wasm*`-style
ignores into a more self-documenting `//@ needs-threads` directive.
Additionally the `wasm32-wasi-preview1-threads` target, for example,
does actually have threads, but isn't tested in CI at this time. This
change enables running these tests for that target, but not other wasm
targets.
@workingjubilee
Copy link
Contributor

cc @jieyouxu

Comment on lines +457 to +459
if self.target.starts_with("wasm") {
return self.target.contains("threads");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

For some reason this implementation deeply amuses me. Perhaps because I am also wondering if this will be true by the time wasip3 is a thing?

Well, we can cross that bridge when we come to it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Heh true! With recent proposals as well I think it's safe to say wasm-and-threads is still an active-design space and it's not clear how it's going to all pan out. Hopefully though this is the "One Place" to modify to get some tests up and running though for the future

@workingjubilee
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 6, 2024

📌 Commit 75fa9f6 has been approved by workingjubilee

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 Mar 6, 2024
@workingjubilee workingjubilee self-assigned this Mar 6, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#122015 (Add better explanation for `rustc_index::IndexVec`)
 - rust-lang#122061 (Clarify FatalErrorHandler)
 - rust-lang#122062 (Explicitly assign constructed C++ classes)
 - rust-lang#122072 (Refer to "slice" instead of "vector" in Ord and PartialOrd trait impl of slices)
 - rust-lang#122088 (Remove unnecessary fixme on new thread stack size)
 - rust-lang#122094 (Remove outdated footnote "missing-stack-probe" in platform-support)
 - rust-lang#122107 (Temporarily make allow-by-default the `non_local_definitions` lint)
 - rust-lang#122109 (compiletest: Add a `//@ needs-threads` directive)

Failed merges:

 - rust-lang#122104 (Rust is a proper name: rust → Rust)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5642b04 into rust-lang:master Mar 7, 2024
11 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2024
Rollup merge of rust-lang#122109 - alexcrichton:compiletests-needs-threads, r=workingjubilee

compiletest: Add a `//@ needs-threads` directive

This commit is extracted from rust-lang#122036 and adds a new directive to the `compiletest` test runner, `//@ needs-threads`. This is intended to capture the need that a target must implement threading to execute a specific test, typically one that uses `std::thread`. This is primarily done for WebAssembly targets which currently do not have threads by default. This enables transitioning a lot of `//@ ignore-wasm*`-style ignores into a more self-documenting `//@ needs-threads` directive. Additionally the `wasm32-wasi-preview1-threads` target, for example, does actually have threads, but isn't tested in CI at this time. This change enables running these tests for that target, but not other wasm targets.
@rustbot rustbot added this to the 1.78.0 milestone Mar 7, 2024
@alexcrichton alexcrichton deleted the compiletests-needs-threads branch March 7, 2024 02:31
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.

None yet

5 participants