|
| 1 | +From fbd3fbdb24563a9d8fd3651f6bdc90bbbbd81d3e Mon Sep 17 00:00:00 2001 |
| 2 | +From: Josh Stone < [email protected]> |
| 3 | +Date: Fri, 1 May 2020 16:50:10 -0700 |
| 4 | +Subject: [PATCH] Use a non-existent test path instead of clobbering /dev/null |
| 5 | + |
| 6 | +Signed-off-by: Raine Makelainen < [email protected]> |
| 7 | +--- |
| 8 | + src/test/ui/non-ice-error-on-worker-io-fail.rs | 10 +++++++--- |
| 9 | + src/test/ui/non-ice-error-on-worker-io-fail.stderr | 2 +- |
| 10 | + 2 files changed, 8 insertions(+), 4 deletions(-) |
| 11 | + |
| 12 | +diff --git a/src/test/ui/non-ice-error-on-worker-io-fail.rs b/src/test/ui/non-ice-error-on-worker-io-fail.rs |
| 13 | +index 8af17742850..30779fc65c0 100644 |
| 14 | +--- a/src/test/ui/non-ice-error-on-worker-io-fail.rs |
| 15 | ++++ b/src/test/ui/non-ice-error-on-worker-io-fail.rs |
| 16 | +@@ -4,8 +4,12 @@ |
| 17 | + // |
| 18 | + // An attempt to `-o` into a directory we cannot write into should indeed |
| 19 | + // be an error; but not an ICE. |
| 20 | ++// |
| 21 | ++// However, some folks run tests as root, which can write `/dev/` and end |
| 22 | ++// up clobbering `/dev/null`. Instead we'll use a non-existent path, which |
| 23 | ++// also used to ICE, but even root can't magically write there. |
| 24 | + |
| 25 | +-// compile-flags: -o /dev/null |
| 26 | ++// compile-flags: -o /does-not-exist/output |
| 27 | + |
| 28 | + // The error-pattern check occurs *before* normalization, and the error patterns |
| 29 | + // are wildly different between build environments. So this is a cop-out (and we |
| 30 | +@@ -15,10 +19,10 @@ |
| 31 | + // error-pattern: error |
| 32 | + |
| 33 | + // On Mac OS X, we get an error like the below |
| 34 | +-// normalize-stderr-test "failed to write bytecode to /dev/null.non_ice_error_on_worker_io_fail.*" -> "io error modifying /dev/" |
| 35 | ++// 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/" |
| 36 | + |
| 37 | + // On Linux, we get an error like the below |
| 38 | +-// normalize-stderr-test "couldn't create a temp dir.*" -> "io error modifying /dev/" |
| 39 | ++// normalize-stderr-test "couldn't create a temp dir.*" -> "io error modifying /does-not-exist/" |
| 40 | + |
| 41 | + // ignore-tidy-linelength |
| 42 | + // ignore-windows - this is a unix-specific test |
| 43 | +diff --git a/src/test/ui/non-ice-error-on-worker-io-fail.stderr b/src/test/ui/non-ice-error-on-worker-io-fail.stderr |
| 44 | +index f732abc52b7..edadecf273a 100644 |
| 45 | +--- a/src/test/ui/non-ice-error-on-worker-io-fail.stderr |
| 46 | ++++ b/src/test/ui/non-ice-error-on-worker-io-fail.stderr |
| 47 | +@@ -1,6 +1,6 @@ |
| 48 | + warning: ignoring --out-dir flag due to -o flag |
| 49 | + |
| 50 | +-error: io error modifying /dev/ |
| 51 | ++error: io error modifying /does-not-exist/ |
| 52 | + |
| 53 | + error: aborting due to previous error; 1 warning emitted |
| 54 | + |
| 55 | +-- |
| 56 | +2.26.2 |
| 57 | + |
0 commit comments