bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

preparing for tests to be run in parallel


From: Jim Meyering
Subject: preparing for tests to be run in parallel
Date: Sat, 18 Aug 2007 09:28:14 +0200

I'm working on a patch to make tests run in parallel,
but it requires that both primary frameworks run
their tests in unlikely-to-collide subdirectories.
The "sample-test"-based tests have done this for a long
time, but not the Coreutils.pm-based ones.

This changes all Coreutils.pm-based tests so that they
use the new CuTmpdir.pm module and thus end up running in a
temporary subdir, which is automatically removed upon completion.


Subject: [PATCH] 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.

Signed-off-by: Jim Meyering <address@hidden>
---
 ChangeLog                  |   25 ++++++++++++++++++++++
 tests/CuTmpdir.pm          |   48 ++++++++++++++++++++++++++++++++++++++++++++
 tests/Makefile.am          |    2 +-
 tests/dd/skip-seek         |    3 +-
 tests/dircolors/simple     |    3 +-
 tests/du/files0-from       |    3 +-
 tests/expr/basic           |    7 ++---
 tests/factor/basic         |    6 ++--
 tests/fmt/basic            |    3 +-
 tests/ls-2/Makefile.am     |    1 +
 tests/ls-2/tests           |   27 +++++++++++------------
 tests/md5sum/basic-1       |    3 +-
 tests/md5sum/newline-1     |    3 +-
 tests/misc/base64          |    3 +-
 tests/misc/basename        |    6 ++--
 tests/misc/cut             |    3 +-
 tests/misc/date            |    3 +-
 tests/misc/dirname         |    6 ++--
 tests/misc/expand          |    3 +-
 tests/misc/fold            |    3 +-
 tests/misc/head-elide-tail |    3 +-
 tests/misc/od              |   18 ++-------------
 tests/misc/paste-no-nl     |    3 +-
 tests/misc/pr              |    3 +-
 tests/misc/sha224sum       |    3 +-
 tests/misc/sha256sum       |    3 +-
 tests/misc/sha384sum       |    3 +-
 tests/misc/sha512sum       |    3 +-
 tests/misc/sort-merge      |    3 +-
 tests/misc/stat-printf     |    3 +-
 tests/misc/test-diag       |    7 +++--
 tests/misc/wc-files0-from  |    3 +-
 tests/misc/xstrtol         |    3 +-
 tests/mv/i-1               |    3 +-
 tests/rm/empty-name        |    3 +-
 tests/rm/unreadable        |    3 +-
 tests/seq/basic            |    4 +-
 tests/sha1sum/basic-1      |    3 +-
 tests/sha1sum/sample-vec   |    3 +-
 tests/sum/basic-1          |    3 +-
 tests/tsort/basic-1        |    3 +-
 tests/unexpand/basic-1     |    3 +-
 42 files changed, 169 insertions(+), 78 deletions(-)
 create mode 100644 tests/CuTmpdir.pm

diff --git a/ChangeLog b/ChangeLog
index 3f8128c..ae48649 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2007-08-18  Jim Meyering  <address@hidden>
+
+       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  <address@hidden>

        Consolidate od tests.
diff --git a/tests/CuTmpdir.pm b/tests/CuTmpdir.pm
new file mode 100644
index 0000000..e92feff
--- /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 5606839..b39e5f2 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 99bebc9..9f82a75 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 a664301..2db7961 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 564cb21..7f32f31 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 4e4eb12..5227da0 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 20cac0d..bd2cc08 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 8017119..dae2f97 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 5ea746e..edb6acc 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 c971045..c0500fb 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 7def710..7b56e64 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 787121b..5e16b9c 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 4522ca1..592d113 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 691f15a..e4c145d 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 64c3dd8..40ae2cb 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 1706017..61a6f3e 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 1139c07..d88c9a9 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 6e29eab..dff13b8 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 919c8a0..2bb6f24 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 831af14..ad1fef7 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 e5d0c59..2395fa1 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 48bdf85..68f53a1 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 f64add1..37ccad0 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 2c6f7e5..d7d5595 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 b274975..906b1e8 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 82706c5..c37ba8a 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 6ec2cbe..52a2ca5 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 34ed24c..7884ef6 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 fdd2efa..695be26 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 1cd76fc..f5d7672 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 f229b68..eab8c6e 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 14f990c..4d26ef6 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 bf670b8..7e292f0 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 43ec11c..b709dff 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 75b1210..c5b9c98 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 95c75de..843a09e 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 5f89e92..7cee37e 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 b27bf5f..fa83aed 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 b3e9f66..c3da694 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 f343e13..e8dce60 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 1d3ab01..64f4ea6 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;

--
1.5.3.rc5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]