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

tests: Port jobserver-error to rmake.rs #135461

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Jan 13, 2025

Part of #121876.

This PR ports tests/run-make/jobserver-error to rmake.rs, and is basically #128789 slightly adjusted. Namely, set_aux_fd is made unsafe, alongside some doc updates.

The complexity involved here is mostly how to get /dev/null/ piping to fd 3 working with std Command, whereas with a shell this is much easier (as is evident with the Makefile version).

Supersedes #128789.
This PR is co-authored with @Oneirical and @coolreader18.

try-job: aarch64-gnu
try-job: i686-gnu-1
try-job: x86_64-gnu-debug
try-job: x86_64-gnu-llvm-18-1

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs A-tidy Area: The tidy tool 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 Jan 13, 2025
@jieyouxu

This comment was marked as off-topic.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 13, 2025
…=<try>

tests: Port `jobserver-error.rs` to rmake.rs

Part of rust-lang#121876.

This PR ports `jobserver-error.rs` to rmake.rs, and is basically rust-lang#128789 slightly adjusted. Namely, `set_aux_fd` is made `unsafe`, alongside some doc updates.

The complexity involved here is mostly how to get `/dev/null/` piping to fd 3 working with std `Command`, whereas with a shell this is much easier (as is evident with the `Makefile` version).

Supersedes rust-lang#128789.
This PR is co-authored with `@Oneirical` and `@coolreader18.`

r? `@ghost`

try-job: aarch64-gnu
try-job: i686-gnu-1
try-job: x86_64-gnu-debug
try-job: x86_64-gnu-llvm-18-1
@bors

This comment was marked as off-topic.

@rust-log-analyzer

This comment was marked as off-topic.

@jieyouxu jieyouxu 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 Jan 13, 2025
@jieyouxu jieyouxu changed the title tests: Port jobserver-error.rs to rmake.rs tests: Port jobserver-error to rmake.rs Jan 13, 2025
@jieyouxu
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Jan 14, 2025

⌛ Trying commit aaddf77 with merge 163ddb1...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 14, 2025
…=<try>

tests: Port `jobserver-error` to rmake.rs

Part of rust-lang#121876.

This PR ports `tests/run-make/jobserver-error` to rmake.rs, and is basically rust-lang#128789 slightly adjusted. Namely, `set_aux_fd` is made `unsafe`, alongside some doc updates.

The complexity involved here is mostly how to get `/dev/null/` piping to fd 3 working with std `Command`, whereas with a shell this is much easier (as is evident with the `Makefile` version).

Supersedes rust-lang#128789.
This PR is co-authored with `@Oneirical` and `@coolreader18.`

r? `@ghost`

try-job: aarch64-gnu
try-job: i686-gnu-1
try-job: x86_64-gnu-debug
try-job: x86_64-gnu-llvm-18-1
@bors
Copy link
Contributor

bors commented Jan 14, 2025

☀️ Try build successful - checks-actions
Build commit: 163ddb1 (163ddb169c67425e679c412d12576fae3f34df92)

@jieyouxu jieyouxu 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 Jan 14, 2025
@jieyouxu jieyouxu marked this pull request as ready for review January 14, 2025 03:06
@jieyouxu jieyouxu closed this Jan 14, 2025
@jieyouxu jieyouxu reopened this Jan 14, 2025
@jieyouxu
Copy link
Member Author

r? compiler

jieyouxu and others added 2 commits January 16, 2025 17:09
Co-authored-by: Noa <coolreader18@gmail.com>
Co-authored-by: Oneirical <manchot@videotron.ca>
Co-authored-by: Noa <coolreader18@gmail.com>
Co-authored-by: Oneirical <manchot@videotron.ca>
@jieyouxu jieyouxu force-pushed the migrate-jobserver-errors branch from aaddf77 to 8c41872 Compare January 16, 2025 09:12
fn main() {
let out = rustc()
.stdin_buf(("fn main() {}").as_bytes())
.env("MAKEFLAGS", "--jobserver-auth=5,5")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.env("MAKEFLAGS", "--jobserver-auth=5,5")
.env("MAKEFLAGS", "--jobserver-auth=1000,1000")

use some higher FDs to guard against rustc using more fds initially

Comment on lines +182 to +183
// The `pre_exec` function should be unconditionally set, since it captures `fd`, and
// this ensures that it stays open until the fork.
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it still be closed once pre_exec returns? I think you need to mem::forget it explicitly.
Personally I would put fd in a ManuallyDrop at the beginning of the function and only work with its RawFd from that point on, that seems less prone to mistakes.

@Noratrieb Noratrieb self-assigned this Jan 19, 2025
@jieyouxu jieyouxu 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 Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs A-tidy Area: The tidy tool 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) 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.

6 participants