Skip to content

Commit 39fa192

Browse files
committed
Fix ui/io-checks/inaccessbile-temp-dir.rs test
1 parent 91b61a4 commit 39fa192

File tree

4 files changed

+32
-43
lines changed

4 files changed

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

0 commit comments

Comments
 (0)