1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 03:12:48 +02:00

Revamp test-related Makefiles.

One side-effect of this change is that "make check" now works even if
you put "." early in your shell's search PATH (don't do that!).

Remove all test-related Makefile.am files, except those generated
by mk-script.  Instead, tests/Makefile.am now lists not only the
tests directly under tests/, but also those in tests/*/ that are
not generated by mk-script, e.g., cp/abuse, cp/acl, mv/i-1, etc.

A lot of these changes are like this:

-. $srcdir/../lang-default
+. $top_srcdir/tests/lang-default

-. $srcdir/../test-lib.sh
+. $top_srcdir/tests/test-lib.sh

* configure.ac (AC_CONFIG_FILES): Remove corresponding Makefiles.
* tests/check.mk (vc_exe_in_TESTS): Relax syntax requirements.
* tests/rwx-to-mode: Remove file.  Rewritten as...
* tests/test-lib.sh (rwx_to_mode_): ...this new function.
* tests/Makefile.am (EXTRA_DIST): Remove rwx-to-mode.
(SUBDIRS): Remove each dir with a removed Makefile.am.
(EXTRA_DIST): Add $(TESTS).
(TESTS): Add over 300 entries.
This commit is contained in:
Jim Meyering
2008-04-17 23:34:45 +02:00
parent d25bf9dceb
commit 512e111a92
342 changed files with 1096 additions and 1123 deletions

View File

@@ -3,7 +3,7 @@
# Before coreutils-5.93, on systems with a signed, 32-bit stat.st_blocks
# one of du's computations would overflow.
# Copyright (C) 2005-2007 Free Software Foundation, Inc.
# Copyright (C) 2005-2008 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
@@ -23,7 +23,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
# Creating a 2GB file counts as `very expensive'.
very_expensive_

View File

@@ -2,7 +2,7 @@
# Ensure that du does not rely on narrow types like size_t for
# file sizes or sums.
# Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc.
# Copyright (C) 2003, 2005-2008 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
@@ -22,8 +22,8 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../sparse-file
. $srcdir/../test-lib.sh
. $top_srcdir/tests/sparse-file
. $top_srcdir/tests/test-lib.sh
dd bs=1 seek=8G of=big < /dev/null 2> /dev/null
if test $? != 0; then

View File

@@ -1,34 +0,0 @@
# Make coreutils tests for "du". -*-Makefile-*-
# Copyright (C) 2000, 2002-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/>.
TESTS = \
2g \
inacc-dir \
one-file-system \
inacc-dest \
long-from-unreadable \
long-sloop \
files0-from \
inaccessible-cwd \
deref-args \
slash \
fd-leak \
hard-link 8gb basic restore-wd \
exclude no-x no-deref trailing-slash deref two-args slink
EXTRA_DIST = $(TESTS)
include $(top_srcdir)/tests/check.mk

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Compare actual numbers from du, assuming block size matches mine.
# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2003, 2006-2008 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
@@ -22,8 +22,8 @@ if test "$VERBOSE" = yes; then
fi
# DU_BLOCK_SIZE could cause problems
. $srcdir/../lang-default
. $srcdir/../test-lib.sh
. $top_srcdir/tests/lang-default
. $top_srcdir/tests/test-lib.sh
mkdir -p a/b d d/sub || framework_failure

View File

@@ -2,7 +2,7 @@
# prior to coreutils-4.5.3, du -D didn't work in some cases
# Based on an example from Andreas Schwab and/or Michal Svec.
# Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2002, 2006-2008 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
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
mkdir -p a/sub || framework_failure
ln -s a/sub slink || framework_failure

View File

@@ -2,7 +2,7 @@
# Ensure that --dereference-args (-D) gives reasonable names.
# This test would fail for coreutils-5.0.91.
# Copyright (C) 2003-2007 Free Software Foundation, Inc.
# Copyright (C) 2003-2008 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
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
mkdir -p dir/a || framework_failure
ln -s dir slink || framework_failure

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# make sure du's --exclude option works
# Copyright (C) 2003-2007 Free Software Foundation, Inc.
# Copyright (C) 2003-2008 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
@@ -21,7 +21,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
mkdir -p a/b/c a/x/y a/u/v || framework_failure

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# check for file descriptor leak
# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2003, 2006-2008 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
@@ -23,8 +23,8 @@ fi
# Call this an expensive test. It's not that expensive, but command line
# limitations might induce failure on some losing systems.
. $srcdir/../expensive
. $srcdir/../test-lib.sh
. $top_srcdir/tests/expensive
. $top_srcdir/tests/test-lib.sh
# Create 1296 (36^2) files.
# Their names and separating spaces take up 3887 bytes.

View File

@@ -2,7 +2,7 @@
# -*- perl -*-
# Exercise du's --files0-from option.
# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
# Copyright (C) 2004, 2005, 2007-2008 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
@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
: ${srcdir=.}
. $srcdir/../require-perl
. $top_srcdir/tests/require-perl
me=`echo $0|sed 's,.*/,,'`
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF

