]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: skip some parts of tests/misc/tee.sh if run as root
authorNick Alcock <nick.alcock@oracle.com>
Tue, 21 Mar 2023 12:54:02 +0000 (12:54 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 21 Mar 2023 16:15:18 +0000 (16:15 +0000)
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/misc/tee.sh: Add uid_is_privileged_ guard around test for
read-only outputs.

tests/misc/tee.sh

index e01c27ecce14c41587cad84a6593422ef2e87aa3..0b97a9ea3daa7e45dfefc9de63798c80f112b031 100755 (executable)
@@ -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