summaryrefslogtreecommitdiff
path: root/tests/misc/shuf.sh
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-07-05 02:43:22 +0100
committerPádraig Brady <P@draigBrady.com>2013-07-05 02:43:22 +0100
commit37c9ce40f3a851955916e5d54635566a5685ce23 (patch)
treeaae5eff214de7cb151545da1acd2621135577843 /tests/misc/shuf.sh
parent31225e4f3260c0b97983986befef3de91e02c3ef (diff)
downloadcoreutils-37c9ce40f3a851955916e5d54635566a5685ce23.tar.xz
tests: fix "shuf unreadable" test to work when run as root
* tests/misc/shuf.sh: Restrict the test to the significant case where we can't in fact read the "unreadable" file.
Diffstat (limited to 'tests/misc/shuf.sh')
-rwxr-xr-xtests/misc/shuf.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/misc/shuf.sh b/tests/misc/shuf.sh
index 171b25a1f..3e33b6151 100755
--- a/tests/misc/shuf.sh
+++ b/tests/misc/shuf.sh
@@ -60,7 +60,9 @@ timeout 10 shuf -i1-$SIZE_MAX -n2 >/dev/null ||
# Ensure shuf -n0 doesn't read any input or open specified files
touch unreadable || framework_failure_
chmod 0 unreadable || framework_failure_
-shuf -n0 unreadable || fail=1
-shuf -n1 unreadable && fail=1
+if ! test -r unreadable; then
+ shuf -n0 unreadable || fail=1
+ shuf -n1 unreadable && fail=1
+fi
Exit $fail