summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-06-25 14:10:47 +0100
committerPádraig Brady <P@draigBrady.com>2015-06-25 14:10:47 +0100
commitcacd9bf9c265e6dda21d3105ade83ae1401867ce (patch)
treeb9a900ef5a2cd4d7f39ab4ee1ecd65585be5e1cf
parent1d82751e2ca03084db4cb06c0b4eaf73036082d8 (diff)
downloadcoreutils-cacd9bf9c265e6dda21d3105ade83ae1401867ce.tar.xz
tests: avoid false failure when running as root
* tests/misc/sync.sh: Ensure dir is unreadable before including the permission check.
-rwxr-xr-xtests/misc/sync.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/misc/sync.sh b/tests/misc/sync.sh
index a20463061..c6e09beb6 100755
--- a/tests/misc/sync.sh
+++ b/tests/misc/sync.sh
@@ -36,9 +36,11 @@ returns_ 1 sync file nofile || fail=1
# Ensure inaccessible dirs give an appropriate error
mkdir norw || framework_failure_
chmod 0 norw || framework_failure_
-sync norw 2>err
-printf "sync: error opening 'norw': Permission denied\n" >exp
-compare exp err || fail=1
+if ! test -r norw; then
+ sync norw 2>err
+ printf "sync: error opening 'norw': Permission denied\n" >exp
+ compare exp err || fail=1
+fi
if test "$fail" != '1'; then
# Ensure a fifo doesn't block