Skip to content

Commit

Permalink
Rollup merge of #110801 - WaffleLapkin:io-tests, r=jyn514
Browse files Browse the repository at this point in the history
Fix `ui/io-checks/inaccessbile-temp-dir.rs` test

Fixes #110794

r? `@jyn514`
  • Loading branch information
matthiaskrgr authored Apr 25, 2023
2 parents 7f0361d + e6ed0ca commit abaa724
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 56 deletions.
31 changes: 31 additions & 0 deletions tests/run-make/inaccessbile-temp-dir/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# only-linux

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/inaccessbile-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

0 comments on commit abaa724

Please sign in to comment.