tests: remove ugly /bin/sh wrapper around each perl-based test script
authorJim Meyering <meyering@redhat.com>
Wed, 14 May 2008 07:37:02 +0000 (09:37 +0200)
committerJim Meyering <meyering@redhat.com>
Sat, 17 May 2008 06:27:58 +0000 (08:27 +0200)
* tests/check.mk (TESTS_ENVIRONMENT): Save and restore TMPDIR around
envvar-check, so that the few scripts that require $TMPDIR don't fail.
This is also good to let a user's default TMPDIR setting be used e.g.,
in the search for an 'other-partition'.
FIXME: this is pretty ugly.  maybe undo it and find a better way.
(TESTS_ENVIRONMENT): Invoke perl scripts with $(PERL), and use -T
if the script requires that.  Otherwise, use $(SHELL).

* tests/misc/md5sum-newline: Create a file whose name contains
a newline in Perl (resort to using "system", since open refuses).

Fix old brokenness exposed by this change:
* tests/du/files0-from: Correct test not to rely on stdin
being attached to a non-tty.
* tests/misc/sort (3g, 3h, 3i): Likewise: add explicit empty input file.
Avoid warnings about using qw()-around-commas.

* tests/rm/fail-eperm: Now that this test is run from a temporary
subdirectory, adjust the full name of the "rm" program we're going
to run.

Change #!/bin/sh to #!/usr/bin/perl, and factor out the few lines
of boilerplate code to invoke perl.  Do not "require 5.00x";
a configure-time Perl test handles that
* tests/dd/skip-seek:
* tests/misc/base64:
* tests/misc/basename:
* tests/misc/cut:
* tests/misc/date:
* tests/misc/dircolors:
* tests/misc/dirname:
* tests/misc/expand:
* tests/misc/expr:
* tests/misc/factor:
* tests/misc/fmt:
* tests/misc/fold:
* tests/misc/head:
* tests/misc/head-elide-tail:
* tests/misc/join:
* tests/misc/ls-misc:
* tests/misc/md5sum:
* tests/misc/md5sum-newline:
* tests/misc/mktemp:
* tests/misc/od:
* tests/misc/paste:
* tests/misc/pr:
* tests/misc/printf-cov:
* tests/misc/seq:
* tests/misc/sha1sum:
* tests/misc/sha1sum-vec:
* tests/misc/sha224sum:
* tests/misc/sha256sum:
* tests/misc/sha384sum:
* tests/misc/sha512sum:
* tests/misc/sort-merge:
* tests/misc/stat-printf:
* tests/misc/sum:
* tests/misc/tac:
* tests/misc/tail:
* tests/misc/test:
* tests/misc/test-diag:
* tests/misc/tr:
* tests/misc/tsort:
* tests/misc/tty-eof:
* tests/misc/unexpand:
* tests/misc/uniq:
* tests/misc/wc:
* tests/misc/wc-files0-from:
* tests/misc/xstrtol:
* tests/mv/i-1:
* tests/pr/pr-tests:
* tests/rm/empty-name:
* tests/rm/fail-eperm:
* tests/rm/unreadable:

54 files changed:
tests/Coreutils.pm
tests/check.mk
tests/dd/skip-seek
tests/du/files0-from
tests/misc/base64
tests/misc/basename
tests/misc/cut
tests/misc/date
tests/misc/dircolors
tests/misc/dirname
tests/misc/expand
tests/misc/expr
tests/misc/factor
tests/misc/fmt
tests/misc/fold
tests/misc/head
tests/misc/head-elide-tail
tests/misc/join
tests/misc/ls-misc
tests/misc/md5sum
tests/misc/md5sum-newline
tests/misc/mktemp
tests/misc/od
tests/misc/paste
tests/misc/pr
tests/misc/printf-cov
tests/misc/seq
tests/misc/sha1sum
tests/misc/sha1sum-vec
tests/misc/sha224sum
tests/misc/sha256sum
tests/misc/sha384sum
tests/misc/sha512sum
tests/misc/sort
tests/misc/sort-merge
tests/misc/stat-printf
tests/misc/sum
tests/misc/tac
tests/misc/tail
tests/misc/test
tests/misc/test-diag
tests/misc/tr
tests/misc/tsort
tests/misc/tty-eof
tests/misc/unexpand
tests/misc/uniq
tests/misc/wc
tests/misc/wc-files0-from
tests/misc/xstrtol
tests/mv/i-1
tests/pr/pr-tests
tests/rm/empty-name
tests/rm/fail-eperm
tests/rm/unreadable

index 3245eda..bfb4f13 100644 (file)
@@ -16,7 +16,6 @@ package Coreutils;
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-require 5.003;
 use strict;
 use vars qw($VERSION @ISA @EXPORT);
 
