summaryrefslogtreecommitdiff
path: root/tests/misc
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/misc
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/misc')
-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
20 files changed, 45 insertions, 40 deletions
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;