diff options
author | Jim Meyering <meyering@redhat.com> | 2008-05-14 09:37:02 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-05-17 08:27:58 +0200 |
commit | 1081bbc74e48010700783a9bb82a4657d1d02bd2 (patch) | |
tree | 41694f8ec4c2400349a367bb3680db8f09951438 | |
parent | ea54b6f47c92525267861e15314c61db83a86352 (diff) | |
download | coreutils-1081bbc74e48010700783a9bb82a4657d1d02bd2.tar.xz |
tests: remove ugly /bin/sh wrapper around each perl-based test script
* 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, 137 insertions, 579 deletions
diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm index 3245eda6e..bfb4f130e 100644 --- a/tests/Coreutils.pm +++ b/tests/Coreutils.pm @@ -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); diff --git a/tests/check.mk b/tests/check.mk index 945d543dc..feb4fc040 100644 --- a/tests/check.mk +++ b/tests/check.mk @@ -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," \ diff --git a/tests/dd/skip-seek b/tests/dd/skip-seek index 7a0c117fa..06088770f 100755 --- a/tests/dd/skip-seek +++ b/tests/dd/skip-seek @@ -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. @@ -17,15 +16,6 @@ # 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 diff --git a/tests/du/files0-from b/tests/du/files0-from index 000a1113f..26a749961 100755 --- a/tests/du/files0-from +++ b/tests/du/files0-from @@ -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. @@ -17,13 +16,6 @@ # 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 diff --git a/tests/misc/base64 b/tests/misc/base64 index f44329808..71d456432 100755 --- a/tests/misc/base64 +++ b/tests/misc/base64 @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Exercise base64. # Copyright (C) 2006-2008 Free Software Foundation, Inc. @@ -17,12 +16,6 @@ # 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 diff --git a/tests/misc/basename b/tests/misc/basename index 65575c020..d35a40683 100755 --- a/tests/misc/basename +++ b/tests/misc/basename @@ -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 @@ -16,12 +15,6 @@ # 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 diff --git a/tests/misc/cut b/tests/misc/cut index 67e280bed..87d06c6ab 100755 --- a/tests/misc/cut +++ b/tests/misc/cut @@ -1,5 +1,5 @@ -#!/bin/sh -# Test "cut". -*- perl -*- +#!/usr/bin/perl +# Test "cut". # Copyright (C) 2006-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/date b/tests/misc/date index 0ab805e33..fb700b50f 100755 --- a/tests/misc/date +++ b/tests/misc/date @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "date". # Copyright (C) 2005-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/dircolors b/tests/misc/dircolors index 85eb21480..b6ab70d25 100755 --- a/tests/misc/dircolors +++ b/tests/misc/dircolors @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Simple dircolors tests. # Copyright (C) 1998, 2003, 2005-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/dirname b/tests/misc/dirname index 4a1de34d0..de566a738 100755 --- a/tests/misc/dirname +++ b/tests/misc/dirname @@ -1,5 +1,4 @@ -#!/bin/sh -# -*-perl-*- +#!/usr/bin/perl # Test "dirname". # Copyright (C) 2006-2008 Free Software Foundation, Inc. @@ -17,12 +16,6 @@ # 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 diff --git a/tests/misc/expand b/tests/misc/expand index 114e9bfbb..b386737b1 100755 --- a/tests/misc/expand +++ b/tests/misc/expand @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Exercise expand. # Copyright (C) 2004-2008 Free Software Foundation, Inc. @@ -17,13 +16,6 @@ # 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 diff --git a/tests/misc/expr b/tests/misc/expr index 032db00fb..ab330e2cf 100755 --- a/tests/misc/expr +++ b/tests/misc/expr @@ -1,5 +1,4 @@ -#!/bin/sh -# -*-perl-*- +#!/usr/bin/perl # Basic tests for "expr". # Copyright (C) 2001, 2003-2008 Free Software Foundation, Inc. @@ -17,12 +16,6 @@ # 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 diff --git a/tests/misc/factor b/tests/misc/factor index 9319d3faa..d44bdacb1 100755 --- a/tests/misc/factor +++ b/tests/misc/factor @@ -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 @@ -18,12 +17,6 @@ # 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 diff --git a/tests/misc/fmt b/tests/misc/fmt index b10c6c018..4925926e0 100755 --- a/tests/misc/fmt +++ b/tests/misc/fmt @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Basic tests for "fmt". # Copyright (C) 2001, 2002, 2003, 2004, 2005-2008 Free Software @@ -18,18 +17,6 @@ # 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 diff --git a/tests/misc/fold b/tests/misc/fold index baf5b6809..53c947b6e 100755 --- a/tests/misc/fold +++ b/tests/misc/fold @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Exercise fold. # Copyright (C) 2003, 2005-2008 Free Software Foundation, Inc. @@ -17,26 +16,6 @@ # 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 diff --git a/tests/misc/head b/tests/misc/head index d4d55e208..d436fcdd7 100755 --- a/tests/misc/head +++ b/tests/misc/head @@ -1,5 +1,5 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl +# test head # Copyright (C) 2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/head-elide-tail b/tests/misc/head-elide-tail index 961dc9898..07098c04d 100755 --- a/tests/misc/head-elide-tail +++ b/tests/misc/head-elide-tail @@ -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. @@ -17,13 +16,6 @@ # 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 diff --git a/tests/misc/join b/tests/misc/join index bfb0d010f..772c2c4ad 100755 --- a/tests/misc/join +++ b/tests/misc/join @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test join. # Copyright (C) 2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/ls-misc b/tests/misc/ls-misc index f917acdf7..dd9febd00 100755 --- a/tests/misc/ls-misc +++ b/tests/misc/ls-misc @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Copyright (C) 1998, 2000-2008 Free Software Foundation, Inc. @@ -16,12 +15,6 @@ # 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 diff --git a/tests/misc/md5sum b/tests/misc/md5sum index 28927f56a..c99d6bbce 100755 --- a/tests/misc/md5sum +++ b/tests/misc/md5sum @@ -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. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/md5sum-newline b/tests/misc/md5sum-newline index ed6b85ceb..ef1bbcceb 100755 --- a/tests/misc/md5sum-newline +++ b/tests/misc/md5sum-newline @@ -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. @@ -16,26 +16,6 @@ # 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 diff --git a/tests/misc/mktemp b/tests/misc/mktemp index 835b43858..616a9e44f 100755 --- a/tests/misc/mktemp +++ b/tests/misc/mktemp @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "mktemp". # Copyright (C) 2007-2008 Free Software Foundation, Inc. @@ -14,16 +14,8 @@ # 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 diff --git a/tests/misc/od b/tests/misc/od index ef4314a77..62f43c598 100755 --- a/tests/misc/od +++ b/tests/misc/od @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Exercise od # Copyright (C) 2006-2008 Free Software Foundation, Inc. @@ -17,13 +16,6 @@ # 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 diff --git a/tests/misc/paste b/tests/misc/paste index 3fe6c87bb..b6fb169c8 100755 --- a/tests/misc/paste +++ b/tests/misc/paste @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Test paste. # Copyright (C) 2003, 2005, 2007-2008 Free Software Foundation, Inc. @@ -17,13 +16,6 @@ # 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 diff --git a/tests/misc/pr b/tests/misc/pr index 1badb83a4..ae48e3c00 100755 --- a/tests/misc/pr +++ b/tests/misc/pr @@ -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. @@ -17,13 +16,6 @@ # 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 diff --git a/tests/misc/printf-cov b/tests/misc/printf-cov index 98616d61b..0f8decfa9 100755 --- a/tests/misc/printf-cov +++ b/tests/misc/printf-cov @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # improve printf.c test coverage # Copyright (C) 2008 Free Software Foundation, Inc. @@ -17,12 +16,6 @@ # 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 diff --git a/tests/misc/seq b/tests/misc/seq index c04e9fa54..f68d74cf5 100755 --- a/tests/misc/seq +++ b/tests/misc/seq @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Test "seq". # Copyright (C) 1999, 2000, 2003, 2005-2008 Free Software Foundation, Inc. @@ -17,12 +16,6 @@ # 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 diff --git a/tests/misc/sha1sum b/tests/misc/sha1sum index 0dff347b2..a05295b43 100755 --- a/tests/misc/sha1sum +++ b/tests/misc/sha1sum @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "sha1sum". # Copyright (C) 2000, 2003, 2005-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/sha1sum-vec b/tests/misc/sha1sum-vec index ef75b496d..4cc71e31d 100755 --- a/tests/misc/sha1sum-vec +++ b/tests/misc/sha1sum-vec @@ -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. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/sha224sum b/tests/misc/sha224sum index ac63318ac..cb20cc9ab 100755 --- a/tests/misc/sha224sum +++ b/tests/misc/sha224sum @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "sha224sum". # Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/sha256sum b/tests/misc/sha256sum index 16eb0c66a..b5de1d404 100755 --- a/tests/misc/sha256sum +++ b/tests/misc/sha256sum @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "sha256sum". # Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/sha384sum b/tests/misc/sha384sum index 133764290..e51065534 100755 --- a/tests/misc/sha384sum +++ b/tests/misc/sha384sum @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "sha384sum". # Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/sha512sum b/tests/misc/sha512sum index 696c504f4..7dbabb3ae 100755 --- a/tests/misc/sha512sum +++ b/tests/misc/sha512sum @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "sha512sum". # Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/sort b/tests/misc/sort index ff278b9b9..f26bc5fbc 100755 --- a/tests/misc/sort +++ b/tests/misc/sort @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Copyright (C) 2008 Free Software Foundation, Inc. @@ -16,12 +15,6 @@ # 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 diff --git a/tests/misc/sort-merge b/tests/misc/sort-merge index b25876a82..f90ba9bce 100755 --- a/tests/misc/sort-merge +++ b/tests/misc/sort-merge @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "sort -m". # Copyright (C) 2002, 2003, 2005-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/stat-printf b/tests/misc/stat-printf index fd720df30..aef63acb7 100755 --- a/tests/misc/stat-printf +++ b/tests/misc/stat-printf @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "stat --printf". # Copyright (C) 2005-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/sum b/tests/misc/sum index 7b99a42ed..4b891ec63 100755 --- a/tests/misc/sum +++ b/tests/misc/sum @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "sum". # Copyright (C) 2000, 2003, 2005-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/tac b/tests/misc/tac index bc0c04c81..2f9981d49 100755 --- a/tests/misc/tac +++ b/tests/misc/tac @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Copyright (C) 2008 Free Software Foundation, Inc. @@ -16,12 +15,6 @@ # 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 diff --git a/tests/misc/tail b/tests/misc/tail index 91d3bb5ff..dfbd3a8bb 100755 --- a/tests/misc/tail +++ b/tests/misc/tail @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test tail. # Copyright (C) 2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/test b/tests/misc/test index e3090ceaa..43db2e1a5 100755 --- a/tests/misc/test +++ b/tests/misc/test @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Copyright (C) 2008 Free Software Foundation, Inc. @@ -16,12 +15,6 @@ # 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 diff --git a/tests/misc/test-diag b/tests/misc/test-diag index a9aa0a81a..dc86db665 100755 --- a/tests/misc/test-diag +++ b/tests/misc/test-diag @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test the diagnostics of "test". # Copyright (C) 2006-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/tr b/tests/misc/tr index 76fdc885e..3ab202e3b 100755 --- a/tests/misc/tr +++ b/tests/misc/tr @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Copyright (C) 2008 Free Software Foundation, Inc. @@ -16,12 +15,6 @@ # 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 diff --git a/tests/misc/tsort b/tests/misc/tsort index 7d9c4ee9a..8561d1112 100755 --- a/tests/misc/tsort +++ b/tests/misc/tsort @@ -1,5 +1,4 @@ -#!/bin/sh -# -*- perl -*- +#!/usr/bin/perl # Test "tsort". # Copyright (C) 1999, 2000, 2003-2008 Free Software Foundation, Inc. @@ -17,13 +16,6 @@ # 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 diff --git a/tests/misc/tty-eof b/tests/misc/tty-eof index 314ae8c20..8a1c38972 100755 --- a/tests/misc/tty-eof +++ b/tests/misc/tty-eof @@ -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. @@ -17,23 +19,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/>. -: ${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 diff --git a/tests/misc/unexpand b/tests/misc/unexpand index a7546ffff..3e3a3d17c 100755 --- a/tests/misc/unexpand +++ b/tests/misc/unexpand @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "unexpand". # Copyright (C) 2000, 2003-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/uniq b/tests/misc/uniq index 1c85735a2..0350864c0 100755 --- a/tests/misc/uniq +++ b/tests/misc/uniq @@ -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. @@ -16,16 +16,6 @@ # 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 diff --git a/tests/misc/wc b/tests/misc/wc index 96183c240..04b8085f0 100755 --- a/tests/misc/wc +++ b/tests/misc/wc @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Basic tests for "wc". # Copyright (C) 1997, 2003, 2006, 2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/misc/wc-files0-from b/tests/misc/wc-files0-from index 047cbce78..85970ff21 100755 --- a/tests/misc/wc-files0-from +++ b/tests/misc/wc-files0-from @@ -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. @@ -18,13 +17,6 @@ # 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 diff --git a/tests/misc/xstrtol b/tests/misc/xstrtol index d31df6dba..0ebd32bdc 100755 --- a/tests/misc/xstrtol +++ b/tests/misc/xstrtol @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # exercise xstrtol's diagnostics via pr # Copyright (C) 2007-2008 Free Software Foundation, Inc. @@ -16,17 +16,6 @@ # 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 diff --git a/tests/mv/i-1 b/tests/mv/i-1 index 4962813a4..c730fe94a 100755 --- a/tests/mv/i-1 +++ b/tests/mv/i-1 @@ -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. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/pr/pr-tests b/tests/pr/pr-tests index 7b53f2316..b5fe2e09e 100755 --- a/tests/pr/pr-tests +++ b/tests/pr/pr-tests @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test pr. # Copyright (C) 2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 diff --git a/tests/rm/empty-name b/tests/rm/empty-name index d940d01fa..31d08842e 100755 --- a/tests/rm/empty-name +++ b/tests/rm/empty-name @@ -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. @@ -16,17 +16,10 @@ # 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 diff --git a/tests/rm/fail-eperm b/tests/rm/fail-eperm index 57b33e8f7..889831163 100755 --- a/tests/rm/fail-eperm +++ b/tests/rm/fail-eperm @@ -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. @@ -18,23 +17,9 @@ # 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 diff --git a/tests/rm/unreadable b/tests/rm/unreadable index e0fd93f9b..86c1a51ce 100755 --- a/tests/rm/unreadable +++ b/tests/rm/unreadable @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # Test "rm" and unreadable directories. # Copyright (C) 1998, 2003, 2005-2008 Free Software Foundation, Inc. @@ -16,12 +16,6 @@ # 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 |