From: Jim Meyering Date: Tue, 8 Apr 2003 10:55:01 +0000 (+0000) Subject: Run $PERL to see if it is available, rather than testing its value. X-Git-Tag: v5.0.1~793 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c54ba76168aa7519087d32f9c8f0b739a6420b4b;p=thirdparty%2Fcoreutils.git Run $PERL to see if it is available, rather than testing its value. --- diff --git a/tests/basename/basic b/tests/basename/basic index f44e39823a..e98e842b9f 100755 --- a/tests/basename/basic +++ b/tests/basename/basic @@ -4,13 +4,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *missing\ perl) - echo 1>&2 "$0: configure didn't find a usable version of Perl," \ - "so can't run this test" - exit 77 - ;; -esac +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" + exit 77 +} d=$srcdir/.. exec $PERL -w -I$d -MFetish -- - << \EOF diff --git a/tests/dd/skip-seek b/tests/dd/skip-seek index 97345a9cc3..ecec6b9154 100755 --- a/tests/dd/skip-seek +++ b/tests/dd/skip-seek @@ -3,12 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} SCRIPT_NAME=$0 export SCRIPT_NAME diff --git a/tests/dircolors/simple b/tests/dircolors/simple index 2f3a4ca2ba..99d772e1cf 100755 --- a/tests/dircolors/simple +++ b/tests/dircolors/simple @@ -3,12 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} exec $PERL -w -I$srcdir/.. -MFetish -- - <<\EOF require 5.003; diff --git a/tests/expr/basic b/tests/expr/basic index e1c213833a..da978e7d54 100755 --- a/tests/expr/basic +++ b/tests/expr/basic @@ -4,13 +4,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl," \ - "so can't run this test" - exit 77 - ;; -esac +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" + exit 77 +} d=$srcdir/.. exec $PERL -w -I$d -MFetish -- - << \EOF diff --git a/tests/factor/basic b/tests/factor/basic index 0c830315f0..884dd12806 100755 --- a/tests/factor/basic +++ b/tests/factor/basic @@ -4,13 +4,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl," \ - "so can't run this test" - exit 77 - ;; -esac +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" + exit 77 +} d=$srcdir/.. exec $PERL -w -I$d -MFetish -- - << \EOF diff --git a/tests/fmt/basic b/tests/fmt/basic index 7450a94ef5..fb1c060b94 100755 --- a/tests/fmt/basic +++ b/tests/fmt/basic @@ -4,12 +4,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} # Export this to avoid hassles when run in a UTF-8 locale, # since we use 8-bit characters below, and those values are diff --git a/tests/ls-2/tests b/tests/ls-2/tests index 55a6fd56d1..7b1a14ab27 100755 --- a/tests/ls-2/tests +++ b/tests/ls-2/tests @@ -3,12 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} exec $PERL -w -I$srcdir/.. -MFetish -- - << \EOF require 5.003; diff --git a/tests/md5sum/basic-1 b/tests/md5sum/basic-1 index d2dfb42287..e76c304a34 100755 --- a/tests/md5sum/basic-1 +++ b/tests/md5sum/basic-1 @@ -3,12 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} exec $PERL -w -I$srcdir/.. -MFetish -- - <<\EOF require 5.003; diff --git a/tests/md5sum/newline-1 b/tests/md5sum/newline-1 index a075f3f50b..7473e554d9 100755 --- a/tests/md5sum/newline-1 +++ b/tests/md5sum/newline-1 @@ -3,13 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') +$PERL -e 1 > /dev/null 2>&1 || { echo 1>&2 "$0: configure didn't find a usable version of Perl," \ "so can't run this test" exit 77 - ;; -esac +} # See if we can create a filename that contains a newline. # Be careful to do it in a subshell so that we can redirect the diff --git a/tests/misc/sort b/tests/misc/sort index 06cf6ace78..cd3ff5395b 100755 --- a/tests/misc/sort +++ b/tests/misc/sort @@ -3,12 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} exec $PERL -w -I$srcdir/.. -MFetish -- - <<\EOF require 5.003; diff --git a/tests/misc/tty-eof b/tests/misc/tty-eof index c5d57ab018..784bd204d4 100755 --- a/tests/misc/tty-eof +++ b/tests/misc/tty-eof @@ -2,13 +2,11 @@ : ${PERL=perl} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run thi -s test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} ARGV_0=$0 export ARGV_0 diff --git a/tests/mv/i-1 b/tests/mv/i-1 index 98929b4232..517942a252 100755 --- a/tests/mv/i-1 +++ b/tests/mv/i-1 @@ -3,12 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} exec $PERL -w -I$srcdir/.. -MFetish -- - <<\EOF require 5.003; diff --git a/tests/rm/empty-name b/tests/rm/empty-name index e20a146af2..c9db70a992 100755 --- a/tests/rm/empty-name +++ b/tests/rm/empty-name @@ -7,12 +7,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} exec $PERL -w -I$srcdir/.. -MFetish -- - << \EOF require 5.003; diff --git a/tests/rm/fail-eperm b/tests/rm/fail-eperm index 837804bdd1..2e4d64cb3e 100755 --- a/tests/rm/fail-eperm +++ b/tests/rm/fail-eperm @@ -6,13 +6,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') #' - echo 1>&2 \ - "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} ARGV_0=$0 export ARGV_0 diff --git a/tests/rm/unreadable b/tests/rm/unreadable index a778e015dd..737e22a992 100755 --- a/tests/rm/unreadable +++ b/tests/rm/unreadable @@ -3,12 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} exec $PERL -w -I$srcdir/.. -MFetish -- - << \EOF require 5.003; diff --git a/tests/seq/basic b/tests/seq/basic index 8740dfa922..1bcece00bd 100755 --- a/tests/seq/basic +++ b/tests/seq/basic @@ -4,13 +4,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *missing\ perl) - echo 1>&2 "$0: configure didn't find a usable version of Perl," \ - "so can't run this test" - exit 77 - ;; -esac +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" + exit 77 +} d=$srcdir/.. exec $PERL -w -I$d -MFetish -- - << \EOF diff --git a/tests/sha1sum/basic-1 b/tests/sha1sum/basic-1 index 8e148267ad..8910185b98 100755 --- a/tests/sha1sum/basic-1 +++ b/tests/sha1sum/basic-1 @@ -3,12 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} exec $PERL -w -I$srcdir/.. -MFetish -- - <<\EOF require 5.003; diff --git a/tests/sha1sum/sample-vec b/tests/sha1sum/sample-vec index e300778e74..b6d86589da 100755 --- a/tests/sha1sum/sample-vec +++ b/tests/sha1sum/sample-vec @@ -3,12 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} exec $PERL -w -I$srcdir/.. -MFetish -- - <<\EOF require 5.003; diff --git a/tests/sum/basic-1 b/tests/sum/basic-1 index 5c12dfb51d..0b752adb95 100755 --- a/tests/sum/basic-1 +++ b/tests/sum/basic-1 @@ -3,12 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} exec $PERL -w -I$srcdir/.. -MFetish -- - <<\EOF require 5.003; diff --git a/tests/sum/sysv b/tests/sum/sysv index 39697bb737..cda557018f 100755 --- a/tests/sum/sysv +++ b/tests/sum/sysv @@ -6,12 +6,11 @@ if test "$VERBOSE" = yes; then sum --version fi -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} # Avoid a problem when run in a UTF-8 locale. # Otherwise, Perl would try to (and fail to) interpret diff --git a/tests/tsort/basic-1 b/tests/tsort/basic-1 index 99b1fedd27..a70830c589 100755 --- a/tests/tsort/basic-1 +++ b/tests/tsort/basic-1 @@ -4,13 +4,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac -#' +} exec $PERL -w -I$srcdir/.. -MFetish -- - <<\EOF #/ diff --git a/tests/unexpand/basic-1 b/tests/unexpand/basic-1 index 8640e981c2..e366f49fad 100755 --- a/tests/unexpand/basic-1 +++ b/tests/unexpand/basic-1 @@ -3,12 +3,11 @@ : ${PERL=perl} : ${srcdir=.} -case "$PERL" in - *'missing perl') - echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" exit 77 - ;; -esac +} exec $PERL -w -I$srcdir/.. -MFetish -- - <<\EOF require 5.003;