On Alpine Linux 3.7.0 (x86_64), the gnulib-tests of a 'grep' snapshot fail:

FAIL: dfa-match.sh

The problem is here:

+ timeout 10 dfa-match-aux a bb
bb 1
timeout: can't execute '10': No such file or directory
+ fail=1

This distro has a 'timeout' program, and 'timeout --help' reports (on stderr!):

  BusyBox v1.27.2 (2018-01-29 15:48:57 GMT) multi-call binary.

  Usage: timeout [-t SECS] [-s SIG] PROG ARGS

  Runs PROG. Sends SIG to it if it is not gone in SECS seconds.
  Defaults: SECS: 10, SIG: TERM.

This patch fixes it.

2018-12-15  Bruno Haible  <br...@clisp.org>

        dfa tests: Avoid test failure on Alpine Linux.
        * tests/dfa-match.sh (timeout_10): Accommodate the BusyBox 'timeout'
        command found on Alpine Linux.

diff --git a/tests/dfa-match.sh b/tests/dfa-match.sh
index c06bb44..1923c2d 100755
--- a/tests/dfa-match.sh
+++ b/tests/dfa-match.sh
@@ -22,7 +22,11 @@
 path_prepend_ .
 if (type timeout) >/dev/null 2>&1; then
-  timeout_10='timeout 10'
+  if timeout --help 2>&1 | grep BusyBox; then
+    timeout_10='timeout -t 10'
+  else
+    timeout_10='timeout 10'
+  fi

Reply via email to