Skip to content

Commit 9a3258f

Browse files
committed
Auto merge of rust-lang#110801 - WaffleLapkin:io-tests, r=jyn514
Fix `ui/io-checks/inaccessbile-temp-dir.rs` test Fixes rust-lang#110794 r? `@jyn514`
2 parents 1a6ae3d + 1d847b8 commit 9a3258f

File tree

6 files changed

+38
-56
lines changed

6 files changed

+38
-56
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# only-linux
2+
# ignore-arm - linker error on `armhf-gnu`
3+
4+
include ../tools.mk
5+
6+
# Issue #66530: We would ICE if someone compiled with `-o /dev/null`,
7+
# because we would try to generate auxiliary files in `/dev/` (which
8+
# at least the OS X file system rejects).
9+
#
10+
# An attempt to `-Ztemps-dir` into a directory we cannot write into should
11+
# indeed be an error; but not an ICE.
12+
#
13+
# However, some folks run tests as root, which can write `/dev/` and end
14+
# up clobbering `/dev/null`. Instead we'll use an inaccessible path, which
15+
# also used to ICE, but even root can't magically write there.
16+
#
17+
# Note that `-Ztemps-dir` uses `create_dir_all` so it is not sufficient to
18+
# use a directory with non-existing parent like `/does-not-exist/output`.
19+
20+
all:
21+
# Create an inaccessible directory
22+
mkdir $(TMPDIR)/inaccessible
23+
chmod 000 $(TMPDIR)/inaccessible
24+
25+
# Run rustc with `-Ztemps-dir` set to a directory
26+
# *inside* the inaccessible one, so that it can't create it
27+
$(RUSTC) program.rs -Ztemps-dir=$(TMPDIR)/inaccessible/tmp 2>&1 \
28+
| $(CGREP) "failed to find or create the directory specified by `--temps-dir`"
29+
30+
# Make the inaccessible directory accessible,
31+
# so that compiletest can delete the temp dir
32+
chmod +rw $(TMPDIR)/inaccessible
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() {}

tests/ui/io-checks/inaccessbile-temp-dir.rs

-39
This file was deleted.

tests/ui/io-checks/inaccessbile-temp-dir.stderr

-4
This file was deleted.

tests/ui/io-checks/non-ice-error-on-worker-io-fail.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// up clobbering `/dev/null`. Instead we'll use a non-existent path, which
1010
// also used to ICE, but even root can't magically write there.
1111

12-
// compile-flags: -o /does-not-exist/output
12+
// compile-flags: -o ./does-not-exist/output
1313

1414
// The error-pattern check occurs *before* normalization, and the error patterns
1515
// are wildly different between build environments. So this is a cop-out (and we
@@ -19,22 +19,14 @@
1919
// error-pattern: error
2020

2121
// On Mac OS X, we get an error like the below
22-
// normalize-stderr-test "failed to write bytecode to /does-not-exist/output.non_ice_error_on_worker_io_fail.*" -> "io error modifying /does-not-exist/"
22+
// normalize-stderr-test "failed to write bytecode to ./does-not-exist/output.non_ice_error_on_worker_io_fail.*" -> "io error modifying ./does-not-exist/"
2323

2424
// On Linux, we get an error like the below
25-
// normalize-stderr-test "couldn't create a temp dir.*" -> "io error modifying /does-not-exist/"
25+
// normalize-stderr-test "couldn't create a temp dir.*" -> "io error modifying ./does-not-exist/"
2626

2727
// ignore-windows - this is a unix-specific test
2828
// ignore-emscripten - the file-system issues do not replicate here
2929
// ignore-wasm - the file-system issues do not replicate here
3030
// ignore-arm - the file-system issues do not replicate here, at least on armhf-gnu
3131

32-
#![crate_type="lib"]
33-
34-
#![cfg_attr(not(feature = "std"), no_std)]
35-
pub mod task {
36-
pub mod __internal {
37-
use crate::task::Waker;
38-
}
39-
pub use core::task::Waker;
40-
}
32+
#![crate_type = "lib"]
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
warning: ignoring --out-dir flag due to -o flag
22

3-
error: io error modifying /does-not-exist/
3+
error: io error modifying ./does-not-exist/
44

55
error: aborting due to previous error; 1 warning emitted
66

0 commit comments

Comments
 (0)