coreutils
[Top][All Lists]
Advanced

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

[PATCH] tests: skip some parts of tests/misc/tee.sh if run as root


From: Nick Alcock
Subject: [PATCH] tests: skip some parts of tests/misc/tee.sh if run as root
Date: Tue, 21 Mar 2023 12:54:02 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1.91 (gnu/linux)

Similarly to the fix to tests/rmdir/ignore.sh in c0e5f8c59,
tee should not be expected to fail when run with read-only outputs
when run as root.

* tests/rmdir/ignore.sh: Add uid_is_privileged_ guard around test for
read-only outputs.
---
 tests/misc/tee.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/misc/tee.sh b/tests/misc/tee.sh
index e01c27ecc..9f5eace8a 100755
--- a/tests/misc/tee.sh
+++ b/tests/misc/tee.sh
@@ -79,9 +79,11 @@ test -f tee.exited || fail=1 ;;
 esac
 
 # Test with unwriteable files
-touch file.ro || framework_failure_
-chmod a-w file.ro || framework_failure_
-returns_ 1 tee -p </dev/null file.ro || fail=1
+if ! uid_is_privileged_; then  # root does not get EPERM.
+    touch file.ro || framework_failure_
+    chmod a-w file.ro || framework_failure_
+    returns_ 1 tee -p </dev/null file.ro || fail=1
+fi
 
 mkfifo_or_skip_ fifo
 
-- 
2.39.1



reply via email to

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