Auto merge of #110801 - WaffleLapkin:io-tests, r=jyn514
Fix `ui/io-checks/inaccessbile-temp-dir.rs` test Fixes #110794 r? `@jyn514`
This commit is contained in:
commit
9a3258fa52
6 changed files with 38 additions and 56 deletions
32
tests/run-make/inaccessible-temp-dir/Makefile
Normal file
32
tests/run-make/inaccessible-temp-dir/Makefile
Normal file
|
@ -0,0 +1,32 @@
|
|||
# only-linux
|
||||
# ignore-arm - linker error on `armhf-gnu`
|
||||
|
||||
include ../tools.mk
|
||||
|
||||
# Issue #66530: We would ICE if someone compiled with `-o /dev/null`,
|
||||
# because we would try to generate auxiliary files in `/dev/` (which
|
||||
# at least the OS X file system rejects).
|
||||
#
|
||||
# An attempt to `-Ztemps-dir` into a directory we cannot write into should
|
||||
# indeed be an error; but not an ICE.
|
||||
#
|
||||
# However, some folks run tests as root, which can write `/dev/` and end
|
||||
# up clobbering `/dev/null`. Instead we'll use an inaccessible path, which
|
||||
# also used to ICE, but even root can't magically write there.
|
||||
#
|
||||
# Note that `-Ztemps-dir` uses `create_dir_all` so it is not sufficient to
|
||||
# use a directory with non-existing parent like `/does-not-exist/output`.
|
||||
|
||||
all:
|
||||
# Create an inaccessible directory
|
||||
mkdir $(TMPDIR)/inaccessible
|
||||
chmod 000 $(TMPDIR)/inaccessible
|
||||
|
||||
# Run rustc with `-Ztemps-dir` set to a directory
|
||||
# *inside* the inaccessible one, so that it can't create it
|
||||
$(RUSTC) program.rs -Ztemps-dir=$(TMPDIR)/inaccessible/tmp 2>&1 \
|
||||
| $(CGREP) "failed to find or create the directory specified by `--temps-dir`"
|
||||
|
||||
# Make the inaccessible directory accessible,
|
||||
# so that compiletest can delete the temp dir
|
||||
chmod +rw $(TMPDIR)/inaccessible
|
1
tests/run-make/inaccessible-temp-dir/program.rs
Normal file
1
tests/run-make/inaccessible-temp-dir/program.rs
Normal file
|
@ -0,0 +1 @@
|
|||
fn main() {}
|
|
@ -1,39 +0,0 @@
|
|||
// Issue #66530: We would ICE if someone compiled with `-o /dev/null`,
|
||||
// because we would try to generate auxiliary files in `/dev/` (which
|
||||
// at least the OS X file system rejects).
|
||||
//
|
||||
// An attempt to `-o` into a directory we cannot write into should indeed
|
||||
// be an error; but not an ICE.
|
||||
//
|
||||
// However, some folks run tests as root, which can write `/dev/` and end
|
||||
// up clobbering `/dev/null`. Instead we'll use a non-existent path, which
|
||||
// also used to ICE, but even root can't magically write there.
|
||||
|
||||
// compile-flags: -Z temps-dir=/does-not-exist/output
|
||||
|
||||
// The error-pattern check occurs *before* normalization, and the error patterns
|
||||
// are wildly different between build environments. So this is a cop-out (and we
|
||||
// rely on the checking of the normalized stderr output as our actual
|
||||
// "verification" of the diagnostic).
|
||||
|
||||
// error-pattern: error
|
||||
|
||||
// On Mac OS X, we get an error like the below
|
||||
// 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/"
|
||||
|
||||
// On Linux, we get an error like the below
|
||||
// normalize-stderr-test "couldn't create a temp dir.*" -> "io error modifying /does-not-exist/"
|
||||
|
||||
// ignore-windows - this is a unix-specific test
|
||||
// ignore-emscripten - the file-system issues do not replicate here
|
||||
// ignore-wasm - the file-system issues do not replicate here
|
||||
// ignore-arm - the file-system issues do not replicate here, at least on armhf-gnu
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
pub mod task {
|
||||
pub mod __internal {
|
||||
use crate::task::Waker;
|
||||
}
|
||||
pub use core::task::Waker;
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
error: failed to find or create the directory specified by `--temps-dir`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
// up clobbering `/dev/null`. Instead we'll use a non-existent path, which
|
||||
// also used to ICE, but even root can't magically write there.
|
||||
|
||||
// compile-flags: -o /does-not-exist/output
|
||||
// compile-flags: -o ./does-not-exist/output
|
||||
|
||||
// The error-pattern check occurs *before* normalization, and the error patterns
|
||||
// are wildly different between build environments. So this is a cop-out (and we
|
||||
|
@ -19,22 +19,14 @@
|
|||
// error-pattern: error
|
||||
|
||||
// On Mac OS X, we get an error like the below
|
||||
// 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/"
|
||||
// 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/"
|
||||
|
||||
// On Linux, we get an error like the below
|
||||
// normalize-stderr-test "couldn't create a temp dir.*" -> "io error modifying /does-not-exist/"
|
||||
// normalize-stderr-test "couldn't create a temp dir.*" -> "io error modifying ./does-not-exist/"
|
||||
|
||||
// ignore-windows - this is a unix-specific test
|
||||
// ignore-emscripten - the file-system issues do not replicate here
|
||||
// ignore-wasm - the file-system issues do not replicate here
|
||||
// ignore-arm - the file-system issues do not replicate here, at least on armhf-gnu
|
||||
|
||||
#![crate_type="lib"]
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
pub mod task {
|
||||
pub mod __internal {
|
||||
use crate::task::Waker;
|
||||
}
|
||||
pub use core::task::Waker;
|
||||
}
|
||||
#![crate_type = "lib"]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
warning: ignoring --out-dir flag due to -o flag
|
||||
|
||||
error: io error modifying /does-not-exist/
|
||||
error: io error modifying ./does-not-exist/
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue