]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Run each Coreutils.pm-based test in its own subdirectory.
authorJim Meyering <jim@meyering.net>
Sat, 18 Aug 2007 06:50:00 +0000 (08:50 +0200)
committerJim Meyering <jim@meyering.net>
Sat, 18 Aug 2007 06:53:31 +0000 (08:53 +0200)
* 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.

42 files changed:
ChangeLog
tests/CuTmpdir.pm [new file with mode: 0644]
tests/Makefile.am
tests/dd/skip-seek
tests/dircolors/simple
tests/du/files0-from
tests/expr/basic
tests/factor/basic
tests/fmt/basic
tests/ls-2/Makefile.am
tests/ls-2/tests
tests/md5sum/basic-1
tests/md5sum/newline-1
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/od
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/mv/i-1
tests/rm/empty-name
tests/rm/unreadable
tests/seq/basic
tests/sha1sum/basic-1
tests/sha1sum/sample-vec
tests/sum/basic-1
tests/tsort/basic-1
tests/unexpand/basic-1

index 3f8128c3c0acce2aafec62833fa0e7f7928aa817..ae486499b813251fec2accbe9859a36e9dfb122e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2007-08-18  Jim Meyering  <jim@meyering.net>
+
+       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.
+       * tests/ls-2/Makefile.am (TESTS_ENVIRONMENT): Define abs_top_builddir,
+       so we can use "$ENV{abs_top_builddir}/src/test" in a test script.
+
 2007-08-16  Jim Meyering  <jim@meyering.net>
 
        Consolidate od tests.
diff --git a/tests/CuTmpdir.pm b/tests/CuTmpdir.pm
new file mode 100644 (file)
index 0000000..e92feff
--- /dev/null
@@ -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;
index 56068395b14a2ea4670440c4f974fa5875ea8a05..b39e5f2b64b487a0bc22482437741501edaaebfc 100644 (file)
@@ -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 \
index 99bebc98c91b510500fdbc9018a93635ae83ad40..9f82a75fdaba8e8580e435e1e005972f93ffae0a 100755 (executable)
@@ -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;
 
index a6643014a1081253e93b60381c35fa6b3014f8de..2db796192b20d8a2a62991b73e24af005ac088ad 100755 (executable)
@@ -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;
 
index 564cb21259490f98b02611feb6647fe82e61b165..7f32f318f7eb53a05e63359c90d9c4fd70112951 100755 (executable)
@@ -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;
index 4e4eb127ccdcd54b02ba53a962a9a77b27a2953e..5227da0494f14c5fb8e6891db571171ed4f49fa5 100755 (executable)
@@ -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;
 
index 20cac0dd5853a7b6db35a829f1bee7e4f541bb69..bd2cc0851732fd5feb3fbd89321db8a6d2357214 100755 (executable)
@@ -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;
 
index 80171197ec0383dce20b32f78c66555fee7da213..dae2f97bcb5b6531c33e32e45700078d1bf06814 100755 (executable)
@@ -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;
 
index 5ea746ed8518402e8815a3538e6072ce11179bdd..edb6accfa96349df7114f95ebd8827734b4b3a2c 100644 (file)
@@ -3,6 +3,7 @@
 EXTRA_DIST = $(TESTS)
 
 TESTS_ENVIRONMENT = \
+  abs_top_builddir=$(abs_top_builddir) \
   top_srcdir=$(top_srcdir) \
   srcdir=$(srcdir) \
   PERL="$(PERL)" \
index c971045092f2e2da611412587886d652cfa66232..c0500fbcb3de902c0cf8f2a85949faabc8bc9a64 100755 (executable)
@@ -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"}};
 
index 7def710d7a923ac78f12bb6393bf255c1fb2a094..7b56e64f7529b431420e71d2e562860ccf4250b3 100755 (executable)
@@ -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;
 
index 787121b0d8559ad50e0b8b3260cff81c53010c42..5e16b9c904740d122d511d0c9ff0de4b4dce0675 100755 (executable)
@@ -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;
 
index 4522ca1bd2933ce22ba5e036741051462f0fd218..592d11391001d32062336257a82748c532420361 100755 (executable)
@@ -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;
 
index 691f15a62708e195da2b0399995e9d1911049a5b..e4c145d17d694e0190ab1c7ed9432b76e92718f4 100755 (executable)
@@ -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;
index 64c3dd8d263804d1d0faa8e9f36b770ca309d590..40ae2cb317e6add7393e99e2bcdb08c8d48a578b 100755 (executable)
@@ -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;
 
index 1706017b8031f7fd1783db4172c4ec391b78196a..61a6f3e947d7308fa4f7f15f8491454dcd38acb8 100755 (executable)
@@ -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;
 
index 1139c07673d37d411dcabe4414f61c50330812d4..d88c9a953be9f1f14f9ffb7d8743c8ab3ac2976b 100755 (executable)
@@ -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;
index 6e29eaba3ed83717e8d39bdcbb24762e478bd563..dff13b8d80b71917a061cff5d332fe107bff1a47 100755 (executable)
@@ -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;
index 919c8a0d7cc6199d9afdcad9b4ff079db055ed31..2bb6f24a5acf8c0cf7001a60f52cc6a6470644e1 100755 (executable)
@@ -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;
index 831af147414a3210b2aa6d889999c8ad82b26ee7..ad1fef797e1c99a1b0c8cc0e72979444bac07094 100755 (executable)
@@ -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;
index e5d0c59fd29acf29477cd83c49a67f23ebd34ab6..2395fa11872643c55363740172369090bb7eccc0 100755 (executable)
 : ${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;
 
index 48bdf85f7d66e2914226704abc9d22550b440745..68f53a12ea099a209e7e0cd0b75ca19254228387 100755 (executable)
@@ -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;
index f64add14dd1a9940fb87cfeedca1d5dbd1547451..37ccad0f830df2fb670f25478fe11d08a54d1203 100755 (executable)
@@ -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;
index 2c6f7e504dd605b614facd0ffd5d49bed271b002..d7d55952ebbab590dab358961ea0ebedab291d37 100755 (executable)
@@ -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;
 
index b2749756c9606bc4acf003228641238b4e117bc7..906b1e89934c131d270aa3b8f2c16d1b14e24901 100755 (executable)
@@ -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;
 
index 82706c5dfbc0e0550ba70ebed005e221be5781ce..c37ba8a35f963971c3fa4497e38f9afdce230e1e 100755 (executable)
@@ -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;
 
index 6ec2cbe811b6be9d8e47434e92b25d93199e777b..52a2ca5dcfcdcbe84d509fb4d8cc21c8afbf1dd8 100755 (executable)
@@ -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;
 
index 34ed24c1897dab7ad40bc98a3a70f94fe26e4386..7884ef62cc035bd00d7ab4755edf39e5b71007fe 100755 (executable)
@@ -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;
 
index fdd2efa2e430f27a88fb61e95962c6586f3f4fc8..695be26c9200e5c0706a91a92316e650cdf5955a 100755 (executable)
@@ -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;
 
index 1cd76fc5f3c5c8d07a83431ae1893f46de39eaa8..f5d7672763e9b48868cc7568d824fe039cb2e746 100755 (executable)
@@ -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}],
     );
 
index f229b68a3207b957052bb906271352f4ef785509..eab8c6ece774603875723ea1f64ab6ee5f24bb4e 100755 (executable)
@@ -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;
index 14f990c12b9fbed56bd89734d705b17a9e698254..4d26ef6ca0a31fd511bddbe2101deb3ae823a089 100755 (executable)
@@ -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;
 
index bf670b86b970a9c95c0d49dcb0cac0ad34faba8b..7e292f0972b40afb005ce9bcbcb46d9c2781fcaa 100755 (executable)
@@ -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;
 
index 43ec11ce77fcbf6dea184d79dcbe116b6b461965..b709dff1d923ad0ac4cb69b20ddc3c5a27b07b77 100755 (executable)
@@ -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;
 
index 75b1210e1a11dac2d83a25187e3838332303c1ee..c5b9c9877ce145462a79f76587677eebfd17e434 100755 (executable)
@@ -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;
 
index 95c75de9f350271ceeb6e1d09bb22f14742463ae..843a09e81ceb6da6fa604c04d04a133f63ee7697 100755 (executable)
@@ -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;
 
index 5f89e922a439f9cbec3d164ca862dee90d6a3fa2..7cee37e416cb1bb490403a25a8baecc307ee45c7 100755 (executable)
@@ -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;
 
index b27bf5f61ba211cd5195283416c021c5b350fb0a..fa83aed55932ae907dd0107d76e973eab327906a 100755 (executable)
@@ -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;
 
index b3e9f664adcdc8e7cae36211fc7f1f36f4adfce6..c3da694b4b4da33dcea6cbb02350ea1a058bff5f 100755 (executable)
@@ -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;
 
index f343e13bfcc46c9fe2092404f7b0f3aec89c5a93..e8dce60dac9ab9a7a5196dcdbfe6769a984daa24 100755 (executable)
@@ -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;
index 1d3ab010ced890452f1a93e0ce3fc9479dc7c264..64f4ea66c4d5bc8be6a93ddbaa39844b88194cb6 100755 (executable)
@@ -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;