Skip to content

Commit

Permalink
rewrite jobserver-error to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Aug 7, 2024
1 parent 9bad7ba commit 484fa0e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ run-make/emit-to-stdout/Makefile
run-make/extern-fn-reachable/Makefile
run-make/incr-add-rust-src-component/Makefile
run-make/issue-84395-lto-embed-bitcode/Makefile
run-make/jobserver-error/Makefile
run-make/libs-through-symlinks/Makefile
run-make/libtest-json/Makefile
run-make/libtest-junit/Makefile
Expand Down
17 changes: 0 additions & 17 deletions tests/run-make/jobserver-error/Makefile

This file was deleted.

40 changes: 40 additions & 0 deletions tests/run-make/jobserver-error/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// If the environment variables contain an invalid `jobserver-auth`, this used
// to cause an ICE (internal compiler error) until this was fixed in #109694.
// Proper handling has been added, and this test checks that helpful warnings
// and errors are printed instead in case of a wrong jobserver.
// See https://github.com/rust-lang/rust/issues/46981

// FIXME(Oneirical): The original test included this memo:
// # Note that by default, the compiler uses file descriptors 0 (stdin), 1 (stdout), 2 (stderr),
// # but also 3 and 4 for either end of the ctrl-c signal handler self-pipe.

// FIXME(Oneirical): only-linux ignore-cross-compile

use run_make_support::{diff, rfs, rustc};

fn main() {
let out = rustc()
.stdin("fn main() {}")
.env("MAKEFLAGS", "--jobserver-auth=5,5")
.run_fail()
.stderr_utf8();
diff().expected_file("cannot_open_fd.stderr").actual_text("actual", out).run();
// FIXME(Oneirical): Find how to use file descriptor "3" with run-make-support
// and pipe /dev/null into it.
// Original lines:
//
// bash -c 'echo "fn main() {}" | makeflags="--jobserver-auth=3,3" $(rustc) - 3</dev/null' \

Check failure on line 26 in tests/run-make/jobserver-error/rmake.rs

View workflow job for this annotation

GitHub Actions / PR - mingw-check-tidy

tab character
// 2>&1 | diff not_a_pipe.stderr -
// # this test randomly fails, see https://github.com/rust-lang/rust/issues/110321
// disabled:
// bash -c 'echo "fn main() {}" | makeflags="--jobserver-auth=3,3" $(rustc) - \

Check failure on line 30 in tests/run-make/jobserver-error/rmake.rs

View workflow job for this annotation

GitHub Actions / PR - mingw-check-tidy

tab character
// 3< <(cat /dev/null)' 2>&1 | diff poisoned_pipe.stderr -
//
// let out = rustc()
// .stdin("fn main() {}")
// .input("-")
// .env("MAKEFLAGS", "--jobserver-auth=0,0")
// .run()
// .stderr_utf8();
// diff().expected_file("not_a_pipe.stderr").actual_text("actual", out).run();
}

0 comments on commit 484fa0e

Please sign in to comment.