]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid false failure when running as root
authorPádraig Brady <P@draigBrady.com>
Thu, 25 Jun 2015 13:10:47 +0000 (14:10 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 25 Jun 2015 13:10:47 +0000 (14:10 +0100)
* tests/misc/sync.sh: Ensure dir is unreadable before
including the permission check.

tests/misc/sync.sh

index a20463061deabb7c1e5e56ec4a5283a2c1e6d7c4..c6e09beb66224206df56bf2d4093691c9d9f7551 100755 (executable)
@@ -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