|
| 1 | +// If the environment variables contain an invalid `jobserver-auth`, this used |
| 2 | +// to cause an ICE (internal compiler error) until this was fixed in #109694. |
| 3 | +// Proper handling has been added, and this test checks that helpful warnings |
| 4 | +// and errors are printed instead in case of a wrong jobserver. |
| 5 | +// See https://github.com/rust-lang/rust/issues/46981 |
| 6 | + |
| 7 | +// FIXME(Oneirical): The original test included this memo: |
| 8 | +// # Note that by default, the compiler uses file descriptors 0 (stdin), 1 (stdout), 2 (stderr), |
| 9 | +// # but also 3 and 4 for either end of the ctrl-c signal handler self-pipe. |
| 10 | + |
| 11 | +// FIXME(Oneirical): only-linux ignore-cross-compile |
| 12 | + |
| 13 | +use run_make_support::{diff, rfs, rustc}; |
| 14 | + |
| 15 | +fn main() { |
| 16 | + let out = rustc() |
| 17 | + .stdin("fn main() {}") |
| 18 | + .env("MAKEFLAGS", "--jobserver-auth=5,5") |
| 19 | + .run_fail() |
| 20 | + .stderr_utf8(); |
| 21 | + diff().expected_file("cannot_open_fd.stderr").actual_text("actual", out).run(); |
| 22 | + // FIXME(Oneirical): Find how to use file descriptor "3" with run-make-support |
| 23 | + // and pipe /dev/null into it. |
| 24 | + // Original lines: |
| 25 | + // |
| 26 | + // bash -c 'echo "fn main() {}" | makeflags="--jobserver-auth=3,3" $(rustc) - 3</dev/null' \ |
| 27 | + // 2>&1 | diff not_a_pipe.stderr - |
| 28 | + // # this test randomly fails, see https://github.com/rust-lang/rust/issues/110321 |
| 29 | + // disabled: |
| 30 | + // bash -c 'echo "fn main() {}" | makeflags="--jobserver-auth=3,3" $(rustc) - \ |
| 31 | + // 3< <(cat /dev/null)' 2>&1 | diff poisoned_pipe.stderr - |
| 32 | + // |
| 33 | + // let out = rustc() |
| 34 | + // .stdin("fn main() {}") |
| 35 | + // .input("-") |
| 36 | + // .env("MAKEFLAGS", "--jobserver-auth=0,0") |
| 37 | + // .run() |
| 38 | + // .stderr_utf8(); |
| 39 | + // diff().expected_file("not_a_pipe.stderr").actual_text("actual", out).run(); |
| 40 | +} |
0 commit comments