Skip to content

Fix ui/io-checks/inaccessbile-temp-dir.rs test #110801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tests/run-make/inaccessible-temp-dir/Makefile
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions tests/run-make/inaccessible-temp-dir/program.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main() {}
39 changes: 0 additions & 39 deletions tests/ui/io-checks/inaccessbile-temp-dir.rs

This file was deleted.

4 changes: 0 additions & 4 deletions tests/ui/io-checks/inaccessbile-temp-dir.stderr

This file was deleted.

16 changes: 4 additions & 12 deletions tests/ui/io-checks/non-ice-error-on-worker-io-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
2 changes: 1 addition & 1 deletion tests/ui/io-checks/non-ice-error-on-worker-io-fail.stderr
Original file line number Diff line number Diff line change
@@ -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