Skip to content

Commit abaa724

Browse files
authored
Rollup merge of #110801 - WaffleLapkin:io-tests, r=jyn514
Fix `ui/io-checks/inaccessbile-temp-dir.rs` test Fixes #110794 r? `@jyn514`
2 parents 7f0361d + e6ed0ca commit abaa724

File tree

6 files changed

+37
-56
lines changed

6 files changed

+37
-56
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.

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)