summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2007-12-06 14:21:51 +0100
committerJim Meyering <meyering@redhat.com>2008-02-09 10:30:33 +0100
commit5282e54c08883cf4ab7ddb3b1874344ff32e5df7 (patch)
treebefa40555cfbe06ea5a2962605c8edf28798a0e2 /tests
parent72565ddffe0b249fc23bd8253564aaf3311f833c (diff)
downloadcoreutils-5282e54c08883cf4ab7ddb3b1874344ff32e5df7.tar.xz
tests: factor out the perl-requiring code in many test scripts
* tests/require-perl: New file. * tests/Makefile.am (EXTRA_DIST): Add require-perl. * tests/dd/skip-seek: Use it, and remove manual tests. * tests/du/files0-from: Likewise. * tests/ls/nameless-uid: Likewise. * tests/misc/base64: Likewise. * tests/misc/basename: Likewise. * tests/misc/cut: Likewise. * tests/misc/date: Likewise. * tests/misc/dircolors: Likewise. * tests/misc/dirname: Likewise. * tests/misc/expand: Likewise. * tests/misc/expr: Likewise. * tests/misc/factor: Likewise. * tests/misc/fmt: Likewise. * tests/misc/fold: Likewise. * tests/misc/head-elide-tail: Likewise. * tests/misc/ls-misc: Likewise. * tests/misc/md5sum: Likewise. * tests/misc/md5sum-newline: Likewise. * tests/misc/mktemp: Likewise. * tests/misc/od: Likewise. * tests/misc/paste-no-nl: Likewise. * tests/misc/pr: Likewise. * tests/misc/pwd-long: Likewise. * tests/misc/seq: Likewise. * tests/misc/sha1sum: Likewise. * tests/misc/sha1sum-vec: Likewise. * tests/misc/sha224sum: Likewise. * tests/misc/sha256sum: Likewise. * tests/misc/sha384sum: Likewise. * tests/misc/sha512sum: Likewise. * tests/misc/sort-merge: Likewise. * tests/misc/stat-printf: Likewise. * tests/misc/sum: Likewise. * tests/misc/sum-sysv: Likewise. * tests/misc/test-diag: Likewise. * tests/misc/tsort: Likewise. * tests/misc/tty-eof: Likewise. * tests/misc/unexpand: Likewise. * tests/misc/wc-files0-from: Likewise. * tests/misc/xstrtol: Likewise. * tests/mv/i-1: Likewise. * tests/rm/empty-name: Likewise. * tests/rm/fail-eperm: Likewise. * tests/rm/unreadable: Likewise. (EXTRA_DIST): *do* require require-perl as a stand-alone, 'source'able script.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rwxr-xr-xtests/dd/skip-seek8
-rwxr-xr-xtests/du/files0-from11
-rwxr-xr-xtests/ls/nameless-uid9
-rwxr-xr-xtests/misc/base6412
-rwxr-xr-xtests/misc/basename12
-rwxr-xr-xtests/misc/cut8
-rwxr-xr-xtests/misc/date8
-rwxr-xr-xtests/misc/dircolors8
-rwxr-xr-xtests/misc/dirname12
-rwxr-xr-xtests/misc/expand12
-rwxr-xr-xtests/misc/expr8
-rwxr-xr-xtests/misc/factor8
-rwxr-xr-xtests/misc/fmt8
-rwxr-xr-xtests/misc/fold12
-rwxr-xr-xtests/misc/head-elide-tail10
-rwxr-xr-xtests/misc/ls-misc8
-rwxr-xr-xtests/misc/md5sum8
-rwxr-xr-xtests/misc/md5sum-newline8
-rwxr-xr-xtests/misc/mktemp8
-rwxr-xr-xtests/misc/od12
-rwxr-xr-xtests/misc/paste-no-nl10
-rwxr-xr-xtests/misc/pr9
-rwxr-xr-xtests/misc/pwd-long9
-rwxr-xr-xtests/misc/seq8
-rwxr-xr-xtests/misc/sha1sum8
-rwxr-xr-xtests/misc/sha1sum-vec8
-rwxr-xr-xtests/misc/sha224sum12
-rwxr-xr-xtests/misc/sha256sum12
-rwxr-xr-xtests/misc/sha384sum12
-rwxr-xr-xtests/misc/sha512sum12
-rwxr-xr-xtests/misc/sort-merge10
-rwxr-xr-xtests/misc/stat-printf10
-rwxr-xr-xtests/misc/sum8
-rwxr-xr-xtests/misc/sum-sysv7
-rwxr-xr-xtests/misc/test-diag8
-rwxr-xr-xtests/misc/tsort8
-rwxr-xr-xtests/misc/tty-eof9
-rwxr-xr-xtests/misc/unexpand8
-rwxr-xr-xtests/misc/wc-files0-from13
-rwxr-xr-xtests/misc/xstrtol8
-rwxr-xr-xtests/mv/i-18
-rw-r--r--tests/require-perl6
-rwxr-xr-xtests/rm/empty-name5
-rwxr-xr-xtests/rm/fail-eperm5
-rwxr-xr-xtests/rm/unreadable5
46 files changed, 72 insertions, 338 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ede631065..d955dd74f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -20,7 +20,7 @@ EXTRA_DIST = \
lang-default \
mk-script \
other-fs-tmpdir \
- priv-check \
+ require-perl \
rwx-to-mode \
sample-test \
setgid-check \
diff --git a/tests/dd/skip-seek b/tests/dd/skip-seek
index f2c0393fe..ce0121c62 100755
--- a/tests/dd/skip-seek
+++ b/tests/dd/skip-seek
@@ -18,14 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
SCRIPT_NAME=$0
export SCRIPT_NAME
diff --git a/tests/du/files0-from b/tests/du/files0-from
index 88f83aab9..4d9b37cb3 100755
--- a/tests/du/files0-from
+++ b/tests/du/files0-from
@@ -2,7 +2,7 @@
# -*- perl -*-
# Exercise du's --files0-from option.
-# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2007 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
@@ -17,15 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/ls/nameless-uid b/tests/ls/nameless-uid
index a78846ca4..a72438863 100755
--- a/tests/ls/nameless-uid
+++ b/tests/ls/nameless-uid
@@ -21,16 +21,13 @@ if test "$VERBOSE" = yes; then
ls --version
fi
+: ${srcdir=.}
+. $srcdir/../require-perl
+
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
. $srcdir/../test-lib.sh
-$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); exit 77
-}
-
nameless_uid=`$PERL -e 'foreach my $i (1000..16*1024) { getpwuid $i or (print "$i\n"), exit }'`
if test x$nameless_uid = x; then
diff --git a/tests/misc/base64 b/tests/misc/base64
index 3276635e8..0428c04c5 100755
--- a/tests/misc/base64
+++ b/tests/misc/base64
@@ -17,16 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-PROG=`echo $0|sed 's,.*/,,'`; export PROG
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
@@ -164,7 +156,7 @@ push @Tests, @new;
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $prog = 'base64';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF
diff --git a/tests/misc/basename b/tests/misc/basename
index e492b9e0d..4302e0b82 100755
--- a/tests/misc/basename
+++ b/tests/misc/basename
@@ -16,16 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-PROG=`echo $0|sed 's,.*/,,'`; export PROG
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
@@ -43,7 +35,7 @@ my $stat_double = stat('//');
my $double_slash = ($stat_single->dev == $stat_double->dev
&& $stat_single->ino == $stat_double->ino) ? '/' : '//';
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $prog = 'basename';
my @Tests =
(
diff --git a/tests/misc/cut b/tests/misc/cut
index 2fc4bed05..3bf52163d 100755
--- a/tests/misc/cut
+++ b/tests/misc/cut
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/date b/tests/misc/date
index 4a87e648a..ff18b4c0f 100755
--- a/tests/misc/date
+++ b/tests/misc/date
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/dircolors b/tests/misc/dircolors
index 01f221128..31614f9da 100755
--- a/tests/misc/dircolors
+++ b/tests/misc/dircolors
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/dirname b/tests/misc/dirname
index 0530175bf..6b9a8d7b7 100755
--- a/tests/misc/dirname
+++ b/tests/misc/dirname
@@ -17,16 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-PROG=`echo $0|sed 's,.*/,,'`; export PROG
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
@@ -44,7 +36,7 @@ my $stat_double = stat('//');
my $double_slash = ($stat_single->dev == $stat_double->dev
&& $stat_single->ino == $stat_double->ino) ? '/' : '//';
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $prog = 'dirname';
my @Tests =
(
diff --git a/tests/misc/expand b/tests/misc/expand
index b58ff2970..6a568be80 100755
--- a/tests/misc/expand
+++ b/tests/misc/expand
@@ -17,16 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-PROG=`echo $0|sed 's,.*/,,'`; export PROG
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
@@ -49,7 +41,7 @@ my @Tests =
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $prog = 'expand';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF
diff --git a/tests/misc/expr b/tests/misc/expr
index 360d90583..6d2cbbd1f 100755
--- a/tests/misc/expr
+++ b/tests/misc/expr
@@ -17,14 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
diff --git a/tests/misc/factor b/tests/misc/factor
index ebe0d6434..a350ca9e3 100755
--- a/tests/misc/factor
+++ b/tests/misc/factor
@@ -18,14 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
diff --git a/tests/misc/fmt b/tests/misc/fmt
index 0cc9ba251..49067ad9b 100755
--- a/tests/misc/fmt
+++ b/tests/misc/fmt
@@ -18,14 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
# 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/misc/fold b/tests/misc/fold
index a43ebf12f..960d6893d 100755
--- a/tests/misc/fold
+++ b/tests/misc/fold
@@ -17,16 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-PROG=`echo $0|sed 's,.*/,,'`; export PROG
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
# Ensure that we don't run an older version of fold.
# Prior to 5.0.91, some of the tests below would cause fold to infloop,
@@ -63,7 +55,7 @@ my @Tests =
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $prog = 'fold';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF
diff --git a/tests/misc/head-elide-tail b/tests/misc/head-elide-tail
index 4bdcf535b..4de108d4a 100755
--- a/tests/misc/head-elide-tail
+++ b/tests/misc/head-elide-tail
@@ -2,7 +2,7 @@
# -*- perl -*-
# Exercise head's --bytes=-N option.
-# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 2007 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
@@ -17,14 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/ls-misc b/tests/misc/ls-misc
index 9e0706577..9290eb4d7 100755
--- a/tests/misc/ls-misc
+++ b/tests/misc/ls-misc
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
diff --git a/tests/misc/md5sum b/tests/misc/md5sum
index 1b12e83ad..ca23d9432 100755
--- a/tests/misc/md5sum
+++ b/tests/misc/md5sum
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/md5sum-newline b/tests/misc/md5sum-newline
index df3254e71..41139816a 100755
--- a/tests/misc/md5sum-newline
+++ b/tests/misc/md5sum-newline
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
# 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/mktemp b/tests/misc/mktemp
index ed4b3c2bf..affb0d17c 100755
--- a/tests/misc/mktemp
+++ b/tests/misc/mktemp
@@ -18,14 +18,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/od b/tests/misc/od
index bf41c3846..498e57a85 100755
--- a/tests/misc/od
+++ b/tests/misc/od
@@ -17,16 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-PROG=`echo $0|sed 's,.*/,,'`; export PROG
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
me=`echo $0|sed 's,.*/,,'`
@@ -78,7 +70,7 @@ my @Tests =
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $prog = 'od';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF
diff --git a/tests/misc/paste-no-nl b/tests/misc/paste-no-nl
index aa5049c7a..ec2399182 100755
--- a/tests/misc/paste-no-nl
+++ b/tests/misc/paste-no-nl
@@ -2,7 +2,7 @@
# -*- perl -*-
# Ensure that paste properly handles files lacking a final newline.
-# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 2007 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
@@ -17,14 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/pr b/tests/misc/pr
index 0b7e0a210..550c6d6f2 100755
--- a/tests/misc/pr
+++ b/tests/misc/pr
@@ -17,15 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/pwd-long b/tests/misc/pwd-long
index 5e5b5ad5d..6ab218810 100755
--- a/tests/misc/pwd-long
+++ b/tests/misc/pwd-long
@@ -16,13 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=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
-}
+: ${srcdir=.}
+. $srcdir/../require-perl
. $srcdir/../test-lib.sh
diff --git a/tests/misc/seq b/tests/misc/seq
index 3365d9521..9c1e48f01 100755
--- a/tests/misc/seq
+++ b/tests/misc/seq
@@ -17,14 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
diff --git a/tests/misc/sha1sum b/tests/misc/sha1sum
index 62de889d7..b7d288fa2 100755
--- a/tests/misc/sha1sum
+++ b/tests/misc/sha1sum
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/sha1sum-vec b/tests/misc/sha1sum-vec
index 2dd666c39..b00ece284 100755
--- a/tests/misc/sha1sum-vec
+++ b/tests/misc/sha1sum-vec
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/sha224sum b/tests/misc/sha224sum
index 1fdfd3d50..022379cad 100755
--- a/tests/misc/sha224sum
+++ b/tests/misc/sha224sum
@@ -16,16 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-PROG=`echo $0|sed 's,.*/,,'`; export PROG
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
@@ -58,7 +50,7 @@ foreach $t (@Tests)
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $prog = 'sha224sum';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF
diff --git a/tests/misc/sha256sum b/tests/misc/sha256sum
index f4f25d863..f28ef8ff1 100755
--- a/tests/misc/sha256sum
+++ b/tests/misc/sha256sum
@@ -16,16 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-PROG=`echo $0|sed 's,.*/,,'`; export PROG
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
@@ -64,7 +56,7 @@ foreach $t (@Tests)
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $prog = 'sha256sum';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF
diff --git a/tests/misc/sha384sum b/tests/misc/sha384sum
index bfb9ed092..0eb55872f 100755
--- a/tests/misc/sha384sum
+++ b/tests/misc/sha384sum
@@ -16,16 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-PROG=`echo $0|sed 's,.*/,,'`; export PROG
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
@@ -64,7 +56,7 @@ foreach $t (@Tests)
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $prog = 'sha384sum';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF
diff --git a/tests/misc/sha512sum b/tests/misc/sha512sum
index 55798fc70..5977915fc 100755
--- a/tests/misc/sha512sum
+++ b/tests/misc/sha512sum
@@ -16,16 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-PROG=`echo $0|sed 's,.*/,,'`; export PROG
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
@@ -64,7 +56,7 @@ foreach $t (@Tests)
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $prog = 'sha512sum';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF
diff --git a/tests/misc/sort-merge b/tests/misc/sort-merge
index 2795b60f5..7ac9f8440 100755
--- a/tests/misc/sort-merge
+++ b/tests/misc/sort-merge
@@ -1,7 +1,7 @@
#!/bin/sh
# Test "sort -m".
-# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005-2007 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
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/stat-printf b/tests/misc/stat-printf
index 60d7b6ffa..f175ba1f0 100755
--- a/tests/misc/stat-printf
+++ b/tests/misc/stat-printf
@@ -1,7 +1,7 @@
#!/bin/sh
# Test "stat --printf".
-# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2005-2007 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
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/sum b/tests/misc/sum
index d87bdd03f..14871ec2d 100755
--- a/tests/misc/sum
+++ b/tests/misc/sum
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/sum-sysv b/tests/misc/sum-sysv
index 5181cff0a..d960f9818 100755
--- a/tests/misc/sum-sysv
+++ b/tests/misc/sum-sysv
@@ -21,11 +21,8 @@ if test "$VERBOSE" = yes; then
sum --version
fi
-$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
-}
+: ${srcdir=.}
+. $srcdir/../require-perl
# Avoid a problem when run in a UTF-8 locale.
# Otherwise, Perl would try to (and fail to) interpret
diff --git a/tests/misc/test-diag b/tests/misc/test-diag
index 9f0c7cd70..b7d899b63 100755
--- a/tests/misc/test-diag
+++ b/tests/misc/test-diag
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/tsort b/tests/misc/tsort
index 9a078aec4..440c60e2d 100755
--- a/tests/misc/tsort
+++ b/tests/misc/tsort
@@ -17,14 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/tty-eof b/tests/misc/tty-eof
index 086f19cd6..1de1d1f82 100755
--- a/tests/misc/tty-eof
+++ b/tests/misc/tty-eof
@@ -17,13 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=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
-}
+: ${srcdir=.}
+. $srcdir/../require-perl
# Ensure that $TMPDIR is valid.
TMPDIR=.; export TMPDIR
diff --git a/tests/misc/unexpand b/tests/misc/unexpand
index e35434403..d2762f12a 100755
--- a/tests/misc/unexpand
+++ b/tests/misc/unexpand
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/wc-files0-from b/tests/misc/wc-files0-from
index 6d0bb8c99..61340d66a 100755
--- a/tests/misc/wc-files0-from
+++ b/tests/misc/wc-files0-from
@@ -3,7 +3,7 @@
# Exercise wc's --files0-from option.
# This file bears a striking resemblance to tests/du/files0-from.
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2007 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,17 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-
-PROG=`echo $0|sed 's,.*/,,'`; export PROG
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/misc/xstrtol b/tests/misc/xstrtol
index 7fdc4da56..874b4a502 100755
--- a/tests/misc/xstrtol
+++ b/tests/misc/xstrtol
@@ -21,14 +21,8 @@ if test "$VERBOSE" = yes; then
pr --version
fi
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/mv/i-1 b/tests/mv/i-1
index 0fee59cb2..326d72e1a 100755
--- a/tests/mv/i-1
+++ b/tests/mv/i-1
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /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
-}
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
diff --git a/tests/require-perl b/tests/require-perl
new file mode 100644
index 000000000..1f98edfe4
--- /dev/null
+++ b/tests/require-perl
@@ -0,0 +1,6 @@
+: ${PERL=perl}
+$PERL -e 'use warnings' > /dev/null 2>&1 || {
+ echo 1>&2 "$0: configure did not find a usable version of Perl," \
+ "so skipping this test"
+ (exit 77); exit 77
+}
diff --git a/tests/rm/empty-name b/tests/rm/empty-name
index 1384a2fd1..a250985c9 100755
--- a/tests/rm/empty-name
+++ b/tests/rm/empty-name
@@ -21,11 +21,8 @@
# actually remove files with names of entries in the current directory
# but relative to `/' rather than relative to the current directory.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /dev/null 2>&1 ||
- skip_test_ "configure didn't find a usable version of Perl"
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
diff --git a/tests/rm/fail-eperm b/tests/rm/fail-eperm
index c619574ce..4abc9dec6 100755
--- a/tests/rm/fail-eperm
+++ b/tests/rm/fail-eperm
@@ -29,11 +29,8 @@ fi
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 1 > /dev/null 2>&1 ||
- skip_test_ "configure didn't find a usable version of Perl"
+. $srcdir/../require-perl
ARGV_0=$0
export ARGV_0
diff --git a/tests/rm/unreadable b/tests/rm/unreadable
index 05024c2dc..4fb40235c 100755
--- a/tests/rm/unreadable
+++ b/tests/rm/unreadable
@@ -16,11 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
: ${srcdir=.}
-
-$PERL -e 'use warnings;' > /dev/null 2>&1 ||
- skip_test_ "configure didn't find a usable version of Perl"
+. $srcdir/../require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF