X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=t%2Fdist-formats.tap;h=bebac374d2904470f20ad8baa209fe618ac76f66;hb=780299d96327ac43de44e38173c0162ed2c10474;hp=26c6c97d745e212aabd5388bb1125d95c4fc7497;hpb=67b86e0868d04d53e4c630633cbdccb6c5900cdf;p=platform%2Fupstream%2Fautomake.git diff --git a/t/dist-formats.tap b/t/dist-formats.tap index 26c6c97..bebac37 100755 --- a/t/dist-formats.tap +++ b/t/dist-formats.tap @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2012 Free Software Foundation, Inc. +# Copyright (C) 2012-2013 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,15 +18,15 @@ # archives. am_create_testdir=empty -. ./defs || Exit 1 +. test-init.sh -plan_ 70 +plan_ 66 # ---------------------------------------------------- # # Common and/or auxiliary subroutines and variables. # # ---------------------------------------------------- # -ocwd=`pwd` || fatal_ "obtaining current working directory" +ocwd=$(pwd) || fatal_ "getting current working directory" TAR='' && unset TAR @@ -56,55 +56,63 @@ setup_vars_for_compression_format () suffix=NONE compressor=NONE case $1 in gzip) suffix=tar.gz compressor=gzip ;; - tarZ) suffix=tar.Z compressor=compress ;; lzip) suffix=tar.lz compressor=lzip ;; xz) suffix=tar.xz compressor=xz ;; bzip2) suffix=tar.bz2 compressor=bzip2 ;; zip) suffix=zip compressor=zip ;; - shar) suffix=shar.gz compressor=shar ;; *) fatal_ "invalid compression format '$1'";; esac } -all_compression_formats='gzip tarZ lzip xz bzip2 zip shar' +have_compressor () +{ + test $# -eq 1 || fatal_ "have_compressor(): bad usage" + case $1 in + # 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 &2; then + return 0 + else + return 1 + fi + ;; + esac + fatal_ "have_compressor(): dead code reached" +} + +all_compression_formats='gzip lzip xz bzip2 zip' -all_compressors=` +all_compressors=$( for x in $all_compression_formats; do setup_vars_for_compression_format $x echo $compressor - done | tr "$nl" ' '` + done | tr "$nl" ' ') echo All compressors: $all_compressors -missing_compressors=` +missing_compressors=$( for c in $all_compressors; do - case $c in - # Assume gzip(1) is available on every reasonable portability target. - 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. - # 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 - : For shells with busted 'set -e'. - ;; - *) - $c --version &2 && continue - : For shells with busted 'set -e'. - ;; - esac - echo $c - done | tr "$nl" ' '` + have_compressor $c || echo $c + done | tr "$nl" ' ') echo Missing compressors: $missing_compressors +# Redefine to avoid re-running the already executed checks. have_compressor () { case " $missing_compressors " in *\ $1\ *) false;; *) : ;; esac @@ -122,8 +130,8 @@ start_subtest () if test $# -gt 0; then eval "$@" || fatal_ "start_subtest: evaluating assignments" fi - ac_opts=`echo $ac_opts | tr ',' ' '` - am_opts=`echo $am_opts | tr ',' ' '` + ac_opts=$(echo $ac_opts | tr ',' ' ') + am_opts=$(echo $am_opts | tr ',' ' ') mkdir "$name" cd "$name" unindent > configure.ac <