index 945d543..feb4fc0 100644 (file)
@@ -49,11 +49,14 @@ built_programs = \
 # variables to test scripts.
 TESTS_ENVIRONMENT =                            \
   . $(top_srcdir)/tests/lang-default;          \
+  tmp__=$$TMPDIR; test -d $tmp__ || tmp__=.;   \
   . $(top_srcdir)/tests/envvar-check;          \
+  TMPDIR=$$tmp__; export TMPDIR;               \
   shell_or_perl_() {                           \
-    if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then                \
-      if $(PERL) -e 'use warnings' > /dev/null 2>&1; then      \
-        $(PERL) -w -I$(top_srcdir)/tests -MCoreutils           \
+    if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then                        \
+      if $(PERL) -e 'use warnings' > /dev/null 2>&1; then              \
+       grep '^\#!/usr/bin/perl -T' "$$1" > /dev/null && T_=T || T_=;   \
+        $(PERL) -w$$T_ -I$(top_srcdir)/tests -MCoreutils               \
              -M"CuTmpdir qw($$tst)" -- "$$1";  \
       else                                     \
        echo 1>&2 "$$tst: configure did not find a usable version of Perl," \
index 7a0c117..0608877 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Test dd's skip and seek options.
 
 # Copyright (C) 2000-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-SCRIPT_NAME=$0
-export SCRIPT_NAME
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -33,7 +23,6 @@ use strict;
 # Turn off localization of executable's output.
 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
 my $out = 'out';
-my $script_name = $ENV{SCRIPT_NAME};
 
 my @Tests =
     (
@@ -87,4 +76,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'dd';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 000a111..26a7499 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Exercise du's --files0-from option.
 
 # Copyright (C) 2004, 2005, 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-#/
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -47,8 +39,8 @@ my @Tests =
     {ERR => "du: cannot open `missing' for reading: "
      . "No such file or directory\n"}],
 
-   # empty input
-   ['empty', '--files0-from=-'],
+   # empty input, regular file
+   ['empty', '--files0-from=@AUX@', {AUX=>''}],
 
    # empty input, from non-regular file
    ['empty-nonreg', '--files0-from=/dev/null'],
@@ -95,4 +87,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index f443298..71d4564 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Exercise base64.
 
 # Copyright (C) 2006-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -159,4 +152,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'base64';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 65575c0..d35a406 100755 (executable)
@@ -1,6 +1,5 @@
-#!/bin/sh
-# -*-perl-*-
-
+#!/usr/bin/perl
+# Test basename.
 # Copyright (C) 2006-2008 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 use File::stat;
 
@@ -84,4 +77,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 67e280b..87d06c6 100755 (executable)
@@ -1,5 +1,5 @@
-#!/bin/sh
-# Test "cut".                                                   -*- perl -*-
+#!/usr/bin/perl
+# Test "cut".
 
 # Copyright (C) 2006-2008 Free Software Foundation, Inc.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $ME = $0) =~ s|.*/||;
@@ -162,4 +156,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($ME, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 0ab805e..fb700b5 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "date".
 
 # Copyright (C) 2005-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $ME = $0) =~ s|.*/||;
@@ -318,4 +312,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'date';
 my $fail = run_tests ($ME, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 85eb214..b6ab70d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Simple dircolors tests.
 
 # Copyright (C) 1998, 2003, 2005-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -50,4 +44,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'dircolors';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 4a1de34..de566a7 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*-perl-*-
+#!/usr/bin/perl
 # Test "dirname".
 
 # Copyright (C) 2006-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 use File::stat;
 
@@ -78,4 +71,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 114e9bf..b386737 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Exercise expand.
 
 # Copyright (C) 2004-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-#/
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -44,4 +36,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'expand';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 032db00..ab330e2 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*-perl-*-
+#!/usr/bin/perl
 # Basic tests for "expr".
 
 # Copyright (C) 2001, 2003-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -176,4 +169,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 9319d3f..d44bdac 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*-perl-*-
+#!/usr/bin/perl
 # Basic tests for "factor".
 
 # Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005, 2007-2008 Free Software
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -103,4 +96,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index b10c6c0..4925926 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Basic tests for "fmt".
 
 # Copyright (C) 2001, 2002, 2003, 2004, 2005-2008 Free Software
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/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
-# interpolated into strings (to perform substitution) in Coreutils.pm.
-LC_ALL=C
-export LC_ALL
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -76,4 +63,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'fmt';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index baf5b68..53c947b 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Exercise fold.
 
 # Copyright (C) 2003, 2005-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/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,
-# and since `make check' might be run even after a build failure, it'd
-# expose just such an older version.
-ver=`fold --version|sed 1q`
-case $ver in
-  *" $PACKAGE_VERSION") ;;
-  *) echo 1>&2 \
-   "$0: found unexpected version of fold, \`$ver'" \
-     "(expected $PACKAGE_VERSION)"
-  exit 1;;
-esac
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-#/
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -58,4 +37,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'fold';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index d4d55e2..d436fcd 100755 (executable)
@@ -1,5 +1,5 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
+# test head
 
 # Copyright (C) 2008 Free Software Foundation, Inc.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${top_srcdir=../..}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 my $prog = 'head';
@@ -87,4 +81,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 961dc98..07098c0 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Exercise head's --bytes=-N option.
 
 # Copyright (C) 2003, 2005, 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-#/
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -113,4 +105,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index bfb0d01..772c2c4 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test join.
 
 # Copyright (C) 2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 # Turn off localization of executable's output.
@@ -224,4 +218,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index f917acd..dd9febd 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 
 # Copyright (C) 1998, 2000-2008 Free Software Foundation, Inc.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -237,4 +230,3 @@ $ENV{LS_COLORS} = $e;
 setuid_setup;
 $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 28927f5..c99d6bb 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Basic tests for "md5sum".
 
 # Copyright (C) 1998-1999, 2003, 2005, 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 my $prog = 'md5sum';
@@ -88,4 +82,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index ed6b85c..ef1bbcc 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Newline tests for "md5sum".
 
 # Copyright (C) 1999, 2000, 2003, 2005, 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/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
-# error output if it fails.
-(> 'a
-b') 2> /dev/null \
-  && filename_may_contain_newline=yes \
-  || filename_may_contain_newline=no
-rm -f 'a
-b'
-
-if test $filename_may_contain_newline = no; then
-  skip_test_ "failed to create newline-containing file name"
-fi
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -43,6 +23,11 @@ use strict;
 # Turn off localization of executable's output.
 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
 
+# See if we can create a file name that contains a newline.
+# Use system, since Perl doesn't let you do this with "open".
+system ('touch', "a\nb") == 0
+  or (warn "$0: failed to create newline-containing file name\n"), exit 77;
+
 my $degenerate = "d41d8cd98f00b204e9800998ecf8427e";
 my $t = '--text';
 
@@ -57,4 +42,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'md5sum';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 835b438..616a9e4 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "mktemp".
 
 # Copyright (C) 2007-2008 Free Software Foundation, Inc.
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $ME = $0) =~ s|.*/||;
@@ -112,4 +104,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($ME, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index ef4314a..62f43c5 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Exercise od
 
 # Copyright (C) 2006-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -73,4 +65,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'od';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 3fe6c87..b6fb169 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Test paste.
 
 # Copyright (C) 2003, 2005, 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-#/
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -71,4 +63,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 1badb83..ae48e3c 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Exercise a bug with pr -m -s
 
 # Copyright (C) 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-#/
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -49,4 +41,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 98616d6..0f8decf 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # improve printf.c test coverage
 
 # Copyright (C) 2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${top_srcdir=../..}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 my $prog = 'printf';
@@ -106,4 +99,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, \$prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index c04e9fa..f68d74c 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Test "seq".
 
 # Copyright (C) 1999, 2000, 2003, 2005-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -114,4 +107,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 0dff347..a05295b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "sha1sum".
 
 # Copyright (C) 2000, 2003, 2005-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 my $prog = 'sha1sum';
@@ -82,4 +76,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index ef75b49..4cc71e3 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Sample vectors for "sha1sum".
 
 # Copyright (C) 2000, 2001, 2003, 2005, 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -538,4 +532,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'sha1sum';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index ac63318..cb20cc9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "sha224sum".
 
 # Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -53,4 +47,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'sha224sum';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 16eb0c6..b5de1d4 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "sha256sum".
 
 # Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -59,4 +53,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'sha256sum';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 1337642..e510655 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "sha384sum".
 
 # Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -59,4 +53,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'sha384sum';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 696c504..7dbabb3 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "sha512sum".
 
 # Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -59,4 +53,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'sha512sum';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index ff278b9..f26bc5f 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 
 # Copyright (C) 2008 Free Software Foundation, Inc.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${top_srcdir=../..}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 my $prog = 'sort';
@@ -60,7 +53,7 @@ my @Tests =
 ["02a", '-c', {IN=>"A\nB\nC\n"}, {OUT=>''}],
 ["02b", '-c', {IN=>"A\nC\nB\n"}, {OUT=>''}, {EXIT=>1},
  {ERR=>"$prog: -:3: disorder: B\n"}, $normalize_filename],
-["02c", qw(-c -k1,1), {IN=>"a\na b\n"}, {OUT=>''}],
+["02c", '-c -k1,1', {IN=>"a\na b\n"}, {OUT=>''}],
 ["02d", '-C', {IN=>"A\nB\nC\n"}, {OUT=>''}],
 ["02e", '-C', {IN=>"A\nC\nB\n"}, {OUT=>''}, {EXIT=>1}],
 # This should fail because there are duplicate keys
@@ -74,7 +67,7 @@ my @Tests =
 #
 ["03a", '-k1', {IN=>"B\nA\n"}, {OUT=>"A\nB\n"}],
 ["03b", '-k1,1', {IN=>"B\nA\n"}, {OUT=>"A\nB\n"}],
-["03c", qw(-k1 -k2), {IN=>"A b\nA a\n"}, {OUT=>"A a\nA b\n"}],
+["03c", '-k1 -k2', {IN=>"A b\nA a\n"}, {OUT=>"A a\nA b\n"}],
 # Fail with a diagnostic when -k specifies field == 0.
 ["03d", '-k0', {EXIT=>2},
  {ERR=>"$prog: -: invalid field specification `0'\n"},
@@ -85,11 +78,11 @@ my @Tests =
 ["03f", '-k1.1,-k0', {EXIT=>2},
  {ERR=>"$prog: invalid number after `,': invalid count at start of `-k0'\n"}],
 # This is ok.
-["03g", '-k1.1,1.0'],
+["03g", '-k1.1,1.0', {IN=>''}],
 # This is equivalent to 3f.
-["03h", '-k1.1,1'],
+["03h", '-k1.1,1', {IN=>''}],
 # This too, is equivalent to 3f.
-["03i", '-k1,1'],
+["03i", '-k1,1', {IN=>''}],
 #
 ["04a", '-nc', {IN=>"2\n11\n"}],
 ["04b", '-n', {IN=>"11\n2\n"}, {OUT=>"2\n11\n"}],
@@ -99,28 +92,28 @@ my @Tests =
 #
 ["05a", '-k1,2', {IN=>"A B\nA A\n"}, {OUT=>"A A\nA B\n"}],
 ["05b", '-k1,2', {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
-["05c", qw(-k1 -k2), {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
+["05c", '-k1 -k2', {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
 ["05d", '-k2,2', {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
 ["05e", '-k2,2', {IN=>"A B Z\nA A A\n"}, {OUT=>"A A A\nA B Z\n"}],
 ["05f", '-k2,2', {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
 #
-["06a", qw(-k 1,2), {IN=>"A B\nA A\n"}, {OUT=>"A A\nA B\n"}],
-["06b", qw(-k 1,2), {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
-["06c", qw(-k 1 -k 2), {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
-["06d", qw(-k 2,2), {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
-["06e", qw(-k 2,2), {IN=>"A B Z\nA A A\n"}, {OUT=>"A A A\nA B Z\n"}],
-["06f", qw(-k 2,2), {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
+["06a", '-k 1,2', {IN=>"A B\nA A\n"}, {OUT=>"A A\nA B\n"}],
+["06b", '-k 1,2', {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
+["06c", '-k 1 -k 2', {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
+["06d", '-k 2,2', {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
+["06e", '-k 2,2', {IN=>"A B Z\nA A A\n"}, {OUT=>"A A A\nA B Z\n"}],
+["06f", '-k 2,2', {IN=>"A B A\nA A Z\n"}, {OUT=>"A A Z\nA B A\n"}],
 #
-["07a", qw(-k 2,3), {IN=>"9 a b\n7 a a\n"}, {OUT=>"7 a a\n9 a b\n"}],
-["07b", qw(-k 2,3), {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}],
-["07c", qw(-k 2,3), {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}],
-["07d", qw(+1 -3), {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}],
+["07a", '-k 2,3', {IN=>"9 a b\n7 a a\n"}, {OUT=>"7 a a\n9 a b\n"}],
+["07b", '-k 2,3', {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}],
+["07c", '-k 2,3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}],
+["07d", '+1 -3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}],
 #
 # report an error for `.' without following char spec
-["08a", qw(-k 2.,3), {EXIT=>2},
+["08a", '-k 2.,3', {EXIT=>2},
  {ERR=>"$prog: invalid number after `.': invalid count at start of `,3'\n"}],
 # report an error for `,' without following POS2
-["08b", qw(-k 2,), {EXIT=>2},
+["08b", '-k 2,', {EXIT=>2},
  {ERR=>"$prog: invalid number after `,': invalid count at start of `'\n"}],
 #
 # Test new -g option.
@@ -131,61 +124,61 @@ my @Tests =
 ["09d", '-k2g', {IN=>"a 1e2\nb 2e1\n"}, {OUT=>"b 2e1\na 1e2\n"}],
 #
 # Bug reported by Roger Peel <R.Peel@ee.surrey.ac.uk>
-["10a", qw(-t : -k 2.2,2.2), {IN=>":ba\n:ab\n"}, {OUT=>":ba\n:ab\n"}],
+["10a", '-t : -k 2.2,2.2', {IN=>":ba\n:ab\n"}, {OUT=>":ba\n:ab\n"}],
 # Equivalent to above, but using obsolescent `+pos -pos' option syntax.
-["10b", qw(-t : +1.1 -1.2), {IN=>":ba\n:ab\n"}, {OUT=>":ba\n:ab\n"}],
+["10b", '-t : +1.1 -1.2', {IN=>":ba\n:ab\n"}, {OUT=>":ba\n:ab\n"}],
 #
 # The same as the preceding two, but with input lines reversed.
-["10c", qw(-t : -k 2.2,2.2), {IN=>":ab\n:ba\n"}, {OUT=>":ba\n:ab\n"}],
+["10c", '-t : -k 2.2,2.2', {IN=>":ab\n:ba\n"}, {OUT=>":ba\n:ab\n"}],
 # Equivalent to above, but using obsolescent `+pos -pos' option syntax.
-["10d", qw(-t : +1.1 -1.2), {IN=>":ab\n:ba\n"}, {OUT=>":ba\n:ab\n"}],
+["10d", '-t : +1.1 -1.2', {IN=>":ab\n:ba\n"}, {OUT=>":ba\n:ab\n"}],
 # Try without -t...
 # But note that we have to count the delimiting space at the beginning
 # of each field that has it.
-["10a0", qw(-k 2.3,2.3), {IN=>"z ba\nz ab\n"}, {OUT=>"z ba\nz ab\n"}],
-["10a1", qw(-k 1.2,1.2), {IN=>"ba\nab\n"}, {OUT=>"ba\nab\n"}],
-["10a2", qw(-b -k 2.2,2.2), {IN=>"z ba\nz ab\n"}, {OUT=>"z ba\nz ab\n"}],
+["10a0", '-k 2.3,2.3', {IN=>"z ba\nz ab\n"}, {OUT=>"z ba\nz ab\n"}],
+["10a1", '-k 1.2,1.2', {IN=>"ba\nab\n"}, {OUT=>"ba\nab\n"}],
+["10a2", '-b -k 2.2,2.2', {IN=>"z ba\nz ab\n"}, {OUT=>"z ba\nz ab\n"}],
 #
 # An even simpler example demonstrating the bug.
-["10e", qw(-k 1.2,1.2), {IN=>"ab\nba\n"}, {OUT=>"ba\nab\n"}],
+["10e", '-k 1.2,1.2', {IN=>"ab\nba\n"}, {OUT=>"ba\nab\n"}],
 #
 # The way sort works on these inputs (10f and 10g) seems wrong to me.
 # See http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=3c467c0d223
 # POSIX doesn't seem to say one way or the other, but that's the way all
 # other sort implementations work.
-["10f", qw(-t : -k 1.3,1.3), {IN=>":ab\n:ba\n"}, {OUT=>":ba\n:ab\n"}],
-["10g", qw(-k 1.4,1.4), {IN=>"a ab\nb ba\n"}, {OUT=>"b ba\na ab\n"}],
+["10f", '-t : -k 1.3,1.3', {IN=>":ab\n:ba\n"}, {OUT=>":ba\n:ab\n"}],
+["10g", '-k 1.4,1.4', {IN=>"a ab\nb ba\n"}, {OUT=>"b ba\na ab\n"}],
 #
 # Exercise bug re using -b to skip trailing blanks.
-["11a", qw(-t: -k1,1b -k2,2), {IN=>"a\t:a\na :b\n"}, {OUT=>"a\t:a\na :b\n"}],
-["11b", qw(-t: -k1,1b -k2,2), {IN=>"a :b\na\t:a\n"}, {OUT=>"a\t:a\na :b\n"}],
-["11c", qw(-t: -k2,2b -k3,3), {IN=>"z:a\t:a\na :b\n"}, {OUT=>"z:a\t:a\na :b\n"}],
+["11a", '-t: -k1,1b -k2,2', {IN=>"a\t:a\na :b\n"}, {OUT=>"a\t:a\na :b\n"}],
+["11b", '-t: -k1,1b -k2,2', {IN=>"a :b\na\t:a\n"}, {OUT=>"a\t:a\na :b\n"}],
+["11c", '-t: -k2,2b -k3,3', {IN=>"z:a\t:a\na :b\n"}, {OUT=>"z:a\t:a\na :b\n"}],
 # Before 1.22m, the first key comparison reported equality.
 # With 1.22m, they compare different: "a" sorts before "a\n",
 # and the second key spec isn't even used.
-["11d", qw(-t: -k2,2b -k3,3), {IN=>"z:a :b\na\t:a\n"}, {OUT=>"a\t:a\nz:a :b\n"}],
+["11d", '-t: -k2,2b -k3,3', {IN=>"z:a :b\na\t:a\n"}, {OUT=>"a\t:a\nz:a :b\n"}],
 #
 # Exercise bug re comparing `-' and integers.
-["12a", qw(-n -t: +1), {IN=>"a:1\nb:-\n"}, {OUT=>"b:-\na:1\n"}],
-["12b", qw(-n -t: +1), {IN=>"b:-\na:1\n"}, {OUT=>"b:-\na:1\n"}],
+["12a", '-n -t: +1', {IN=>"a:1\nb:-\n"}, {OUT=>"b:-\na:1\n"}],
+["12b", '-n -t: +1', {IN=>"b:-\na:1\n"}, {OUT=>"b:-\na:1\n"}],
 # Try some other (e.g. `X') invalid character.
-["12c", qw(-n -t: +1), {IN=>"a:1\nb:X\n"}, {OUT=>"b:X\na:1\n"}],
-["12d", qw(-n -t: +1), {IN=>"b:X\na:1\n"}, {OUT=>"b:X\na:1\n"}],
+["12c", '-n -t: +1', {IN=>"a:1\nb:X\n"}, {OUT=>"b:X\na:1\n"}],
+["12d", '-n -t: +1', {IN=>"b:X\na:1\n"}, {OUT=>"b:X\na:1\n"}],
 # From Karl Heuer
 ["13a", '+0.1n', {IN=>"axx\nb-1\n"}, {OUT=>"b-1\naxx\n"}],
 ["13b", '+0.1n', {IN=>"b-1\naxx\n"}, {OUT=>"b-1\naxx\n"}],
 #
 # From Carl Johnson <carlj@cjlinux.home.org>
-["14a", qw(-d -u), {IN=>"mal\nmal-\nmala\n"}, {OUT=>"mal\nmala\n"}],
+["14a", '-d -u', {IN=>"mal\nmal-\nmala\n"}, {OUT=>"mal\nmala\n"}],
 # Be sure to fix the (translate && ignore) case in keycompare.
-["14b", qw(-f -d -u), {IN=>"mal\nmal-\nmala\n"}, {OUT=>"mal\nmala\n"}],
+["14b", '-f -d -u', {IN=>"mal\nmal-\nmala\n"}, {OUT=>"mal\nmala\n"}],
 #
 # Experiment with -i.
-["15a", qw(-i -u), {IN=>"a\na\1\n"}, {OUT=>"a\n"}],
-["15b", qw(-i -u), {IN=>"a\n\1a\n"}, {OUT=>"a\n"}],
-["15c", qw(-i -u), {IN=>"a\1\na\n"}, {OUT=>"a\1\n"}],
-["15d", qw(-i -u), {IN=>"\1a\na\n"}, {OUT=>"\1a\n"}],
-["15e", qw(-i -u), {IN=>"a\n\1\1\1\1\1a\1\1\1\1\n"}, {OUT=>"a\n"}],
+["15a", '-i -u', {IN=>"a\na\1\n"}, {OUT=>"a\n"}],
+["15b", '-i -u', {IN=>"a\n\1a\n"}, {OUT=>"a\n"}],
+["15c", '-i -u', {IN=>"a\1\na\n"}, {OUT=>"a\1\n"}],
+["15d", '-i -u', {IN=>"\1a\na\n"}, {OUT=>"\1a\n"}],
+["15e", '-i -u', {IN=>"a\n\1\1\1\1\1a\1\1\1\1\n"}, {OUT=>"a\n"}],
 
 # From Erick Branderhorst -- fixed around 1.19e
 ["16a", '-f',
@@ -201,7 +194,7 @@ my @Tests =
 
 # Just like above, because the global `-b' has no effect on the
 # key specifier when a key-specific option (`n' in this case) is used.
-["18b", qw(-b -k1.1,1.2n), {IN=>" 901\n100\n"}, {OUT=>" 901\n100\n"}],
+["18b", '-b -k1.1,1.2n', {IN=>" 901\n100\n"}, {OUT=>" 901\n100\n"}],
 
 # Here we're comparing ` 90' and `10', because the `b' on the key-end specifier
 # makes sort ignore leading blanks when determining that key's *end*.
@@ -213,15 +206,15 @@ my @Tests =
 
 # This compares `90' and `10', as it ignores leading blanks for both
 # key start and key end.
-["18e", qw(-nb -k1.1,1.2), {IN=>" 901\n100\n"}, {OUT=>"100\n 901\n"}],
+["18e", '-nb -k1.1,1.2', {IN=>" 901\n100\n"}, {OUT=>"100\n 901\n"}],
 
 # This looks odd, but works properly -- 2nd keyspec is never
 # used because all lines are different.
-["19a", qw(+0 +1nr), {IN=>"b 2\nb 1\nb 3\n"}, {OUT=>"b 1\nb 2\nb 3\n"}],
+["19a", '+0 +1nr', {IN=>"b 2\nb 1\nb 3\n"}, {OUT=>"b 1\nb 2\nb 3\n"}],
 
 # The test *intended* by the author of the above, but using the
 # more-intuitive POSIX-style -k options.
-["19b", qw(-k1,1 -k2nr), {IN=>"b 2\nb 1\nb 3\n"}, {OUT=>"b 3\nb 2\nb 1\n"}],
+["19b", '-k1,1 -k2nr', {IN=>"b 2\nb 1\nb 3\n"}, {OUT=>"b 3\nb 2\nb 1\n"}],
 
 # This test failed when sort-1.22 was compiled on a Next x86 system
 # without optimization.  Without optimization gcc uses the buggy version
@@ -243,8 +236,8 @@ my @Tests =
 ["21g", '-fu', {IN=>"a\n_\n"}, {OUT=>"a\n_\n"}],
 
 # This test failed until 1.22f.  From Zvi Har'El.
-["22a", qw(-k 2,2fd -k 1,1r), {IN=>"3 b\n4 B\n"}, {OUT=>"4 B\n3 b\n"}],
-["22b", qw(-k 2,2d  -k 1,1r), {IN=>"3 b\n4 b\n"}, {OUT=>"4 b\n3 b\n"}],
+["22a", '-k 2,2fd -k 1,1r', {IN=>"3 b\n4 B\n"}, {OUT=>"4 B\n3 b\n"}],
+["22b", '-k 2,2d  -k 1,1r', {IN=>"3 b\n4 b\n"}, {OUT=>"4 b\n3 b\n"}],
 
 ["no-file1", 'no-file', {EXIT=>2}, {ERR=>$no_file}],
 # This test failed until 1.22f.  Sort didn't give an error.
@@ -345,4 +338,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index b25876a..f90ba9b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "sort -m".
 
 # Copyright (C) 2002, 2003, 2005-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -40,4 +34,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'sort';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index fd720df..aef63ac 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "stat --printf".
 
 # Copyright (C) 2005-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $ME = $0) =~ s|.*/||;
@@ -68,4 +62,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($ME, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 7b99a42..4b891ec 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "sum".
 
 # Copyright (C) 2000, 2003, 2005-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -65,4 +59,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'sum';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index bc0c04c..2f9981d 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 
 # Copyright (C) 2008 Free Software Foundation, Inc.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${top_srcdir=../..}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 my $prog = 'tac';
@@ -74,4 +67,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 91d3bb5..dfbd3a8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test tail.
 
 # Copyright (C) 2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 my $prog = 'tail';
@@ -144,4 +138,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index e3090ce..43db2e1 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 
 # Copyright (C) 2008 Free Software Foundation, Inc.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${top_srcdir=../..}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 my $prog = 'test';
@@ -198,4 +191,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, \$prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index a9aa0a8..dc86db6 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test the diagnostics of "test".
 
 # Copyright (C) 2006-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -43,4 +37,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 76fdc88..3ab202e 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 
 # Copyright (C) 2008 Free Software Foundation, Inc.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${top_srcdir=../..}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 my $prog = 'tr';
@@ -202,4 +195,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 7d9c4ee..8561d11 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Test "tsort".
 
 # Copyright (C) 1999, 2000, 2003-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-#/
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -72,4 +64,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'tsort';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 314ae8c..8a1c389 100755 (executable)
@@ -1,6 +1,8 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Test whether programs exit upon a single EOF from a tty.
+# Ensure that e.g., cat exits upon a single EOF (^D) from a tty.
+# Do the same for all programs that can read stdin,
+# require no arguments and that write to standard output.
 
 # Copyright (C) 2003, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-# Ensure that $TMPDIR is valid.
-TMPDIR=.; export TMPDIR
-
-ARGV_0=$0
-export ARGV_0
-
-exec $PERL -w -- - <<\EOF
-
-# Ensure that cat exits upon a single EOF (^D) from a tty.
-# Do the same for all programs that can read stdin,
-# require no arguments and that write to standard output.
 use strict;
-
-(my $ME = $ENV{ARGV_0}) =~ s|.*/||;
+(my $ME = $0) =~ s|.*/||;
 
 # Some older versions of Expect.pm (e.g. 1.07) lack the log_user method,
 # so check for that, too.
@@ -121,4 +108,3 @@ $@ and (warn "$ME: this script requires Perl's Expect package >=1.11\n"),
 
   exit $fail
 }
-EOF
index a7546ff..3e3a3d1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "unexpand".
 
 # Copyright (C) 2000, 2003-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -91,4 +85,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 1c85735..0350864 100755 (executable)
@@ -1,5 +1,5 @@
-#!/bin/sh
-# Test for a subtle, system-and-locale-dependent bug in uniq.
+#!/usr/bin/perl
+# Test uniq.
 
 # Copyright (C) 2008 Free Software Foundation, Inc.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-case $LOCALE_FR in
-''|none) echo "$0: skipping this test -- no appropriate locale" 1>&2; exit 77;;
-esac
-
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 my $prog = 'uniq';
@@ -90,6 +80,11 @@ sub add_z_variants($)
 
 # I've only ever triggered the problem in a non-C locale.
 my $locale = $ENV{LOCALE_FR};
+if (! defined $locale || $locale eq 'none')
+  {
+    warn "$prog: skipping this test -- no appropriate locale\n";
+    exit 77;
+  }
 
 # See if isblank returns true for nbsp.
 my $x = `env printf '\xa0'| LC_ALL=$locale tr '[:blank:]' x`;
@@ -100,6 +95,7 @@ my $schar_exp = $x eq 'x' ? " y z\n" : $in;
 
 my @Tests =
 (
+  # Test for a subtle, system-and-locale-dependent bug in uniq.
  ['schar', '-f1',  {IN => $in}, {OUT => $schar_exp},
   {ENV => "LC_ALL=$locale"}],
  ['1', '', {IN=>''}, {OUT=>''}],
@@ -217,4 +213,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 96183c2..04b8085 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Basic tests for "wc".
 
 # Copyright (C) 1997, 2003, 2006, 2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 my $prog = 'wc';
@@ -54,4 +48,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 047cbce..85970ff 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
 # Exercise wc's --files0-from option.
 # This file bears a striking resemblance to tests/du/files0-from.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-#/
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -94,4 +86,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index d31df6d..0ebd32b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # exercise xstrtol's diagnostics via pr
 
 # Copyright (C) 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  pr --version
-fi
-
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $ME = $0) =~ s|.*/||;
@@ -59,4 +48,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($ME, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 4962813..c730fe9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Make sure a `n' reply to `mv -i...' aborts the move operation.
 
 # Copyright (C) 2001, 2003, 2005-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -48,4 +42,3 @@ my $verbose = $ENV{VERBOSE};
 my $prog = 'mv';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 7b53f23..b5fe2e0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test pr.
 
 # Copyright (C) 2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 # Turn off localization of executable's output.
@@ -446,4 +440,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index d940d01..31d0884 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Make sure that rm -r '' fails.
 
 # Copyright (C) 1998, 2003, 2005, 2007-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-
 # On SunOS 4.1.3, running rm -r '' in a nonempty directory may
 # actually remove files with names of entries in the current directory
 # but relative to `/' rather than relative to the current directory.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -49,4 +42,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF
index 57b33e8..8898311 100755 (executable)
@@ -1,5 +1,4 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl -Tw
 # Ensure that rm gives the expected diagnostic when failing to remove a file
 # owned by some other user in a directory with the sticky bit set.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  rm --version
-fi
-
-# FIXME-someday: when run as root we don't need all of the
-# searching below.  root can simply create the required
-# dir/files and run the test as someone else.
-
-ARGV_0=$0
-export ARGV_0
-
-exec $PERL -Tw -- - << \EOP
-require 5.003;
 use strict;
 
-(my $ME = $ENV{ARGV_0}) =~ s|.*/||;
+(my $ME = $0) =~ s|.*/||;
 
 my $uid = $<;
 # skip if root
@@ -51,7 +36,13 @@ delete @ENV{qw(BASH_ENV CDPATH ENV PATH)};
 $ENV{IFS}  = '';
 
 my @dir_list = qw(/tmp /var/tmp /usr/tmp);
-my $rm = '../src/rm';
+my $rm = "$ENV{abs_top_builddir}/src/rm";
+
+# Untaint for upcoming popen.
+$rm =~ m!^([-+\@\w./]+)$!
+  or (warn "$ME: unusual absolute builddir name; skipping this test\n"),
+    exit 77;
+$rm = $1;
 
 # Find a directory with the sticky bit set.
 my $found_dir;
@@ -160,4 +151,3 @@ if ( ! $found_file)
       . "...so, skipping this test\n";
     exit 77;
   }
-EOP
index e0fd93f..86c1a51 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/perl
 # Test "rm" and unreadable directories.
 
 # Copyright (C) 1998, 2003, 2005-2008 Free Software Foundation, Inc.
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-: ${srcdir=.}
-. $top_srcdir/tests/require-perl
-
-me=`echo $0|sed 's,.*/,,'`
-exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
-require 5.003;
 use strict;
 
 (my $program_name = $0) =~ s|.*/||;
@@ -54,4 +48,3 @@ my $verbose = $ENV{VERBOSE};
 
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-EOF