summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-08-18 08:50:00 +0200
committerJim Meyering <jim@meyering.net>2007-08-18 08:53:31 +0200
commitb78c6b68f77d55b6aeb57853a2f5e2bf312584c1 (patch)
treead6065ca95bf0aeb5a9a4601c3220b0c42b97a17 /tests
parentd2e5e366a1d813e5ce2d03e250eb1ebe44473b63 (diff)
downloadcoreutils-b78c6b68f77d55b6aeb57853a2f5e2bf312584c1.tar.xz
Run each Coreutils.pm-based test in its own subdirectory.
* tests/CuTmpdir.pm: New file. * tests/Makefile.am (EXTRA_DIST): Add CuTmpdir.pm. * tests/misc/od, tests/misc/base64, tests/misc/basename: * tests/misc/cut, tests/misc/date, tests/misc/dirname: * tests/misc/expand, tests/misc/fold, tests/misc/head-elide-tail: * tests/misc/paste-no-nl, tests/misc/pr, tests/misc/sha224sum: * tests/misc/sha256sum, tests/misc/sha384sum, tests/misc/sha512sum: * tests/misc/sort-merge, tests/misc/stat-printf, tests/misc/test-diag: * tests/misc/wc-files0-from, tests/misc/xstrtol: * tests/dd/skip-seek, tests/dircolors/simple, tests/du/files0-from: * tests/expr/basic, tests/factor/basic, tests/fmt/basic: * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1: * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec: * tests/sum/basic-1, tests/tsort/basic-1, tests/unexpand/basic-1: * tests/mv/i-1, tests/rm/empty-name, tests/rm/unreadable: Use it. * tests/misc/test-diag: Use "$ENV{abs_top_builddir}/src/test", not "../../src/test", so it works when run from a subdirectory. * tests/ls-2/tests: Create temp files and dirs from within the perl script, so that they're removed, when run from a subdirectory.
Diffstat (limited to 'tests')
-rw-r--r--tests/CuTmpdir.pm48
-rw-r--r--tests/Makefile.am2
-rwxr-xr-xtests/dd/skip-seek3
-rwxr-xr-xtests/dircolors/simple3
-rwxr-xr-xtests/du/files0-from3
-rwxr-xr-xtests/expr/basic7
-rwxr-xr-xtests/factor/basic6
-rwxr-xr-xtests/fmt/basic3
-rw-r--r--tests/ls-2/Makefile.am1
-rwxr-xr-xtests/ls-2/tests27
-rwxr-xr-xtests/md5sum/basic-13
-rwxr-xr-xtests/md5sum/newline-13
-rwxr-xr-xtests/misc/base643
-rwxr-xr-xtests/misc/basename6
-rwxr-xr-xtests/misc/cut3
-rwxr-xr-xtests/misc/date3
-rwxr-xr-xtests/misc/dirname6
-rwxr-xr-xtests/misc/expand3
-rwxr-xr-xtests/misc/fold3
-rwxr-xr-xtests/misc/head-elide-tail3
-rwxr-xr-xtests/misc/od18
-rwxr-xr-xtests/misc/paste-no-nl3
-rwxr-xr-xtests/misc/pr3
-rwxr-xr-xtests/misc/sha224sum3
-rwxr-xr-xtests/misc/sha256sum3
-rwxr-xr-xtests/misc/sha384sum3
-rwxr-xr-xtests/misc/sha512sum3
-rwxr-xr-xtests/misc/sort-merge3
-rwxr-xr-xtests/misc/stat-printf3
-rwxr-xr-xtests/misc/test-diag7
-rwxr-xr-xtests/misc/wc-files0-from3
-rwxr-xr-xtests/misc/xstrtol3
-rwxr-xr-xtests/mv/i-13
-rwxr-xr-xtests/rm/empty-name3
-rwxr-xr-xtests/rm/unreadable3
-rwxr-xr-xtests/seq/basic4
-rwxr-xr-xtests/sha1sum/basic-13
-rwxr-xr-xtests/sha1sum/sample-vec3
-rwxr-xr-xtests/sum/basic-13
-rwxr-xr-xtests/tsort/basic-13
-rwxr-xr-xtests/unexpand/basic-13
41 files changed, 144 insertions, 78 deletions
diff --git a/tests/CuTmpdir.pm b/tests/CuTmpdir.pm
new file mode 100644
index 000000000..e92feff5d
--- /dev/null
+++ b/tests/CuTmpdir.pm
@@ -0,0 +1,48 @@
+package CuTmpdir;
+# create, then chdir into a temporary sub-directory
+
+# Copyright (C) 2007 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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, see <http://www.gnu.org/licenses/>.
+
+use strict;
+use warnings;
+
+use File::Temp;
+
+our $ME = $0 || "<???>";
+
+my $dir;
+
+sub import {
+ my $prefix = $_[1];
+ if ($prefix !~ /^\//)
+ {
+ eval 'use Cwd';
+ my $cwd = $@ ? '.' : Cwd::getcwd();
+ $prefix = "$cwd/$prefix";
+ }
+ $dir = File::Temp::tempdir("$prefix.tmp-XXXX", CLEANUP => 1 );
+ chdir $dir
+ or warn "$ME: failed to chdir to $dir: $!\n";
+}
+
+END {
+ my $saved_errno = $?;
+ # FIXME: use File::Find
+ system qw (chmod -R 700), $dir;
+ $? = $saved_errno;
+}
+
+1;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 56068395b..b39e5f2b6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,7 +15,7 @@ TESTS_ENVIRONMENT = \
PATH="$(VG_PATH_PREFIX)`pwd`/../src$(PATH_SEPARATOR)$$PATH"
EXTRA_DIST = \
- $(TESTS) Coreutils.pm Makefile.am.in README acl envvar-check \
+ $(TESTS) Coreutils.pm CuTmpdir.pm Makefile.am.in README acl envvar-check \
expensive group-names input-tty lang-default mk-script \
other-fs-tmpdir priv-check \
rwx-to-mode sample-test selinux setgid-check sparse-file \
diff --git a/tests/dd/skip-seek b/tests/dd/skip-seek
index 99bebc98c..9f82a75fd 100755
--- a/tests/dd/skip-seek
+++ b/tests/dd/skip-seek
@@ -30,7 +30,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
SCRIPT_NAME=$0
export SCRIPT_NAME
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/dircolors/simple b/tests/dircolors/simple
index a6643014a..2db796192 100755
--- a/tests/dircolors/simple
+++ b/tests/dircolors/simple
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/du/files0-from b/tests/du/files0-from
index 564cb2125..7f32f318f 100755
--- a/tests/du/files0-from
+++ b/tests/du/files0-from
@@ -28,7 +28,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
#/
require 5.003;
use strict;
diff --git a/tests/expr/basic b/tests/expr/basic
index 4e4eb127c..5227da049 100755
--- a/tests/expr/basic
+++ b/tests/expr/basic
@@ -2,8 +2,7 @@
# -*-perl-*-
# Basic tests for "expr".
-# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2003-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,8 +26,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-d=$srcdir/..
-exec $PERL -w -I$d -MCoreutils -- - << \EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
require 5.003;
use strict;
diff --git a/tests/factor/basic b/tests/factor/basic
index 20cac0dd5..bd2cc0851 100755
--- a/tests/factor/basic
+++ b/tests/factor/basic
@@ -2,7 +2,7 @@
# -*-perl-*-
# Basic tests for "factor".
-# Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005 Free Software
+# Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005, 2007 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
@@ -27,8 +27,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-d=$srcdir/..
-exec $PERL -w -I$d -MCoreutils -- - << \EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
require 5.003;
use strict;
diff --git a/tests/fmt/basic b/tests/fmt/basic
index 80171197e..dae2f97bc 100755
--- a/tests/fmt/basic
+++ b/tests/fmt/basic
@@ -33,7 +33,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
LC_ALL=C
export LC_ALL
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/ls-2/Makefile.am b/tests/ls-2/Makefile.am
index 5ea746ed8..edb6accfa 100644
--- a/tests/ls-2/Makefile.am
+++ b/tests/ls-2/Makefile.am
@@ -3,6 +3,7 @@
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
+ abs_top_builddir=$(abs_top_builddir) \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="$(PERL)" \
diff --git a/tests/ls-2/tests b/tests/ls-2/tests
index c97104509..c0500fbcb 100755
--- a/tests/ls-2/tests
+++ b/tests/ls-2/tests
@@ -25,20 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-# Set up files used by the setuid-etc tests; skip this entire test if
-# that cannot be done for some reason.
-test=../../src/test
-touch setuid && chmod u+s setuid && $test -u setuid &&
-touch setgid && chmod g+s setgid && $test -g setgid &&
-mkdir sticky && chmod +t sticky && $test -k sticky &&
-mkdir owt && chmod +t,o+w owt && $test -k owt &&
-mkdir owr && chmod o+w owr || {
- echo 1>&2 "$0: cannot create setuid/setgid/sticky files," \
- "so can't run this test"
- exit 77
-}
-
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - << \EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
require 5.003;
use strict;
@@ -47,6 +35,17 @@ use strict;
# Turn off localisation of executable's ouput.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
+# Set up files used by the setuid-etc tests; skip this entire test if
+# that cannot be done.
+my $test = "$ENV{abs_top_builddir}/src/test";
+system (qq(touch setuid && chmod u+s setuid && $test -u setuid &&
+ touch setgid && chmod g+s setgid && $test -g setgid &&
+ mkdir sticky && chmod +t sticky && $test -k sticky &&
+ mkdir owt && chmod +t,o+w owt && $test -k owt &&
+ mkdir owr && chmod o+w owr)) == 0
+ or (warn "$program_name: cannot create setuid/setgid/sticky files,"
+ . "so can't run this test\n"), exit 77;
+
my $mkdir = {PRE => sub {mkdir 'd',0755 or die "d: $!\n"}};
my $rmdir = {POST => sub {rmdir 'd' or die "d: $!\n"}};
diff --git a/tests/md5sum/basic-1 b/tests/md5sum/basic-1
index 7def710d7..7b56e64f7 100755
--- a/tests/md5sum/basic-1
+++ b/tests/md5sum/basic-1
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/md5sum/newline-1 b/tests/md5sum/newline-1
index 787121b0d..5e16b9c90 100755
--- a/tests/md5sum/newline-1
+++ b/tests/md5sum/newline-1
@@ -41,7 +41,8 @@ if test $filename_may_contain_newline = no; then
exit 77
fi
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/misc/base64 b/tests/misc/base64
index 4522ca1bd..592d11391 100755
--- a/tests/misc/base64
+++ b/tests/misc/base64
@@ -26,7 +26,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/misc/basename b/tests/misc/basename
index 691f15a62..e4c145d17 100755
--- a/tests/misc/basename
+++ b/tests/misc/basename
@@ -1,7 +1,7 @@
#!/bin/sh
# -*-perl-*-
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,8 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-d=$srcdir/..
-exec $PERL -w -I$d -MCoreutils -- - << \EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
require 5.003;
use strict;
use File::stat;
diff --git a/tests/misc/cut b/tests/misc/cut
index 64c3dd8d2..40ae2cb31 100755
--- a/tests/misc/cut
+++ b/tests/misc/cut
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\FILE_EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\FILE_EOF
require 5.003;
use strict;
diff --git a/tests/misc/date b/tests/misc/date
index 1706017b8..61a6f3e94 100755
--- a/tests/misc/date
+++ b/tests/misc/date
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/misc/dirname b/tests/misc/dirname
index 1139c0767..d88c9a953 100755
--- a/tests/misc/dirname
+++ b/tests/misc/dirname
@@ -2,7 +2,7 @@
# -*-perl-*-
# Test "dirname".
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,8 +26,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-d=$srcdir/..
-exec $PERL -w -I$d -MCoreutils -- - << \EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
require 5.003;
use strict;
use File::stat;
diff --git a/tests/misc/expand b/tests/misc/expand
index 6e29eaba3..dff13b8d8 100755
--- a/tests/misc/expand
+++ b/tests/misc/expand
@@ -26,7 +26,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
#/
require 5.003;
use strict;
diff --git a/tests/misc/fold b/tests/misc/fold
index 919c8a0d7..2bb6f24a5 100755
--- a/tests/misc/fold
+++ b/tests/misc/fold
@@ -39,7 +39,8 @@ case $ver in
exit 1;;
esac
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
#/
require 5.003;
use strict;
diff --git a/tests/misc/head-elide-tail b/tests/misc/head-elide-tail
index 831af1474..ad1fef797 100755
--- a/tests/misc/head-elide-tail
+++ b/tests/misc/head-elide-tail
@@ -26,7 +26,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
#/
require 5.003;
use strict;
diff --git a/tests/misc/od b/tests/misc/od
index e5d0c59fd..2395fa118 100755
--- a/tests/misc/od
+++ b/tests/misc/od
@@ -20,20 +20,6 @@
: ${PERL=perl}
: ${srcdir=.}
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
PROG=`echo $0|sed 's,.*/,,'`; export PROG
$PERL -e 1 > /dev/null 2>&1 || {
@@ -42,7 +28,9 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$pwd/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/misc/paste-no-nl b/tests/misc/paste-no-nl
index 48bdf85f7..68f53a12e 100755
--- a/tests/misc/paste-no-nl
+++ b/tests/misc/paste-no-nl
@@ -26,7 +26,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
#/
require 5.003;
use strict;
diff --git a/tests/misc/pr b/tests/misc/pr
index f64add14d..37ccad0f8 100755
--- a/tests/misc/pr
+++ b/tests/misc/pr
@@ -28,7 +28,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
#/
require 5.003;
use strict;
diff --git a/tests/misc/sha224sum b/tests/misc/sha224sum
index 2c6f7e504..d7d55952e 100755
--- a/tests/misc/sha224sum
+++ b/tests/misc/sha224sum
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/misc/sha256sum b/tests/misc/sha256sum
index b2749756c..906b1e899 100755
--- a/tests/misc/sha256sum
+++ b/tests/misc/sha256sum
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/misc/sha384sum b/tests/misc/sha384sum
index 82706c5df..c37ba8a35 100755
--- a/tests/misc/sha384sum
+++ b/tests/misc/sha384sum
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/misc/sha512sum b/tests/misc/sha512sum
index 6ec2cbe81..52a2ca5dc 100755
--- a/tests/misc/sha512sum
+++ b/tests/misc/sha512sum
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/misc/sort-merge b/tests/misc/sort-merge
index 34ed24c18..7884ef62c 100755
--- a/tests/misc/sort-merge
+++ b/tests/misc/sort-merge
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/misc/stat-printf b/tests/misc/stat-printf
index fdd2efa2e..695be26c9 100755
--- a/tests/misc/stat-printf
+++ b/tests/misc/stat-printf
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/misc/test-diag b/tests/misc/test-diag
index 1cd76fc5f..f5d767276 100755
--- a/tests/misc/test-diag
+++ b/tests/misc/test-diag
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
@@ -34,12 +35,12 @@ use strict;
# Turn off localisation of executable's ouput.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
-my $prog = '../../src/test';
+my $prog = "$ENV{abs_top_builddir}/src/test";
my @Tests =
(
# In coreutils-5.93, this diagnostic lacked the newline.
['o', '-o arg', {ERR => "test: extra argument `-o'\n"},
- {ERR_SUBST => 's!^$prog:!test:!'},
+ {ERR_SUBST => 's!^.*:!test:!'},
{EXIT => 2}],
);
diff --git a/tests/misc/wc-files0-from b/tests/misc/wc-files0-from
index f229b68a3..eab8c6ece 100755
--- a/tests/misc/wc-files0-from
+++ b/tests/misc/wc-files0-from
@@ -29,7 +29,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
#/
require 5.003;
use strict;
diff --git a/tests/misc/xstrtol b/tests/misc/xstrtol
index 14f990c12..4d26ef6ca 100755
--- a/tests/misc/xstrtol
+++ b/tests/misc/xstrtol
@@ -32,7 +32,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/mv/i-1 b/tests/mv/i-1
index bf670b86b..7e292f097 100755
--- a/tests/mv/i-1
+++ b/tests/mv/i-1
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/rm/empty-name b/tests/rm/empty-name
index 43ec11ce7..b709dff1d 100755
--- a/tests/rm/empty-name
+++ b/tests/rm/empty-name
@@ -30,7 +30,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - << \EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
require 5.003;
use strict;
diff --git a/tests/rm/unreadable b/tests/rm/unreadable
index 75b1210e1..c5b9c9877 100755
--- a/tests/rm/unreadable
+++ b/tests/rm/unreadable
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - << \EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
require 5.003;
use strict;
diff --git a/tests/seq/basic b/tests/seq/basic
index 95c75de9f..843a09e81 100755
--- a/tests/seq/basic
+++ b/tests/seq/basic
@@ -26,8 +26,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-d=$srcdir/..
-exec $PERL -w -I$d -MCoreutils -- - << \EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
require 5.003;
use strict;
diff --git a/tests/sha1sum/basic-1 b/tests/sha1sum/basic-1
index 5f89e922a..7cee37e41 100755
--- a/tests/sha1sum/basic-1
+++ b/tests/sha1sum/basic-1
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/sha1sum/sample-vec b/tests/sha1sum/sample-vec
index b27bf5f61..fa83aed55 100755
--- a/tests/sha1sum/sample-vec
+++ b/tests/sha1sum/sample-vec
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/sum/basic-1 b/tests/sum/basic-1
index b3e9f664a..c3da694b4 100755
--- a/tests/sum/basic-1
+++ b/tests/sum/basic-1
@@ -25,7 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;
diff --git a/tests/tsort/basic-1 b/tests/tsort/basic-1
index f343e13bf..e8dce60da 100755
--- a/tests/tsort/basic-1
+++ b/tests/tsort/basic-1
@@ -27,7 +27,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
#/
require 5.003;
use strict;
diff --git a/tests/unexpand/basic-1 b/tests/unexpand/basic-1
index 1d3ab010c..64f4ea66c 100755
--- a/tests/unexpand/basic-1
+++ b/tests/unexpand/basic-1
@@ -26,7 +26,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
require 5.003;
use strict;