]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: avoid wrong skips in dist-formats.tap
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 9 Feb 2012 18:49:18 +0000 (19:49 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 9 Feb 2012 18:49:18 +0000 (19:49 +0100)
* tests/dist-formats.tap: The test checking whether the 'compress'
program is actually capable of compressing files relied on the
assumption that 'compress' exits with status zero if no problem
occurs; alas, this reasonable assumption doesn't hold in practice,
since 'compress' does (and is documented to) exit with status 2 if
the output is larger than the input after (attempted) compression!
Fix this by using and input that 'compress' can actually reduce in
size when compressing.
Do some related reformatting of surrounding code since we are at it.

tests/dist-formats.tap

index 431feaa7979e04cfc29d7380cf4df4fc84b2dedc..80be9c9e53790cd1440d138429d5f78e93c7a651 100755 (executable)
@@ -79,13 +79,22 @@ missing_compressors=`
   for c in $all_compressors; do
     case $c in
       # Assume gzip(1) is available on every reasonable portability target.
-      gzip) continue;;
+      gzip)
+        continue;;
       # On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils
       # and is just a dummy script that is not able to actually compress
       # (it can only decompress).  So, check that the 'compress' program
       # is actually able to compress input.
-      compress) $c -c </dev/null >/dev/null && continue;;
-      *) $c --version </dev/null >&2 && continue;;
+      # Note that, at least on GNU/Linux, 'compress' does (and is
+      # documented to) exit with status 2 if the output is larger than
+      # the input after (attempted) compression; so we need to pass it
+      # an input that it can actually reduce in size when compressing.
+      compress)
+        for x in 1 2 3 4 5 6 7 8; do
+          echo aaaaaaaaaaaaaaa
+        done | $c -c >/dev/null && continue;;
+      *)
+        $c --version </dev/null >&2 && continue;;
     esac
     echo $c
   done | tr "$nl" ' '`