Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8f00fbe

Browse files
jieyouxucoolreader18Oneirical
committedJan 22, 2025
tests: port jobserver-error.rs to rmake.rs
Co-authored-by: Noa <coolreader18@gmail.com> Co-authored-by: Oneirical <manchot@videotron.ca>
1 parent 2b9140d commit 8f00fbe

File tree

4 files changed

+48
-19
lines changed

4 files changed

+48
-19
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
run-make/cat-and-grep-sanity-check/Makefile
2-
run-make/jobserver-error/Makefile
32
run-make/split-debuginfo/Makefile
43
run-make/symbol-mangling-hashed/Makefile
54
run-make/translation/Makefile

‎tests/run-make/jobserver-error/Makefile

-17
This file was deleted.

‎tests/run-make/jobserver-error/cannot_open_fd.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: failed to connect to jobserver from environment variable `MAKEFLAGS="--jobserver-auth=5,5"`: cannot open file descriptor 5 from the jobserver environment variable value: Bad file descriptor (os error 9)
1+
warning: failed to connect to jobserver from environment variable `MAKEFLAGS="--jobserver-auth=1000,1000"`: cannot open file descriptor 1000 from the jobserver environment variable value: Bad file descriptor (os error 9)
22
|
33
= note: the build environment is likely misconfigured
44

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// ignore-tidy-linelength
2+
//! If the environment variables contain an invalid `jobserver-auth`, this used to cause an ICE
3+
//! until this was fixed in [do not panic on failure to acquire jobserver token
4+
//! #109694](https://github.com/rust-lang/rust/pull/109694).
5+
//!
6+
//! Proper handling has been added, and this test checks that helpful warnings and errors are
7+
//! printed instead in case of a wrong jobserver. See
8+
//! <https://github.com/rust-lang/rust/issues/46981>.
9+
10+
//@ only-linux
11+
//@ ignore-cross-compile
12+
13+
#![deny(warnings)]
14+
15+
use run_make_support::{diff, rustc};
16+
17+
fn main() {
18+
let out = rustc()
19+
.stdin_buf(("fn main() {}").as_bytes())
20+
.env("MAKEFLAGS", "--jobserver-auth=1000,1000")
21+
.run_fail()
22+
.stderr_utf8();
23+
diff().expected_file("cannot_open_fd.stderr").actual_text("actual", out).run();
24+
25+
let out = rustc()
26+
.stdin_buf(("fn main() {}").as_bytes())
27+
.input("-")
28+
.env("MAKEFLAGS", "--jobserver-auth=3,3")
29+
.set_aux_fd(3, std::fs::File::open("/dev/null").unwrap())
30+
.run()
31+
.stderr_utf8();
32+
diff().expected_file("not_a_pipe.stderr").actual_text("actual", out).run();
33+
34+
// FIXME(#110321): the Makefile version had a disabled check:
35+
//
36+
// ```makefile
37+
// bash -c 'echo "fn main() {}" | MAKEFLAGS="--jobserver-auth=3,3" $(RUSTC) - 3< <(cat /dev/null)' 2>&1 | diff poisoned_pipe.stderr -
38+
// ```
39+
//
40+
// > the jobserver helper thread launched here gets starved out and doesn't run, while the
41+
// > coordinator thread continually processes work using the implicit jobserver token, never
42+
// > yielding long enough for the jobserver helper to do its work (and process the error).
43+
//
44+
// but is not necessarily worth fixing as it might require changing coordinator behavior that
45+
// might regress performance. See discussion at
46+
// <https://github.com/rust-lang/rust/issues/110321#issuecomment-1636914956>.
47+
}

0 commit comments

Comments
 (0)
Failed to load comments.