summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2007-11-29 09:21:22 +0100
committerJim Meyering <meyering@redhat.com>2008-02-09 10:30:33 +0100
commit72565ddffe0b249fc23bd8253564aaf3311f833c (patch)
treebf827f4d0980adc9f163359eda745c6e6a1e8675 /tests
parent52d9bba7126de635eb356e3b379c5e4659ce2462 (diff)
downloadcoreutils-72565ddffe0b249fc23bd8253564aaf3311f833c.tar.xz
tests: call skip_test_ in place of echo+exit 77
* tests/mv/no-target-dir: Likewise. * tests/other-fs-tmpdir: Likewise. * tests/rm/empty-name: Likewise. * tests/rm/fail-eperm: Likewise. * tests/rm/inaccessible: Likewise. * tests/rm/isatty: Likewise. * tests/rm/unreadable: Likewise. * tests/setgid-check: Likewise. * tests/sparse-file: Likewise. * tests/strace: Likewise. * tests/tail-2/append-only: Likewise. * tests/tail-2/big-4gb: Likewise. * tests/tail-2/tail-n0f: Likewise. * tests/touch/dangling-symlink: Likewise. * tests/touch/fifo: Likewise. * tests/touch/not-owner: Likewise. * tests/mv/i-3: Likewise. * tests/umask-check: Likewise. * tests/mv/acl: Likewise. * tests/cp/acl: Likewise. * tests/chgrp/deref: Likewise. * tests/chmod/setgid: Likewise. * tests/cp/existing-perm-race: Likewise. * tests/cp/file-perm-race: Likewise. * tests/cp/parent-perm-race: Likewise. * tests/du/2g: Likewise. * tests/du/8gb: Likewise. * tests/du/long-from-unreadable: Likewise. * tests/du/long-sloop: Likewise. * tests/du/slink: Likewise. * tests/ls/nameless-uid: Likewise. * tests/ls/stat-dtype: Likewise. * tests/misc/cat-proc: Likewise. * tests/misc/md5sum-newline: Likewise. * tests/misc/nice: Likewise. * tests/misc/od-x8: Likewise. * tests/misc/pwd-unreadable-parent: Likewise. * tests/misc/selinux: Likewise. * tests/misc/stty-row-col: Likewise. * tests/misc/tac-continue: Likewise. * tests/misc/arch: Likewise, and source $srcdir/../test-lib.sh *before* the use of skip_test_.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/chgrp/deref10
-rwxr-xr-xtests/chmod/setgid7
-rwxr-xr-xtests/cp/acl13
-rwxr-xr-xtests/cp/existing-perm-race6
-rwxr-xr-xtests/cp/file-perm-race6
-rwxr-xr-xtests/cp/parent-perm-race6
-rwxr-xr-xtests/du/2g7
-rwxr-xr-xtests/du/8gb12
-rwxr-xr-xtests/du/long-from-unreadable6
-rwxr-xr-xtests/du/long-sloop11
-rwxr-xr-xtests/du/slink9
-rwxr-xr-xtests/ls/nameless-uid3
-rwxr-xr-xtests/ls/stat-dtype4
-rwxr-xr-xtests/misc/arch7
-rwxr-xr-xtests/misc/cat-proc7
-rwxr-xr-xtests/misc/md5sum-newline4
-rwxr-xr-xtests/misc/nice3
-rwxr-xr-xtests/misc/od-x86
-rwxr-xr-xtests/misc/pwd-unreadable-parent10
-rwxr-xr-xtests/misc/selinux6
-rwxr-xr-xtests/misc/stty-row-col3
-rwxr-xr-xtests/misc/tac-continue3
-rwxr-xr-xtests/mv/acl13
-rwxr-xr-xtests/mv/i-32
-rwxr-xr-xtests/mv/no-target-dir6
-rwxr-xr-xtests/other-fs-tmpdir8
-rwxr-xr-xtests/rm/empty-name7
-rwxr-xr-xtests/rm/fail-eperm7
-rwxr-xr-xtests/rm/inaccessible3
-rwxr-xr-xtests/rm/isatty2
-rwxr-xr-xtests/rm/unreadable7
-rw-r--r--tests/setgid-check8
-rw-r--r--tests/sparse-file6
-rw-r--r--tests/strace10
-rwxr-xr-xtests/tail-2/append-only3
-rwxr-xr-xtests/tail-2/big-4gb8
-rwxr-xr-xtests/tail-2/tail-n0f7
-rwxr-xr-xtests/touch/dangling-symlink10
-rwxr-xr-xtests/touch/fifo5
-rwxr-xr-xtests/touch/not-owner6
-rw-r--r--tests/umask-check9
41 files changed, 84 insertions, 192 deletions
diff --git a/tests/chgrp/deref b/tests/chgrp/deref
index 5dd61e105..ebf92e470 100755
--- a/tests/chgrp/deref
+++ b/tests/chgrp/deref
@@ -34,13 +34,9 @@ ln -s f symlink
chgrp -h $g2 symlink 2> /dev/null
set _ `ls -ln symlink`
g=$5
-test "$g" = $g2 || {
- cat <<EOF 1>&2
-$0: skipping this test; your system doesn't support changing
-the owner or group of a symbolic link.
-EOF
- (exit 77); exit 77
-}
+test "$g" = $g2 ||
+ skip_test_ "your system doesn't support changing the owner or group" \
+ "of a symbolic link."
fail=0
diff --git a/tests/chmod/setgid b/tests/chmod/setgid
index a91c6a581..d5d35f976 100755
--- a/tests/chmod/setgid
+++ b/tests/chmod/setgid
@@ -44,11 +44,8 @@ chmod g+s d 2> /dev/null && "$test" -g d ||
}
# "chmod g+s d" does nothing on some NFS file systems.
-"$test" -g d || {
- echo 1>&2 "$0: cannot create setgid directories," \
- "so can't run this test"
- exit 77
-}
+"$test" -g d ||
+ skip_test_ 'cannot create setgid directories'
fail=0
diff --git a/tests/cp/acl b/tests/cp/acl
index 42f7c3464..fd6e86dd0 100755
--- a/tests/cp/acl
+++ b/tests/cp/acl
@@ -21,11 +21,8 @@
. $srcdir/../lang-default
# Skip this test if cp was built without ACL support:
-grep '^#define USE_ACL 0' $CONFIG_HEADER > /dev/null && \
- {
- echo 1>&2 "$0: insufficient ACL support, so skipping this test"
- (exit 77); exit 77
- }
+grep '^#define USE_ACL 0' $CONFIG_HEADER > /dev/null &&
+ skip_test_ "insufficient ACL support"
if test "$VERBOSE" = yes; then
set -x
@@ -47,11 +44,7 @@ acl1=`cd a && getfacl file | grep -v ':bin:' | grep -v 'mask::'` \
|| skip=yes
test $skip = yes &&
- {
- echo "$0: '.' is not on a suitable file system for this test" 1>&2
- echo "$0: skipping this test" 1>&2
- (exit 77); exit 77
- }
+ skip_test_ "'.' is not on a suitable file system for this test"
# copy a file without preserving permissions
cp a/file b/ || fail=1
diff --git a/tests/cp/existing-perm-race b/tests/cp/existing-perm-race
index 11f38d261..0ab10e94d 100755
--- a/tests/cp/existing-perm-race
+++ b/tests/cp/existing-perm-race
@@ -31,10 +31,8 @@ g2=$2
fail=0
umask 077
-mkfifo fifo || {
- echo "$0: fifos not supported; skipping this test." 1>&2
- (exit 77); exit 77
-}
+mkfifo fifo ||
+ skip_test_ "fifos not supported"
touch fifo-copy &&
chgrp $g1 fifo &&
diff --git a/tests/cp/file-perm-race b/tests/cp/file-perm-race
index 94e402dbc..3e3859773 100755
--- a/tests/cp/file-perm-race
+++ b/tests/cp/file-perm-race
@@ -24,10 +24,8 @@ fi
. $srcdir/../test-lib.sh
umask 022
-mkfifo fifo || {
- echo "$0: fifos not supported; skipping this test." 1>&2
- (exit 77); exit 77
-}
+mkfifo fifo ||
+ skip_test_ "fifos not supported"
# Copy a fifo's contents. That way, we can examine the
# destination permissions before they're finalized.
diff --git a/tests/cp/parent-perm-race b/tests/cp/parent-perm-race
index b09f8bced..8afa0c0b7 100755
--- a/tests/cp/parent-perm-race
+++ b/tests/cp/parent-perm-race
@@ -31,10 +31,8 @@ fail=0
for attr in mode ownership
do
- mkfifo $attr/fifo || {
- echo "$0: fifos not supported; skipping this test." 1>&2
- (exit 77); exit 77
- }
+ mkfifo $attr/fifo ||
+ skip_test_ "fifos not supported"
# Copy a fifo's contents. That way, we can examine d/$attr's
# state while cp is running.
diff --git a/tests/du/2g b/tests/du/2g
index a19b8ab4f..fa20ce983 100755
--- a/tests/du/2g
+++ b/tests/du/2g
@@ -38,17 +38,14 @@ fail=0
free_kb=`df -kP .|tail -1|sed 's/ [0-9][0-9]*%.*//;s/ *$//;s/.* //'`
case "$free_kb" in
[0-9]*) ;;
- *) echo "invalid size from df: $free_kb" 1>&2; (exit 77); exit 77;;
+ *) skip_test_ "invalid size from df: $free_kb";;
esac
# Require about 3GB free.
min_kb=3000000
test $min_kb -lt $free_kb ||
{
- echo "$0: skipping this test:"
- echo "too little free space on current partition: $free_kb (need $min_kb KB)" \
- 1>&2;
- (exit 77); exit 77
+ skip_test_ "too little free space on current partition: $free_kb (need $min_kb KB)"
}
big=big
diff --git a/tests/du/8gb b/tests/du/8gb
index 29d48c2e0..ab6dedde4 100755
--- a/tests/du/8gb
+++ b/tests/du/8gb
@@ -27,9 +27,8 @@ fi
dd bs=1 seek=8G of=big < /dev/null 2> /dev/null
if test $? != 0; then
- echo "$0: cannot create a file large enough for this test; possibly" 1>&2
- echo "$0: because file offsets are only 32 bits on this file system" 1>&2
- (exit 77); exit 77
+ skip_test_ 'cannot create a file large enough for this test; possibly
+because file offsets are only 32 bits on this file system'
fi
# FIXME: this should be a test of dd.
@@ -40,10 +39,9 @@ fi
set x `ls -gG big`
size=$4
if test "$size" = 0; then
- echo "$0: cannot create a file large enough for this test;" 1>&2
- echo "$0: possibly because this system's NFS support is buggy;" 1>&2
- echo "$0: Consider rerunning this test on a different file system." 1>&2
- (exit 77); exit 77
+ skip_test_ "cannot create a file large enough for this test
+possibly because this system's NFS support is buggy
+Consider rerunning this test on a different file system."
fi
fail=0
diff --git a/tests/du/long-from-unreadable b/tests/du/long-from-unreadable
index 64c35b9a5..cdc81dc3f 100755
--- a/tests/du/long-from-unreadable
+++ b/tests/du/long-from-unreadable
@@ -37,11 +37,7 @@ fi
proc_file=/proc/self/fd
if test ! -d $proc_file; then
- cat <<EOF >&2
-$0: Skipping this test.
-It would fail, since your system lacks /proc support.
-EOF
- (exit 77); exit 77
+ skip_test_ 'This test would fail, since your system lacks /proc support.'
fi
dir=`printf '%200s\n' ' '|tr ' ' x`
diff --git a/tests/du/long-sloop b/tests/du/long-sloop
index f6adf7238..603f1f07f 100755
--- a/tests/du/long-sloop
+++ b/tests/du/long-sloop
@@ -58,14 +58,9 @@ echo foo > $i
# renders it as `Number of symbolic links encountered during path
# name traversal exceeds MAXSYMLINKS'.
-cat $file > /dev/null 2> err && \
- {
- cat <<EOF >&2
-$0: Your system appears to be able to handle more than $n symlinks
-in file name resolution, so skipping this test.
-EOF
- (exit 77); exit 77
- }
+cat $file > /dev/null 2> err &&
+ skip_test_ 'Your system appears to be able to handle more than $n symlinks
+in file name resolution'
too_many=`sed 's/.*: //' err`
fail=0
diff --git a/tests/du/slink b/tests/du/slink
index e9f7bbd7d..be5a63df5 100755
--- a/tests/du/slink
+++ b/tests/du/slink
@@ -30,22 +30,19 @@ fi
if df --local . >/dev/null 2>&1; then
: # Ok.
else
- echo "$0: skipping this test, since \`.' is on a non-local file system" 1>&2
- (exit 77); exit 77
+ skip_test_ "\`.' is on a non-local file system"
fi
if df --type=xfs . >/dev/null 2>&1; then
# At least on Irix-6.5.19, when using an xfs file system,
# each created symlink (name lengths up to 255) would have a size of `0'.
- echo "$0: skipping this test, since \`.' is on an XFS file system" 1>&2
- (exit 77); exit 77
+ skip_test_ "\`.' is on an XFS file system"
fi
if df --type=nfsv3 . >/dev/null 2>&1; then
# At least on OSF/1 4.0d, when using an nfsv3 file system,
# each created symlink can end up having a size of 0.
- echo "$0: skipping this test, since \`.' is on an NFS file system" 1>&2
- (exit 77); exit 77
+ skip_test_ "\`.' is on an NFS file system"
fi
fail=0
diff --git a/tests/ls/nameless-uid b/tests/ls/nameless-uid
index 7512c187d..a78846ca4 100755
--- a/tests/ls/nameless-uid
+++ b/tests/ls/nameless-uid
@@ -34,8 +34,7 @@ $PERL -e 1 > /dev/null 2>&1 || {
nameless_uid=`$PERL -e 'foreach my $i (1000..16*1024) { getpwuid $i or (print "$i\n"), exit }'`
if test x$nameless_uid = x; then
- echo "$0: couldn't find a nameless UID" 1>&2
- (exit 77); exit 77
+ skip_test_ "couldn't find a nameless UID"
fi
touch f || framework_failure
diff --git a/tests/ls/stat-dtype b/tests/ls/stat-dtype
index c5ea4f567..5e1776e71 100755
--- a/tests/ls/stat-dtype
+++ b/tests/ls/stat-dtype
@@ -34,9 +34,7 @@ fi
mkdir -p c/d || framework_failure
chmod a-x c || framework_failure
if test "X`ls -p c 2>&1`" != Xd/; then
- echo "$0: '.' is not on a suitable file system for this test" 1>&2
- echo "$0: skipping this test" 1>&2
- (exit 77); exit 77
+ skip_test_ "'.' is not on a suitable file system for this test"
fi
mkdir d || framework_failure
diff --git a/tests/misc/arch b/tests/misc/arch
index 942fa933d..c568b48fb 100755
--- a/tests/misc/arch
+++ b/tests/misc/arch
@@ -16,10 +16,12 @@
# 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/../test-lib.sh
+
# skip this test if arch isn't being built.
case " $built_programs " in
*" arch "*) ;;
- *) (exit 77); exit 77 ;;
+ *) skip_test_ 'not building arch';;
esac
if test "$VERBOSE" = yes; then
@@ -27,9 +29,6 @@ if test "$VERBOSE" = yes; then
arch --version
fi
-. $srcdir/../test-lib.sh
-
-
fail=0
arch > out || fail=1
diff --git a/tests/misc/cat-proc b/tests/misc/cat-proc
index 84265e18e..02bb26ad4 100755
--- a/tests/misc/cat-proc
+++ b/tests/misc/cat-proc
@@ -2,7 +2,7 @@
# Ensure that cat -E produces same output as cat, module `$'s,
# even when applied to a file in /proc.
-# 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
@@ -27,10 +27,7 @@ fi
f=/proc/cpuinfo
test -f $f \
- || {
- echo "$0: no $f skipping this test" 1>&2
- (exit 77); exit 77
- }
+ || skip_test_ "no $f"
fail=0
diff --git a/tests/misc/md5sum-newline b/tests/misc/md5sum-newline
index e20f0be8e..df3254e71 100755
--- a/tests/misc/md5sum-newline
+++ b/tests/misc/md5sum-newline
@@ -36,9 +36,7 @@ rm -f 'a
b'
if test $filename_may_contain_newline = no; then
- echo 1>&2 "$0: can't create newline-containing file name," \
- "so can't run this test"
- exit 77
+ skip_test_ "failed to create newline-containing file name"
fi
me=`echo $0|sed 's,.*/,,'`
diff --git a/tests/misc/nice b/tests/misc/nice
index 6b063daa2..2e9d3c14c 100755
--- a/tests/misc/nice
+++ b/tests/misc/nice
@@ -58,8 +58,7 @@ niceness=`nice`
if test "$niceness" = 0; then
: ok
else
- echo "$0: this test must be run at nice level 0" 1>&2
- exit 77
+ skip_test_ "this test must be run at nice level 0"
fi
fail=0
diff --git a/tests/misc/od-x8 b/tests/misc/od-x8
index dc1ec00cb..852ddf43b 100755
--- a/tests/misc/od-x8
+++ b/tests/misc/od-x8
@@ -24,10 +24,8 @@ fi
. $srcdir/../test-lib.sh
-od -t x8 /dev/null >/dev/null || {
- echo >&2 "$0: 8-byte test skipped"
- exit 77
-}
+od -t x8 /dev/null >/dev/null ||
+ skip_test_ "od lacks support for 8-byte quantities"
echo abcdefgh |tr -d '\n' > in || framework_failure
diff --git a/tests/misc/pwd-unreadable-parent b/tests/misc/pwd-unreadable-parent
index f3ff874d8..c7cde7542 100755
--- a/tests/misc/pwd-unreadable-parent
+++ b/tests/misc/pwd-unreadable-parent
@@ -27,18 +27,12 @@ fi
. $srcdir/../test-lib.sh
test $host_os != linux-gnu &&
- {
- echo 1>&2 "$0: vendor getcwd may be inadequate; skipping this test"
- (exit 77); exit 77
- }
+ skip_test_ 'vendor getcwd may be inadequate'
# Linux ia64 has the gl_FUNC_GETCWD_ABORT_BUG, so we can't use
# the system getcwd.
test $REPLACE_GETCWD = 1 &&
- {
- echo 1>&2 "$0: can't use buggy system getcwd; skipping this test"
- (exit 77); exit 77
- }
+ skip_test_ "can't use buggy system getcwd; skipping this test"
mkdir -p a/b || framework_failure
cd a/b || framework_failure
diff --git a/tests/misc/selinux b/tests/misc/selinux
index 542d6e799..87d1a8dde 100755
--- a/tests/misc/selinux
+++ b/tests/misc/selinux
@@ -25,10 +25,8 @@ fail=0
ctx=root:object_r:tmp_t
# FIXME, what if $ctx is no different from the default. Not likely.
# give each a different context, via chcon
-chcon $ctx f d p 2>/dev/null || {
- echo 1>&2 'skipping this test: "chcon '$ctx' ..." failed'
- (exit 77); exit 77
-}
+chcon $ctx f d p 2>/dev/null ||
+ skip_test_ '"chcon '$ctx' ..." failed'
# inspect that context with both ls -Z and stat.
for i in d f p; do
diff --git a/tests/misc/stty-row-col b/tests/misc/stty-row-col
index 3fb387183..eb84499ed 100755
--- a/tests/misc/stty-row-col
+++ b/tests/misc/stty-row-col
@@ -58,8 +58,7 @@ NA LAST NA
set $tests
saved_size=`stty size` && test -n "$saved_size" \
- || { echo "$0: skipping this test: can't get window size" 1>&2;
- exit 77; exit; }
+ || skip_test_ "can't get window size"
fail=0
while :; do
diff --git a/tests/misc/tac-continue b/tests/misc/tac-continue
index 0c1319404..efc87f0a2 100755
--- a/tests/misc/tac-continue
+++ b/tests/misc/tac-continue
@@ -28,8 +28,7 @@ fi
# See if the envvar is defined.
if test x = "x$FULL_PARTITION_TMPDIR"; then
- echo "$0: FULL_PARTITION_TMPDIR not defined; skipping this test" 1>&2
- (exit 77); exit 77
+ skip_test_ "FULL_PARTITION_TMPDIR not defined"
fi
if ! test -d "$FULL_PARTITION_TMPDIR"; then
diff --git a/tests/mv/acl b/tests/mv/acl
index f60f68050..14be68690 100755
--- a/tests/mv/acl
+++ b/tests/mv/acl
@@ -18,11 +18,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Skip this test if cp was built without ACL support:
-grep '^#define USE_ACL 0' $CONFIG_HEADER > /dev/null && \
- {
- echo 1>&2 "$0: insufficient ACL support, so skipping this test"
- (exit 77); exit 77
- }
+grep '^#define USE_ACL 0' $CONFIG_HEADER > /dev/null &&
+ skip_test_ "insufficient ACL support"
if test "$VERBOSE" = yes; then
set -x
@@ -50,11 +47,7 @@ setfacl -m user:bin:rw $t1 || skip_partition=$other_partition_tmpdir
acl1=`getfacl file` || skip_partition=.
test $skip_partition != none &&
- {
- echo "$0: '$skip' is not on a suitable file system for this test" 1>&2
- echo "$0: skipping this test" 1>&2
- (exit 77); exit 77
- }
+ skip_test_ "'$skip' is not on a suitable file system for this test"
# move the access acl of a file
mv file $other_partition_tmpdir || fail=1
diff --git a/tests/mv/i-3 b/tests/mv/i-3
index 15f25ced8..efac633ef 100755
--- a/tests/mv/i-3
+++ b/tests/mv/i-3
@@ -33,7 +33,7 @@ chmod 0 g i || framework_failure
fail=0
ls /dev/stdin >/dev/null 2>&1 \
- || { (exit 77); exit; }
+ || skip_test_ 'there is no /dev/stdin file'
mv f g < /dev/stdin > out 2>&1 & pid=$!
sleep 1
diff --git a/tests/mv/no-target-dir b/tests/mv/no-target-dir
index 7f3a926a5..6fbdc8b9b 100755
--- a/tests/mv/no-target-dir
+++ b/tests/mv/no-target-dir
@@ -30,10 +30,8 @@ touch f || framework_failure
# Skip this test if there's an underlying kernel bug.
mkdir a b b/a || framework_failure
-mv a b || {
- echo "$0: skipping this test: your kernel's rename syscall is buggy" 1>&2
- (exit 77); exit 77
-}
+mv a b ||
+ skip_test_ "your kernel's rename syscall is buggy"
fail=0
diff --git a/tests/other-fs-tmpdir b/tests/other-fs-tmpdir
index baee6d5db..a4f77793f 100755
--- a/tests/other-fs-tmpdir
+++ b/tests/other-fs-tmpdir
@@ -44,16 +44,14 @@ for d in $CANDIDATE_TMP_DIRS; do
done
if test -z "$other_partition_tmpdir"; then
- cat <<EOF 1>&2
-**************************************
+ skip_test_ \
+"**************************************
This test requires a writable directory on a different
disk partition, and I couldn't find one. I tried these:
$CANDIDATE_TMP_DIRS
Set your environment variable CANDIDATE_TMP_DIRS to make
this test use a different list.
-**************************************
-EOF
- (exit 77); exit 77
+**************************************"
fi
test "$VERBOSE" = yes && set -x
diff --git a/tests/rm/empty-name b/tests/rm/empty-name
index a2af5be4c..1384a2fd1 100755
--- a/tests/rm/empty-name
+++ b/tests/rm/empty-name
@@ -24,11 +24,8 @@
: ${PERL=perl}
: ${srcdir=.}
-$PERL -e 'use warnings;' > /dev/null 2>&1 || {
- echo 1>&2 "$0: configure didn't find a usable version of Perl," \
- "so can't run this test"
- exit 77
-}
+$PERL -e 'use warnings;' > /dev/null 2>&1 ||
+ skip_test_ "configure didn't find a usable version of Perl"
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
diff --git a/tests/rm/fail-eperm b/tests/rm/fail-eperm
index 40b719b48..c619574ce 100755
--- a/tests/rm/fail-eperm
+++ b/tests/rm/fail-eperm
@@ -32,11 +32,8 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
: ${PERL=perl}
: ${srcdir=.}
-$PERL -e 1 > /dev/null 2>&1 || {
- echo 1>&2 "$0: configure didn't find a usable version of Perl," \
- "so can't run this test"
- (exit 77); exit 77
-}
+$PERL -e 1 > /dev/null 2>&1 ||
+ skip_test_ "configure didn't find a usable version of Perl"
ARGV_0=$0
export ARGV_0
diff --git a/tests/rm/inaccessible b/tests/rm/inaccessible
index 8d05b3ede..ca82a2c74 100755
--- a/tests/rm/inaccessible
+++ b/tests/rm/inaccessible
@@ -30,8 +30,7 @@ skip=yes
grep '^#define HAVE_OPENAT' $CONFIG_HEADER > /dev/null && skip=no
test -d /proc/self/fd && skip=no
if test $skip = yes; then
- echo 1>&2 "$0: no openat support, so skipping this test"
- (exit 77); exit 77
+ skip_test_ 'this system lacks openat support'
fi
. $srcdir/../test-lib.sh
diff --git a/tests/rm/isatty b/tests/rm/isatty
index cb3f0fd2b..040d97548 100755
--- a/tests/rm/isatty
+++ b/tests/rm/isatty
@@ -29,7 +29,7 @@ fail=0
# Skip this test if there is no /dev/stdin file.
ls /dev/stdin >/dev/null 2>&1 \
- || { (exit 77); exit; }
+ || skip_test_ 'there is no /dev/stdin file'
touch f
chmod 0 f
diff --git a/tests/rm/unreadable b/tests/rm/unreadable
index 16c4c920a..05024c2dc 100755
--- a/tests/rm/unreadable
+++ b/tests/rm/unreadable
@@ -19,11 +19,8 @@
: ${PERL=perl}
: ${srcdir=.}
-$PERL -e 'use warnings;' > /dev/null 2>&1 || {
- echo 1>&2 "$0: configure didn't find a usable version of Perl," \
- "so can't run this test"
- exit 77
-}
+$PERL -e 'use warnings;' > /dev/null 2>&1 ||
+ skip_test_ "configure didn't find a usable version of Perl"
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
diff --git a/tests/setgid-check b/tests/setgid-check
index 20eba30b6..9fca2b71f 100644
--- a/tests/setgid-check
+++ b/tests/setgid-check
@@ -2,7 +2,7 @@
# Disable the current test if the working directory seems to have
# the setgid bit set.
-# Copyright (C) 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2002, 2004, 2005, 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
@@ -33,9 +33,5 @@ case $p in
*) cwd_is_setgid=yes;;
esac
if test $cwd_is_setgid = yes; then
- cat <<EOF >&2
-$0: Since it looks like you're running this test in a directory with
-the setgid bit set, we're skipping this test.
-EOF
- (exit 77); exit 77
+ skip_test_ 'this directory has the setgid bit set'
fi
diff --git a/tests/sparse-file b/tests/sparse-file
index 733d9cd60..4f98bfb87 100644
--- a/tests/sparse-file
+++ b/tests/sparse-file
@@ -1,7 +1,7 @@
# -*- sh -*-
# Does the current (working-dir.) file system support sparse files?
-# 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,7 +25,5 @@ set x `du -sk $t`
kb_size=$2
rm -f $t
if test $kb_size -ge 128; then
- echo "$0: skipping this test, since this file system doesn't support" \
- sparse files 1>&2
- (exit 77); exit 77
+ skip_test_ 'this file system does not support sparse files'
fi
diff --git a/tests/strace b/tests/strace
index aee28a051..bc04fb30a 100644
--- a/tests/strace
+++ b/tests/strace
@@ -16,13 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
strace -V < /dev/null > /dev/null 2>&1 ||
-{
- echo "$0: no strace program, so skipping this test" 1>&2
- (exit 77); exit 77
-}
+ skip_test_ 'no strace program'
strace -qe unlink echo > /dev/null 2>&1 ||
-{
- echo "$0: strace doesn't work, so skipping this test" 1>&2
- (exit 77); exit 77
-}
+ skip_test_ 'strace does not work'
diff --git a/tests/tail-2/append-only b/tests/tail-2/append-only
index 94adba558..606ed339a 100755
--- a/tests/tail-2/append-only
+++ b/tests/tail-2/append-only
@@ -32,8 +32,7 @@ chattr +a f 2>/dev/null || chattr_a_works=0
echo x >> f || chattr_a_works=0
if test $chattr_a_works = 0; then
- echo "$0: chattr +a doesn't work on this file system; skipping this test " 1>&2
- (exit 77); exit 77
+ skip_test_ "chattr +a doesn't work on this file system"
fi
fail=0
diff --git a/tests/tail-2/big-4gb b/tests/tail-2/big-4gb
index 5494e3dc4..27319f98c 100755
--- a/tests/tail-2/big-4gb
+++ b/tests/tail-2/big-4gb
@@ -35,10 +35,10 @@ echo 87654321 | tr -d '\n' > tmp || framework_failure
dd bs=1 seek=4294967288 if=tmp of=big 2> err || dd_failed=1
if test "$dd_failed" = 1; then
cat err 1>&2
- echo "$0: cannot create a file large enough for this test," 1>&2
- echo "$0: possibly because this system doesn't support large files;" 1>&2
- echo "$0: Consider rerunning this test on a different file system." 1>&2
- (exit 77); exit 77
+ skip_test_ \
+'cannot create a file large enough for this test,
+possibly because this system does not support large files;
+Consider rerunning this test on a different file system.'
fi
fail=0
diff --git a/tests/tail-2/tail-n0f b/tests/tail-2/tail-n0f
index de5786e91..3e3bc1ce7 100755
--- a/tests/tail-2/tail-n0f
+++ b/tests/tail-2/tail-n0f
@@ -31,11 +31,8 @@ fi
sleep 2 &
pid=$!
sleep .5
-grep '^State:[ ]*[S]' /proc/$pid/status > /dev/null 2>&1 || \
- {
- echo "$0:/proc/$pid/status: missing or 'different': skipping this test" 1>&2
- (exit 77); exit 77
- }
+grep '^State:[ ]*[S]' /proc/$pid/status > /dev/null 2>&1 ||
+ skip_test_ "/proc/$pid/status: missing or 'different'"
kill $pid
touch empty || framework_failure
diff --git a/tests/touch/dangling-symlink b/tests/touch/dangling-symlink
index 908f30a8a..3c5cbdcec 100755
--- a/tests/touch/dangling-symlink
+++ b/tests/touch/dangling-symlink
@@ -39,14 +39,12 @@ if test $fail = 1; then
*linux-gnu*)
case "`uname -r`" in
2.3.9[0-9]*)
- cat 1>&2 <<EOF
-====================================================
-$0: WARNING!!!
+ skip_test_ \
+'****************************************************
+WARNING!!!
This version of the Linux kernel causes touch to fail
when operating on dangling symlinks.
-====================================================
-EOF
- exit 77
+****************************************************'
;;
esac
;;
diff --git a/tests/touch/fifo b/tests/touch/fifo
index 796d330d9..400c922c8 100755
--- a/tests/touch/fifo
+++ b/tests/touch/fifo
@@ -28,10 +28,7 @@ if ! mkfifo fifo; then
# failure as a test failure. However, in this case, when running on a SunOS
# system using a disk NFS mounted from OpenBSD, the above fails like this:
# mkfifo: cannot make fifo `fifo-10558': Not owner
- echo '********************************************'
- echo 'NOTICE: unable to create test prerequisites'
- echo '********************************************'
- exit 77
+ skip_test_ 'NOTICE: unable to create test prerequisites'
fi
fail=0
diff --git a/tests/touch/not-owner b/tests/touch/not-owner
index 9abb36ba1..4024e0351 100755
--- a/tests/touch/not-owner
+++ b/tests/touch/not-owner
@@ -26,13 +26,11 @@ fi
test=../../src/test
if $test -w /; then
- echo Skipping because you have write access to /.
- (exit 77); exit 77
+ skip_test_ you have write access to /.
fi
if $test -O / || $test -G /; then
- echo Skipping because you own /.
- (exit 77); exit 77
+ skip_test_ "you own /."
fi
. $srcdir/../test-lib.sh
diff --git a/tests/umask-check b/tests/umask-check
index bb0fa3881..238d6587c 100644
--- a/tests/umask-check
+++ b/tests/umask-check
@@ -1,7 +1,7 @@
# -*- sh -*-
# Disable the current test if umask doesn't work as usual.
-# Copyright (C) 2005 Free Software Foundation, Inc.
+# Copyright (C) 2005, 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,10 +27,5 @@ rm -f file1 file2
case $perms in
*'
-'*)
- cat <<EOF >&2
-$0: Since it looks like you're running this test in a directory with
-something other than the usual umask semantics, we're skipping this test.
-EOF
- (exit 77); exit 77
+'*) skip_test_ 'your build directory has unusual umask semantics'
esac