]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: use bash in some scripts to avoid false failures
authorPádraig Brady <P@draigBrady.com>
Sun, 1 Mar 2020 21:49:16 +0000 (21:49 +0000)
committerPádraig Brady <P@draigBrady.com>
Sun, 1 Mar 2020 22:02:39 +0000 (22:02 +0000)
* init.cfg (require_bash_as_SHELL_): A new function to replace
SHELL for the current test, with bash if available.
This is useful on OpenIndiana 11 where /bin/sh was seen
to have races in handling of SIGPIPE.
* tests/misc/seq-epipe.sh: Use the new function to enforce bash.
* tests/misc/env-signal-handler.sh: Likewise.
Reported by Bruno Haible

init.cfg
tests/misc/env-signal-handler.sh
tests/misc/seq-epipe.sh

index 2009e294e7d570ac1771ba4c93fa176a658bfc92..8385963f41113e93fcd00457be5b99d895764dc8 100644 (file)
--- a/init.cfg
+++ b/init.cfg
@@ -629,6 +629,15 @@ trap_sigpipe_or_skip_()
     skip_ 'trapping SIGPIPE is not supported'
 }
 
+require_bash_as_SHELL_()
+{
+  if bash --version >/dev/null 2>&1; then
+    SHELL='bash'
+  else
+    skip_ 'bash is required'
+  fi
+}
+
 # Disable the current test if the working directory seems to have
 # the setgid bit set.
 skip_if_setgid_()
index fc1bb4e7dc3531a0270855be488e8b5563c760ca..c38177dae5057feead71694036144ef62c79a006 100755 (executable)
 print_ver_ env seq test timeout printf
 trap_sigpipe_or_skip_
 
+# /bin/sh has an intermittent failure in ignoring SIGPIPE on OpenIndiana 11
+# so we require bash as discussed at:
+# https://lists.gnu.org/archive/html/coreutils/2020-03/msg00004.html
+require_bash_as_SHELL_
+
 # Paraphrasing http://bugs.gnu.org/34488#8:
 # POSIX requires that sh started with an inherited ignored SIGPIPE must
 # silently ignore all attempts from within the shell to restore SIGPIPE
index fe11e61f5f2e8c59e31b60b967e7bf805a532657..0c42e43085dca1240684a71103617d648f765e13 100755 (executable)
 print_ver_ seq
 trap_sigpipe_or_skip_
 
+# /bin/sh has an intermittent failure in ignoring SIGPIPE on OpenIndiana 11
+# so we require bash as discussed at:
+# https://lists.gnu.org/archive/html/coreutils/2020-03/msg00004.html
+require_bash_as_SHELL_
+
 # upon EPIPE with signals ignored, 'seq' should exit with an error.
-timeout 10 sh -c \
+timeout 10 $SHELL -c \
   'trap "" PIPE && { seq inf 2>err; echo $? >code; } | head -n1' >out
 
 # Exit-code must be 1, indicating 'write error'