tests: fix spurious failure when zip is present but unzip is not
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 30 Oct 2013 00:51:25 +0000 (00:51 +0000)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 30 Oct 2013 00:54:24 +0000 (00:54 +0000)
Fixes automake bug#15181.

* t/dist-formats.tap (have_compressor): When checking that zip(1), also
check for unzip(1), otherwise "make distcheck" will be unable to extract
the zip tarball it creates, which will cause spurious failures.  While
at it, reorganize the existing code a bit.
* THANKS, NEWS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
THANKS
t/dist-formats.tap

diff --git a/NEWS b/NEWS
index 03e0e62..aaec7c0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -118,7 +118,7 @@ New in 1.14.1:
     message on the most common invalid usages.
 
   - Several spurious failures/hangs in the testsuite (bugs #14706, #14707,
-    #14760, #14911, #15237).
+    #14760, #14911, #15181, #15237).
 
 * Documentation fixes:
 
diff --git a/THANKS b/THANKS
index 3adea7e..6be803e 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -17,6 +17,7 @@ Alexander Turbov                zaufi@sendmail.ru
 Alexandre Duret-Lutz            duret_g@epita.fr
 Alexey Mahotkin                 alexm@hsys.msk.ru
 Alfred M. Szmidt                ams@gnu.org
+Andrea Urbani                   matfanjol@mail.com
 Andreas Bergmeier               lcid-fire@gmx.net
 Andreas Buening                 andreas.buening@nexgo.de
 Andreas Köhler                  andi5.py@gmx.net
index 49281d9..3c9e621 100644 (file)
@@ -67,34 +67,38 @@ setup_vars_for_compression_format ()
 have_compressor ()
 {
   test $# -eq 1 || fatal_ "have_compressor(): bad usage"
-  case $1 in
+  if test $1 = gzip; then
     # Assume gzip(1) is available on every reasonable portability target.
-    gzip)
-      return 0;;
-    *)
-      case $1 in
-        # Do not use --version, or older versions bzip2 would try to
-        # compress stdin.  This would cause binary output in the test
-        # logs, with potential breakage of our testsuite harness.
-        bzip2) o=--help;;
-        # OpenSolaris zip do not support the '--version' option, but
-        # accepts the '-v' one with a similar meaning (if no further
-        # arguments are given).
-        zip) o=-v;;
-        # Assume the other compressors we care about support the
-        # '--version' option.
-        *) o=--version;;
-      esac
-      # Redirect to stderr to avoid polluting the output, in case this
-      # function is used in a command substitution (as it is, below).
-      if $1 $o </dev/null >&2; then
-        return 0
-      else
-        return 1
-      fi
+    return 0
+  fi
+  needed_programs=$1
+  # Assume by default the other compressors we care about support the
+  # '--version' option.  We'll special-case the one which don't.
+  checker_option=--version
+  case $1 in
+    bzip2)
+      # Do not use --version, or older versions bzip2 would try to
+      # compress stdin.  This would cause binary output in the test
+      # logs, with potential breakage of our testsuite harness.
+      checker_option=--help
+      ;;
+    zip)
+      # OpenSolaris zip do not support the '--version' option, but
+      # accepts the '-v' one with a similar meaning (if no further
+      # arguments are given).
+      checker_option=-v
+      # Also, we need 'unzip' to decompress the created zipped archives
+      # (bug#15181).
+      needed_programs='zip unzip'
       ;;
   esac
-  fatal_ "have_compressor(): dead code reached"
+  # Redirect to stderr to avoid polluting the output, in case this
+  # function is used in a command substitution (as it is, later in
+  # this script).
+  for p in $needed_programs; do
+    $p $checker_option </dev/null >&2 || return 1
+  done
+  return 0
 }
 
 all_compression_formats='gzip lzip xz bzip2 zip'