View File

@@ -3,7 +3,7 @@
# Likewise for excluded directories.
# Ensure that hard links _are_ listed twice when using --count-links.
# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2003, 2006-2008 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
@@ -23,8 +23,8 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../lang-default
. $srcdir/../test-lib.sh
. $top_srcdir/tests/lang-default
. $top_srcdir/tests/test-lib.sh
mkdir -p dir/sub
( cd dir && { echo non-empty > f1; ln f1 f2; echo non-empty > sub/F; } )

View File

@@ -2,7 +2,7 @@
# Prior to coreutils-6.5, an inaccessible destination dir (chmod a-x)
# would cause du to exit prematurely on systems with native openat support.
# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2006-2008 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
@@ -22,8 +22,8 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../lang-default
. $srcdir/../test-lib.sh
. $top_srcdir/tests/lang-default
. $top_srcdir/tests/test-lib.sh
skip_if_root_
mkdir f && cd f && mkdir a b c d e && touch c/j && chmod a-x c \

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# Ensure that du counts the size of an inaccessible directory.
# Copyright (C) 2007 Free Software Foundation, Inc.
# Copyright (C) 2007-2008 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
@@ -20,7 +20,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
skip_if_root_
mkdir -p a/sub || framework_failure

View File

@@ -2,7 +2,7 @@
# Ensure that even when run from an inaccessible directory, du can still
# operate on accessible directories elsewhere.
# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2003, 2006-2008 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,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
skip_if_root_
cwd=`pwd`

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Show fts fails on old-fashioned systems.
# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2006-2008 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,7 +33,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
proc_file=/proc/self/fd
if test ! -d $proc_file; then

View File

@@ -3,7 +3,7 @@
# Show that du fails with ELOOP (Too many levels of symbolic links)
# when it encounters that condition.
# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2006-2008 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
@@ -23,8 +23,8 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../lang-default
. $srcdir/../test-lib.sh
. $top_srcdir/tests/lang-default
. $top_srcdir/tests/test-lib.sh
# Create lots of directories, each containing a single symlink
# pointing at the next directory in the list.

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Ensure that by default, du doesn't dereference command-line symlinks.
# Copyright (C) 2003, 2004, 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2003, 2004, 2006-2008 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
@@ -21,7 +21,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
mkdir -p dir/a/b || framework_failure
ln -s dir slink || framework_failure

View File

@@ -2,7 +2,7 @@
# Make sure du gives the right diagnostic for a readable,
# but inaccessible directory.
# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2003, 2006-2008 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
@@ -22,8 +22,8 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../lang-default
. $srcdir/../test-lib.sh
. $top_srcdir/tests/lang-default
. $top_srcdir/tests/test-lib.sh
skip_if_root_
mkdir -p d/no-x/y || framework_failure

View File

@@ -2,7 +2,7 @@
# Test for a bug in fts's handling of FTS_XDEV, the flag behind
# du's --one-file-system (-x) option.
# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2006-2008 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
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
mkdir -p b/c y/z || framework_failure

View File

@@ -2,7 +2,7 @@
# due to a bug in glibc's ftw.c, in some cases, nftw w/FTW_CHDIR
# would not restore the working directory.
# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2003, 2006-2008 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
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
mkdir a b || framework_failure

View File

@@ -21,7 +21,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
require_readable_root_
fail=0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Ensure that the size of a long-named-symlink is > 0.
# Copyright (C) 2002-2007 Free Software Foundation, Inc.
# Copyright (C) 2002-2008 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
@@ -21,7 +21,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
# Determine if `.' is on a local (would non-NFS be sufficient?) file system.
# On at least some NFS implementations, symlinks never take up space,

View File

@@ -2,7 +2,7 @@
# Ensure that du works properly for an argument that refers to a
# symbolic link, and that is specified with a trailing slash.
# Copyright (C) 2002-2007 Free Software Foundation, Inc.
# Copyright (C) 2002-2008 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
@@ -24,7 +24,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
mkdir -p dir/1/2 || framework_failure
ln -s dir slink || framework_failure

View File

@@ -2,7 +2,7 @@
# Make sure `du d/1 d/2' works.
# That command failed with du from fileutils-4.0q.
# Copyright (C) 2000, 2004-2007 Free Software Foundation, Inc.
# Copyright (C) 2000, 2004-2008 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
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
. $srcdir/../test-lib.sh
. $top_srcdir/tests/test-lib.sh
# Run this test from a sub-directory one level deeper than normal,
# so that the "du .." below doesn't traverse sibling directories