coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: avoid false failure when running as root


From: Pádraig Brady
Subject: [PATCH] tests: avoid false failure when running as root
Date: Thu, 25 Jun 2015 14:15:33 +0100

* tests/misc/sync.sh: Ensure dir is unreadable before
including the permission check.
---
 tests/misc/sync.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/misc/sync.sh b/tests/misc/sync.sh
index a204630..c6e09be 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
-- 
2.4.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]