summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-09-13 12:13:35 +0200
committerJim Meyering <jim@meyering.net>2007-09-15 18:59:08 +0200
commitd96a863cf5131c71a19ab88c683c7251de22b598 (patch)
tree4c9aca4b25c9953a74f96aa62e832d76d381d2c2 /tests
parent56f1bd10fc1f2c0d7b72a4e016a45ab12b896901 (diff)
downloadcoreutils-d96a863cf5131c71a19ab88c683c7251de22b598.tar.xz
Enable some previously omitted test scripts. Add a test cross-check.
* tests/rm/Makefile.am (TESTS): Add empty-name and unreadable. * tests/rm/empty-name: Likewise. * tests/rm/unreadable: Reenable this test. Adjust for new rm. * tests/mkdir/Makefile.am: Add writable-under-readonly. * tests/mkdir/writable-under-readonly: Add some comments. This test is always skipped, for now. * tests/Makefile.am (ta): Hook up the new root-only script. * tests/tail-2/infloop-1: Make this test pass. * tests/tail-2/Makefile.am (TESTS): Add infloop-1. * tests/tail-2/fflush: Remove unused file. * tests/check.mk (vc_executable_is_in_TESTS): More portable. * tests/check.mk (check): Depend on the above. * build-aux/check.mk: Remove comment mentioning AUTHORS file.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/check.mk36
-rw-r--r--tests/dd/Makefile.am3
-rw-r--r--tests/install/Makefile.am7
-rw-r--r--tests/ln/Makefile.am4
-rw-r--r--tests/mkdir/Makefile.am12
-rwxr-xr-xtests/mkdir/writable-under-readonly26
-rw-r--r--tests/readlink/Makefile.am4
-rw-r--r--tests/rm/Makefile.am5
-rwxr-xr-xtests/rm/unreadable10
-rw-r--r--tests/rmdir/Makefile.am3
-rw-r--r--tests/tail-2/Makefile.am1
-rwxr-xr-xtests/tail-2/fflush43
-rwxr-xr-xtests/tail-2/infloop-16
14 files changed, 89 insertions, 75 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7fa6ed5ac..254efc470 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -50,7 +50,7 @@ SUBDIRS = \
uniq wc
## N O T E :: Please do not add new directories.
-all_t = t1 t2 t3 t4 t5 t6 t7 t8 t9
+all_t = t1 t2 t3 t4 t5 t6 t7 t8 t9 ta
.PHONY: check-root $(all_t)
check-root: $(all_t)
@@ -72,6 +72,8 @@ t8:
cd misc && $(MAKE) check TESTS=chcon
t9:
cd cp && $(MAKE) check TESTS=cp-a-selinux
+ta:
+ cd mkdir && $(MAKE) check TESTS=writable-under-readonly
check-recursive: root-hint
diff --git a/tests/check.mk b/tests/check.mk
index d0437681f..d358f18cf 100644
--- a/tests/check.mk
+++ b/tests/check.mk
@@ -1,14 +1,30 @@
-# FIXME: add comment
+# Include this file at the end of each tests/*/Makefile.am.
+# 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/>.
# Ensure that all version-controlled executable files are listed in TESTS.
-_v = TESTS
-FIXME_hook_this_to_make_distcheck:
- sed -n '/^$(_v) =/,/[^\]$$/p' $(srcdir)/Makefile.am \
- | sed 's/^ *//;/^\$$.*/d;/^$(_v) =/d' \
- | tr -s '\012\\' ' ' | fmt -1 | sort -u > t1
- find `$(top_srcdir)/build-aux/vc-list-files $(srcdir)` \
- -type f -perm -111 -printf '%f\n'|sort -u \
- | diff -u t1 -
+vc_exe_in_TESTS: Makefile
+ @if test -d $(top_srcdir)/.git; then \
+ echo $(TESTS) | tr -s ' ' '\n' | sort -u > t1; \
+ for f in `$(top_srcdir)/build-aux/vc-list-files .`; do \
+ test -f "$$f" && test -x "$$f" && echo "$$f"; \
+ done | sort -u | diff -u t1 -; \
+ else :; fi
+
+check: vc_exe_in_TESTS
+.PHONY: vc_exe_in_TESTS
# Append this, because automake does the same.
TESTS_ENVIRONMENT += \
@@ -20,5 +36,5 @@ TESTS_ENVIRONMENT += \
TEST_LOGS = $(TESTS:=.log)
# Parallel replacement of Automake's check-TESTS target.
-# Include it last.
+# CAVEAT: code in the following relies on GNU make.
include $(top_srcdir)/build-aux/check.mk
diff --git a/tests/dd/Makefile.am b/tests/dd/Makefile.am
index 50f1e66d5..26c26ada7 100644
--- a/tests/dd/Makefile.am
+++ b/tests/dd/Makefile.am
@@ -8,6 +8,7 @@ TESTS_ENVIRONMENT = \
PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" \
PROG=dd
-TESTS = misc not-rewound skip-seek skip-seek2 unblock-sync
+TESTS = \
+ misc not-rewound skip-seek skip-seek2 unblock-sync
include $(top_srcdir)/tests/check.mk
diff --git a/tests/install/Makefile.am b/tests/install/Makefile.am
index c97252dfe..5714bcf35 100644
--- a/tests/install/Makefile.am
+++ b/tests/install/Makefile.am
@@ -1,5 +1,10 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
-TESTS = trap basic-1 create-leading d-slashdot
+TESTS = \
+ basic-1 \
+ create-leading \
+ d-slashdot \
+ trap
+
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
EXEEXT='$(EXEEXT)' \
diff --git a/tests/ln/Makefile.am b/tests/ln/Makefile.am
index 4b5797f11..87aadf6f7 100644
--- a/tests/ln/Makefile.am
+++ b/tests/ln/Makefile.am
@@ -1,5 +1,7 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
-TESTS = hard-backup target-1 sf-1 misc backup-1
+TESTS = \
+ hard-backup target-1 sf-1 misc backup-1
+
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
diff --git a/tests/mkdir/Makefile.am b/tests/mkdir/Makefile.am
index 252c48fa1..8a8db6c9d 100644
--- a/tests/mkdir/Makefile.am
+++ b/tests/mkdir/Makefile.am
@@ -1,7 +1,17 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
TESTS = \
+ p-1 \
+ p-2 \
+ p-3 \
+ p-slashdot \
p-thru-slink \
- p-3 p-1 p-2 p-v special-1 perm parents t-slash p-slashdot
+ p-v \
+ parents \
+ perm \
+ special-1 \
+ t-slash \
+ writable-under-readonly
+
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
diff --git a/tests/mkdir/writable-under-readonly b/tests/mkdir/writable-under-readonly
index a8fc792c9..0c30f3f70 100755
--- a/tests/mkdir/writable-under-readonly
+++ b/tests/mkdir/writable-under-readonly
@@ -1,8 +1,7 @@
#!/bin/sh
-# This is just for the record.
-# This test is not run.
+# FIXME: convert this to a root-only test.
-# 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
@@ -25,20 +24,31 @@
#
# Demonstrate the problem, as root:
-mount='sudo mount'
+if test "$VERBOSE" = yes; then
+ set -x
+ mkdir --version
+fi
+PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
+
+# FIXME: for now, skip it unconditionally
+skip_test_ temporarily disabled
+
+# FIXME: define cleanup_ to do the umount
+
+# FIXME: use mktemp
cd /tmp \
&& dd if=/dev/zero of=1 bs=8192 count=50 \
&& dd if=/dev/zero of=2 bs=8192 count=50 \
&& mkdir -p mnt-ro && mkfs -t ext2 1 && mkfs -t ext2 2 \
- && $mount -o loop=/dev/loop3 1 mnt-ro \
+ && mount -o loop=/dev/loop3 1 mnt-ro \
&& mkdir -p mnt-ro/rw \
- && $mount -o remount,ro mnt-ro \
- && $mount -o loop=/dev/loop4 2 mnt-ro/rw
+ && mount -o remount,ro mnt-ro \
+ && mount -o loop=/dev/loop4 2 mnt-ro/rw
mkdir -p mnt-ro/rw/sub || fail=1
# To clean up
umount /tmp/2
umount /tmp/1
-rm -rf /tmp/[12]
diff --git a/tests/readlink/Makefile.am b/tests/readlink/Makefile.am
index 74c3be475..3a2e1f399 100644
--- a/tests/readlink/Makefile.am
+++ b/tests/readlink/Makefile.am
@@ -1,5 +1,7 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
-TESTS = rl-1 can-e can-f can-m
+TESTS = \
+ rl-1 can-e can-f can-m
+
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
diff --git a/tests/rm/Makefile.am b/tests/rm/Makefile.am
index 203fe36a6..f29274744 100644
--- a/tests/rm/Makefile.am
+++ b/tests/rm/Makefile.am
@@ -33,12 +33,15 @@ TESTS = \
unread3 \
no-give-up \
dir-no-w \
+ empty-name \
fail-2eperm \
cycle i-no-r fail-eperm \
rm1 rm2 rm3 rm4 rm5 \
unread2 r-1 r-2 r-3 r-4 i-1 ir-1 f-1 sunos-1 \
+ unreadable \
interactive-always interactive-once \
- isatty # unreadable empty-name
+ isatty
+
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
RM=../../src/rm \
diff --git a/tests/rm/unreadable b/tests/rm/unreadable
index c5b9c9877..66a59515c 100755
--- a/tests/rm/unreadable
+++ b/tests/rm/unreadable
@@ -1,7 +1,7 @@
#!/bin/sh
# Test "rm" and unreadable directories.
-# Copyright (C) 1998, 2003, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1998, 2003, 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
@@ -43,12 +43,12 @@ my @Tests =
(
# test-name options input expected-output
#
- ['unreadable-1', '-rf', $d,
- {EXIT => 1}, {ERR => "$prog: $d/.: Permission denied\n"}, $mkdir],
+ # Removing an empty, unwritable directory succeeds.
+ ['unreadable-1', '-rf', $d, {EXIT => 0}, $mkdir],
+
['unreadable-2', '-rf', $d,
{EXIT => 1},
- {ERR => "$prog: $d/.: Permission denied\n" .
- "$prog: cannot remove directory `$d': File exists\n"},
+ {ERR => "$prog: cannot remove \`$d': Permission denied\n"},
{PRE => sub { (mkdir $d,0700 and mkdir "$d/x",0700 and chmod 0100,$d)
or die "$d: $!\n"}} ],
);
diff --git a/tests/rmdir/Makefile.am b/tests/rmdir/Makefile.am
index b473cc457..4e73c7338 100644
--- a/tests/rmdir/Makefile.am
+++ b/tests/rmdir/Makefile.am
@@ -1,5 +1,6 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
-TESTS = fail-perm ignore t-slash
+TESTS = \
+ fail-perm ignore t-slash
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
diff --git a/tests/tail-2/Makefile.am b/tests/tail-2/Makefile.am
index 055168a90..da9909044 100644
--- a/tests/tail-2/Makefile.am
+++ b/tests/tail-2/Makefile.am
@@ -27,6 +27,7 @@ TESTS_ENVIRONMENT = \
TESTS = \
append-only \
tail-n0f \
+ infloop-1 \
big-4gb proc-ksyms start-middle assert assert-2
include $(top_srcdir)/tests/check.mk
diff --git a/tests/tail-2/fflush b/tests/tail-2/fflush
deleted file mode 100755
index 020601f17..000000000
--- a/tests/tail-2/fflush
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-# This test would fail on solaris5.7 with tail from pre-1.22k textutils.
-# The problem was that using the solaris5.7 setvbuf function to turn off
-# buffering doesn't flush stdout.
-
-# Copyright (C) 1999, 2000, 2003, 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
-# 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/>.
-
-
-# FIXME: actually, I couldn't find a way to write the test (without resorting
-# to use of expect) so that it would provoke the failure on solaris5.7.
-# To exercise the bug, cat's stdout seems to have to be directed
-# to a terminal.
-
-if test "$VERBOSE" = yes; then
- set -x
- tail --version
-fi
-
-. $srcdir/../test-lib.sh
-
-echo fubar > in
-tail -f in | cat > out &
-pid=$!
-sleep 1
-kill $pid
-
-fail=0
-test "`cat out`" = fubar || fail=1
-
-exit $fail
diff --git a/tests/tail-2/infloop-1 b/tests/tail-2/infloop-1
index 9b2701f9f..eb95ea090 100755
--- a/tests/tail-2/infloop-1
+++ b/tests/tail-2/infloop-1
@@ -32,4 +32,8 @@ tail -n 1 t &
tail_pid=$!
kill $yes_pid
sleep 1
-kill $tail_pid
+
+fail=0
+kill $tail_pid && fail=1 || :
+
+(exit $fail); exit $fail