]> git.proxmox.com Git - rustc.git/blob - tests/run-make/inaccessible-temp-dir/Makefile
New upstream version 1.71.1+dfsg1
[rustc.git] / tests / run-make / inaccessible-temp-dir / Makefile
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