Skip to content

Commit 766dcf1

Browse files
committed
Provide a more helpful error for tests that fail due to noexec
The rustdoc tests create and execute a file in a temporary directory. By default on UNIX-like platforms this is in `/tmp`, which some users mount with the `noexec` option. In those cases, the tests fail in a mysterious way. This change adds a note that suggests what the problem might be, if the error looks like it could have been caused by the `noexec` setup. Closes #12558
1 parent b4d9238 commit 766dcf1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustdoc/test.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
use std::cell::RefCell;
12+
use std::io;
1213
use std::io::Process;
1314
use std::local_data;
1415
use std::os;
@@ -128,7 +129,10 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool)
128129
let exe = outdir.path().join("rust_out");
129130
let out = Process::output(exe.as_str().unwrap(), []);
130131
match out {
131-
Err(e) => fail!("couldn't run the test: {}", e),
132+
Err(e) => fail!("couldn't run the test: {}{}", e,
133+
if e.kind == io::PermissionDenied {
134+
" - maybe your tempdir is mounted with noexec?"
135+
} else { "" }),
132136
Ok(out) => {
133137
if should_fail && out.status.success() {
134138
fail!("test executable succeeded when it should have failed");

0 commit comments

Comments
 (0)