]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: tail-2/pipe-f: avoid false failure closing stdout
authorPádraig Brady <P@draigBrady.com>
Thu, 7 Mar 2019 06:23:21 +0000 (22:23 -0800)
committerPádraig Brady <P@draigBrady.com>
Thu, 7 Mar 2019 06:26:30 +0000 (22:26 -0800)
* tests/tail-2/pipe-f.sh: Check closing stdout with >&-
is effective, which avoids a false failure on NetBSD 7.1
Reported by Assaf Gordon

tests/tail-2/pipe-f.sh

index 83f072ed51f47b50b31cb534bc3d157058c95ab2..1a7b3e365276e23a0a43aeb060a20ca57c551c55 100755 (executable)
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ tail
+print_ver_ tail test
 trap_sigpipe_or_skip_
 
 # Speedup the non inotify case
@@ -52,7 +52,12 @@ for disposition in '' '-'; do
 done
 
 # This would wait indefinitely before v8.28 (until first write)
-(returns_ 1 timeout 10 tail -f $mode $fastpoll /dev/null >&-) || fail=1
+# test -w /dev/stdout is used to check that >&- is effective
+# which was seen not to be the case on NetBSD 7.1 / x86_64:
+if env test -w /dev/stdout >/dev/null &&
+   env test ! -w /dev/stdout >&-; then
+  (returns_ 1 timeout 10 tail -f $mode $fastpoll /dev/null >&-) || fail=1
+fi
 done
 
 Exit $fail