summaryrefslogtreecommitdiff
path: root/tests/du
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-01-20 10:55:18 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-01-20 10:55:18 +0000
commit70e9163c9c18e995515598085cb824e554eb7ae7 (patch)
treea42dc8b2a6c031354bf31472de888bfc8a060132 /tests/du
parentcbf5993c43f49281173f185863577d86bfac6eae (diff)
downloadcoreutils-tarball-master.tar.gz
Diffstat (limited to 'tests/du')
-rwxr-xr-xtests/du/2g93
-rwxr-xr-xtests/du/2g.sh71
-rwxr-xr-xtests/du/8gb77
-rwxr-xr-xtests/du/8gb.sh53
-rw-r--r--tests/du/Makefile.am37
-rw-r--r--tests/du/Makefile.in749
-rwxr-xr-xtests/du/basic.sh (renamed from tests/du/basic)74
-rwxr-xr-xtests/du/bigtime.sh52
-rwxr-xr-xtests/du/bind-mount-dir-cycle-v2.sh38
-rwxr-xr-xtests/du/bind-mount-dir-cycle.sh37
-rwxr-xr-xtests/du/deref50
-rwxr-xr-xtests/du/deref-args.sh (renamed from tests/du/deref-args)45
-rwxr-xr-xtests/du/deref.sh48
-rwxr-xr-xtests/du/exclude.sh (renamed from tests/du/exclude)39
-rwxr-xr-xtests/du/fd-leak.sh (renamed from tests/du/fd-leak)36
-rwxr-xr-xtests/du/files0-from-dir.sh39
-rwxr-xr-xtests/du/files0-from.pl (renamed from tests/du/files0-from)69
-rwxr-xr-xtests/du/hard-link71
-rwxr-xr-xtests/du/hard-link.sh64
-rwxr-xr-xtests/du/inacc-dest83
-rwxr-xr-xtests/du/inacc-dest.sh56
-rwxr-xr-xtests/du/inacc-dir.sh42
-rwxr-xr-xtests/du/inaccessible-cwd53
-rwxr-xr-xtests/du/inaccessible-cwd.sh40
-rwxr-xr-xtests/du/inodes.sh140
-rwxr-xr-xtests/du/long-from-unreadable.sh (renamed from tests/du/long-from-unreadable)74
-rwxr-xr-xtests/du/long-sloop99
-rwxr-xr-xtests/du/long-sloop.sh72
-rwxr-xr-xtests/du/max-depth.sh39
-rwxr-xr-xtests/du/move-dir-while-traversing.sh100
-rwxr-xr-xtests/du/no-deref54
-rwxr-xr-xtests/du/no-deref.sh33
-rwxr-xr-xtests/du/no-x72
-rwxr-xr-xtests/du/no-x.sh49
-rwxr-xr-xtests/du/one-file-system61
-rwxr-xr-xtests/du/one-file-system.sh57
-rwxr-xr-xtests/du/restore-wd49
-rwxr-xr-xtests/du/restore-wd.sh31
-rwxr-xr-xtests/du/slash54
-rwxr-xr-xtests/du/slash.sh33
-rwxr-xr-xtests/du/slink79
-rwxr-xr-xtests/du/threshold.sh362
-rwxr-xr-xtests/du/trailing-slash68
-rwxr-xr-xtests/du/trailing-slash.sh47
-rwxr-xr-xtests/du/two-args51
-rwxr-xr-xtests/du/two-args.sh40
46 files changed, 1655 insertions, 2025 deletions
diff --git a/tests/du/2g b/tests/du/2g
deleted file mode 100755
index 5ed11e7..0000000
--- a/tests/du/2g
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/bin/sh
-# Ensure that du can handle a 2GB file (i.e., a file of size 2^31 bytes)
-# Before coreutils-5.93, on systems with a signed, 32-bit stat.st_blocks
-# one of du's computations would overflow.
-
-# Copyright (C) 2005, 2006 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-. $srcdir/../envvar-check
-
-# Creating a 2GB file counts as `very expensive'.
-. $srcdir/../very-expensive
-
-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
-
-fail=0
-
-# Get number of free kilobytes on current partition, so we can
-# skip this test if there is insufficient free space.
-
-# This technique relies on the fact that the `Available' kilobyte
-# count is the number just before the one with a trailing `%'.
-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;;
-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
-}
-
-big=big
-rm -f $big
-test -t 1 || printf 'creating a 2GB file...\n'
-for i in `seq 100`; do
- # Note: 2147483648 == 2^31. Print floor(2^31/100) per iteration.
- printf %21474836s x >> $big || fail=1
- # On the final iteration, append the remaining 48 bytes.
- test $i = 100 && { printf %48s x >> $big || fail=1; }
- test -t 1 && printf 'creating a 2GB file: %d%% complete\r' $i
-done
-echo
-
-du -k $big > out1 || fail=1
-rm -f $big
-sed 's/^2[0-9][0-9][0-9][0-9][0-9][0-9] '$big'$/~2M/' out1 > out
-
-cat <<\EOF > exp || fail=1
-~2M
-EOF
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/du/2g.sh b/tests/du/2g.sh
new file mode 100755
index 0000000..fa816fb
--- /dev/null
+++ b/tests/du/2g.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+# Ensure that du can handle a 2GB file (i.e., a file of size 2^31 bytes)
+# Before coreutils-5.93, on systems with a signed, 32-bit stat.st_blocks
+# one of du's computations would overflow.
+
+# Copyright (C) 2005-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+# Creating a 2GB file counts as 'very expensive'.
+very_expensive_
+
+# Get number of free kilobytes on current partition, so we can
+# skip this test if there is insufficient free space.
+free_kb=$(df -k --output=avail . | tail -n1)
+case "$free_kb" in
+ [0-9]*) ;;
+ *) skip_ "invalid size from df: $free_kb";;
+esac
+
+# Require about 3GB free.
+min_kb=3000000
+test $min_kb -lt $free_kb ||
+{
+ skip_ \
+ "too little free space on current partition: $free_kb (need $min_kb KB)"
+}
+
+big=big
+
+if ! fallocate -l2G $big; then
+ rm -f $big
+ {
+ is_local_dir_ . || skip 'Not writing 2GB data to remote'
+ for i in $(seq 100); do
+ # Note: 2147483648 == 2^31. Print floor(2^31/100) per iteration.
+ printf %21474836s x || fail=1
+ done
+ # After the final iteration, append the remaining 48 bytes.
+ printf %48s x || fail=1
+ } > $big || fail=1
+fi
+
+# The allocation may be done asynchronously (BTRFS for example)
+sync $big || framework_failure_
+
+du -k $big > out1 || fail=1
+rm -f $big
+sed 's/^2[0-9][0-9][0-9][0-9][0-9][0-9] '$big'$/~2M/' out1 > out
+
+cat <<\EOF > exp || fail=1
+~2M
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/8gb b/tests/du/8gb
deleted file mode 100755
index 400c29d..0000000
--- a/tests/du/8gb
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/sh
-# Ensure that du does not rely on narrow types like size_t for
-# file sizes or sums.
-
-# Copyright (C) 2003, 2005, 2006 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../sparse-file
-
-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
-
-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
-fi
-
-# FIXME: this should be a test of dd.
-# On some systems (at least linux-2.4.18 + NFS to disks on a Solaris system)
-# the `dd' command above mistakenly creates a file of length `0', yet
-# doesn't fail. The root of that failure is that the ftruncate call
-# returns zero but doesn't do its job. Detect this failure.
-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
-fi
-
-fail=0
-
-# This would print `0 big' with coreutils-4.5.8.
-du -ab big > out || fail=1
-
-cat <<\EOF > exp
-8589934592 big
-EOF
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/du/8gb.sh b/tests/du/8gb.sh
new file mode 100755
index 0000000..25258c8
--- /dev/null
+++ b/tests/du/8gb.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+# Ensure that du does not rely on narrow types like size_t for
+# file sizes or sums.
+
+# Copyright (C) 2003-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+require_sparse_support_
+
+dd bs=1 seek=8G of=big < /dev/null 2> /dev/null
+if test $? != 0; then
+ skip_ '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.
+# On some systems (at least linux-2.4.18 + NFS to disks on a Solaris system)
+# the 'dd' command above mistakenly creates a file of length '0', yet
+# doesn't fail. The root of that failure is that the ftruncate call
+# returns zero but doesn't do its job. Detect this failure.
+set x $(ls -gG big)
+size=$4
+if test "$size" = 0; then
+ skip_ "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
+
+
+# This would print '0 big' with coreutils-4.5.8.
+du -ab big > out || fail=1
+
+cat <<\EOF > exp
+8589934592 big
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/Makefile.am b/tests/du/Makefile.am
deleted file mode 100644
index 3149cfa..0000000
--- a/tests/du/Makefile.am
+++ /dev/null
@@ -1,37 +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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-TESTS = \
- one-file-system \
- inacc-dest \
- long-from-unreadable \
- long-sloop \
- 2g \
- 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)
-TESTS_ENVIRONMENT = \
- PERL="$(PERL)" \
- CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
- PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH"
diff --git a/tests/du/Makefile.in b/tests/du/Makefile.in
deleted file mode 100644
index b68e6b4..0000000
--- a/tests/du/Makefile.in
+++ /dev/null
@@ -1,749 +0,0 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-# 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = tests/du
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \
- $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/alloca.m4 \
- $(top_srcdir)/m4/allocsa.m4 $(top_srcdir)/m4/argmatch.m4 \
- $(top_srcdir)/m4/arpa_inet_h.m4 $(top_srcdir)/m4/assert.m4 \
- $(top_srcdir)/m4/atexit.m4 $(top_srcdir)/m4/autobuild.m4 \
- $(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/base64.m4 \
- $(top_srcdir)/m4/bison.m4 $(top_srcdir)/m4/boottime.m4 \
- $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/calloc.m4 \
- $(top_srcdir)/m4/canon-host.m4 \
- $(top_srcdir)/m4/canonicalize.m4 \
- $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/check-decl.m4 \
- $(top_srcdir)/m4/chown.m4 $(top_srcdir)/m4/clock_time.m4 \
- $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \
- $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \
- $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cycle-check.m4 \
- $(top_srcdir)/m4/d-ino.m4 $(top_srcdir)/m4/d-type.m4 \
- $(top_srcdir)/m4/dirfd.m4 $(top_srcdir)/m4/dirname.m4 \
- $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \
- $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/eealloc.m4 \
- $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \
- $(top_srcdir)/m4/euidaccess-stat.m4 \
- $(top_srcdir)/m4/euidaccess.m4 $(top_srcdir)/m4/exclude.m4 \
- $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \
- $(top_srcdir)/m4/fchdir.m4 $(top_srcdir)/m4/fcntl-safer.m4 \
- $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/fd-reopen.m4 \
- $(top_srcdir)/m4/file-type.m4 $(top_srcdir)/m4/fileblocks.m4 \
- $(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/filenamecat.m4 \
- $(top_srcdir)/m4/flexmember.m4 $(top_srcdir)/m4/fnmatch.m4 \
- $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/fprintftime.m4 \
- $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/fstypename.m4 \
- $(top_srcdir)/m4/fsusage.m4 $(top_srcdir)/m4/ftruncate.m4 \
- $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getaddrinfo.m4 \
- $(top_srcdir)/m4/getcwd-abort-bug.m4 \
- $(top_srcdir)/m4/getcwd-path-max.m4 $(top_srcdir)/m4/getcwd.m4 \
- $(top_srcdir)/m4/getdate.m4 $(top_srcdir)/m4/getdelim.m4 \
- $(top_srcdir)/m4/getgroups.m4 $(top_srcdir)/m4/gethostname.m4 \
- $(top_srcdir)/m4/gethrxtime.m4 $(top_srcdir)/m4/getline.m4 \
- $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getndelim2.m4 \
- $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/getpagesize.m4 \
- $(top_srcdir)/m4/getpass.m4 $(top_srcdir)/m4/gettext.m4 \
- $(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
- $(top_srcdir)/m4/getugroups.m4 \
- $(top_srcdir)/m4/getusershell.m4 $(top_srcdir)/m4/glibc21.m4 \
- $(top_srcdir)/m4/gnulib-common.m4 \
- $(top_srcdir)/m4/gnulib-comp.m4 \
- $(top_srcdir)/m4/group-member.m4 \
- $(top_srcdir)/m4/hard-locale.m4 $(top_srcdir)/m4/hash.m4 \
- $(top_srcdir)/m4/host-os.m4 $(top_srcdir)/m4/human.m4 \
- $(top_srcdir)/m4/i-ring.m4 $(top_srcdir)/m4/iconv.m4 \
- $(top_srcdir)/m4/idcache.m4 $(top_srcdir)/m4/inet_ntop.m4 \
- $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intmax_t.m4 \
- $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
- $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \
- $(top_srcdir)/m4/isapipe.m4 $(top_srcdir)/m4/jm-macros.m4 \
- $(top_srcdir)/m4/jm-winsz1.m4 $(top_srcdir)/m4/jm-winsz2.m4 \
- $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/lchown.m4 \
- $(top_srcdir)/m4/lib-check.m4 $(top_srcdir)/m4/lib-ignore.m4 \
- $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/link-follow.m4 \
- $(top_srcdir)/m4/localcharset.m4 \
- $(top_srcdir)/m4/long-options.m4 \
- $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \
- $(top_srcdir)/m4/ls-mntd-fs.m4 $(top_srcdir)/m4/lstat.m4 \
- $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \
- $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbscasecmp.m4 \
- $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbswidth.m4 \
- $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/memcasecmp.m4 \
- $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memcmp.m4 \
- $(top_srcdir)/m4/memcoll.m4 $(top_srcdir)/m4/memcpy.m4 \
- $(top_srcdir)/m4/memmove.m4 $(top_srcdir)/m4/mempcpy.m4 \
- $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/memset.m4 \
- $(top_srcdir)/m4/memxfrm.m4 $(top_srcdir)/m4/mkancesdirs.m4 \
- $(top_srcdir)/m4/mkdir-p.m4 $(top_srcdir)/m4/mkdir-slash.m4 \
- $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/mktime.m4 \
- $(top_srcdir)/m4/modechange.m4 $(top_srcdir)/m4/mountlist.m4 \
- $(top_srcdir)/m4/mpsort.m4 $(top_srcdir)/m4/nanosleep.m4 \
- $(top_srcdir)/m4/netinet_in_h.m4 $(top_srcdir)/m4/nls.m4 \
- $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/pathmax.m4 \
- $(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/physmem.m4 \
- $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/posixtm.m4 \
- $(top_srcdir)/m4/posixver.m4 $(top_srcdir)/m4/prereq.m4 \
- $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/putenv.m4 \
- $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
- $(top_srcdir)/m4/randint.m4 $(top_srcdir)/m4/randperm.m4 \
- $(top_srcdir)/m4/randread.m4 $(top_srcdir)/m4/readlink.m4 \
- $(top_srcdir)/m4/readtokens.m4 $(top_srcdir)/m4/readutmp.m4 \
- $(top_srcdir)/m4/regex.m4 \
- $(top_srcdir)/m4/rename-dest-slash.m4 \
- $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rmdir-errno.m4 \
- $(top_srcdir)/m4/rmdir.m4 $(top_srcdir)/m4/root-dev-ino.m4 \
- $(top_srcdir)/m4/rpmatch.m4 $(top_srcdir)/m4/safe-read.m4 \
- $(top_srcdir)/m4/safe-write.m4 $(top_srcdir)/m4/same.m4 \
- $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/savedir.m4 \
- $(top_srcdir)/m4/savewd.m4 $(top_srcdir)/m4/setenv.m4 \
- $(top_srcdir)/m4/settime.m4 $(top_srcdir)/m4/sha1.m4 \
- $(top_srcdir)/m4/sha256.m4 $(top_srcdir)/m4/sha512.m4 \
- $(top_srcdir)/m4/sig2str.m4 $(top_srcdir)/m4/snprintf.m4 \
- $(top_srcdir)/m4/socklen.m4 $(top_srcdir)/m4/sockpfaf.m4 \
- $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/st_dm_mode.m4 \
- $(top_srcdir)/m4/stat-prog.m4 $(top_srcdir)/m4/stat-time.m4 \
- $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \
- $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
- $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \
- $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \
- $(top_srcdir)/m4/stpcpy.m4 $(top_srcdir)/m4/strcspn.m4 \
- $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strftime.m4 \
- $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strndup.m4 \
- $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/strnumcmp.m4 \
- $(top_srcdir)/m4/strpbrk.m4 $(top_srcdir)/m4/strtod.m4 \
- $(top_srcdir)/m4/strtoimax.m4 $(top_srcdir)/m4/strtol.m4 \
- $(top_srcdir)/m4/strtoll.m4 $(top_srcdir)/m4/strtoul.m4 \
- $(top_srcdir)/m4/strtoull.m4 $(top_srcdir)/m4/strtoumax.m4 \
- $(top_srcdir)/m4/strverscmp.m4 \
- $(top_srcdir)/m4/sys_socket_h.m4 \
- $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
- $(top_srcdir)/m4/tempname.m4 $(top_srcdir)/m4/time_h.m4 \
- $(top_srcdir)/m4/time_r.m4 $(top_srcdir)/m4/timespec.m4 \
- $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/tzset.m4 \
- $(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \
- $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlink-busy.m4 \
- $(top_srcdir)/m4/unlinkdir.m4 $(top_srcdir)/m4/unlocked-io.m4 \
- $(top_srcdir)/m4/uptime.m4 $(top_srcdir)/m4/userspec.m4 \
- $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utime.m4 \
- $(top_srcdir)/m4/utimecmp.m4 $(top_srcdir)/m4/utimens.m4 \
- $(top_srcdir)/m4/utimes-null.m4 $(top_srcdir)/m4/utimes.m4 \
- $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
- $(top_srcdir)/m4/wchar.m4 $(top_srcdir)/m4/wchar_t.m4 \
- $(top_srcdir)/m4/wctype.m4 $(top_srcdir)/m4/wcwidth.m4 \
- $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \
- $(top_srcdir)/m4/xfts.m4 $(top_srcdir)/m4/xgetcwd.m4 \
- $(top_srcdir)/m4/xnanosleep.m4 $(top_srcdir)/m4/xstrndup.m4 \
- $(top_srcdir)/m4/xstrtod.m4 $(top_srcdir)/m4/xstrtol.m4 \
- $(top_srcdir)/m4/yesno.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/lib/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ABSOLUTE_DIRENT_H = @ABSOLUTE_DIRENT_H@
-ABSOLUTE_FCNTL_H = @ABSOLUTE_FCNTL_H@
-ABSOLUTE_INTTYPES_H = @ABSOLUTE_INTTYPES_H@
-ABSOLUTE_NETINET_IN_H = @ABSOLUTE_NETINET_IN_H@
-ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@
-ABSOLUTE_STDIO_H = @ABSOLUTE_STDIO_H@
-ABSOLUTE_STDLIB_H = @ABSOLUTE_STDLIB_H@
-ABSOLUTE_STRING_H = @ABSOLUTE_STRING_H@
-ABSOLUTE_SYS_SOCKET_H = @ABSOLUTE_SYS_SOCKET_H@
-ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@
-ABSOLUTE_SYS_TIME_H = @ABSOLUTE_SYS_TIME_H@
-ABSOLUTE_TIME_H = @ABSOLUTE_TIME_H@
-ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@
-ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@
-ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-ALLOCA_H = @ALLOCA_H@
-AMTAR = @AMTAR@
-ARPA_INET_H = @ARPA_INET_H@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
-BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
-BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
-BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
-BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFAULT_POSIX2_VERSION = @DEFAULT_POSIX2_VERSION@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DF_PROG = @DF_PROG@
-DIRENT_H = @DIRENT_H@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EOVERFLOW = @EOVERFLOW@
-EXEEXT = @EXEEXT@
-FCNTL_H = @FCNTL_H@
-FNMATCH_H = @FNMATCH_H@
-GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
-GETOPT_H = @GETOPT_H@
-GLIBC21 = @GLIBC21@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GNULIB_CHOWN = @GNULIB_CHOWN@
-GNULIB_DUP2 = @GNULIB_DUP2@
-GNULIB_FCHDIR = @GNULIB_FCHDIR@
-GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
-GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
-GNULIB_GETCWD = @GNULIB_GETCWD@
-GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
-GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
-GNULIB_IMAXABS = @GNULIB_IMAXABS@
-GNULIB_IMAXDIV = @GNULIB_IMAXDIV@
-GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
-GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
-GNULIB_MBSCHR = @GNULIB_MBSCHR@
-GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
-GNULIB_MBSLEN = @GNULIB_MBSLEN@
-GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
-GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
-GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
-GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
-GNULIB_MBSSEP = @GNULIB_MBSSEP@
-GNULIB_MBSSPN = @GNULIB_MBSSPN@
-GNULIB_MBSSTR = @GNULIB_MBSSTR@
-GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
-GNULIB_MEMMEM = @GNULIB_MEMMEM@
-GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
-GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
-GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
-GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
-GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
-GNULIB_READLINK = @GNULIB_READLINK@
-GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
-GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
-GNULIB_STPCPY = @GNULIB_STPCPY@
-GNULIB_STPNCPY = @GNULIB_STPNCPY@
-GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
-GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
-GNULIB_STRDUP = @GNULIB_STRDUP@
-GNULIB_STRNDUP = @GNULIB_STRNDUP@
-GNULIB_STRNLEN = @GNULIB_STRNLEN@
-GNULIB_STRPBRK = @GNULIB_STRPBRK@
-GNULIB_STRSEP = @GNULIB_STRSEP@
-GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@
-GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
-GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@
-GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
-GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
-GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
-GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
-GNU_PACKAGE = @GNU_PACKAGE@
-GREP = @GREP@
-HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
-HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@
-HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@
-HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
-HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
-HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
-HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
-HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
-HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
-HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@
-HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
-HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@
-HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
-HAVE_DUP2 = @HAVE_DUP2@
-HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
-HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
-HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
-HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
-HAVE_MEMPCPY = @HAVE_MEMPCPY@
-HAVE_MKDTEMP = @HAVE_MKDTEMP@
-HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
-HAVE_READLINK = @HAVE_READLINK@
-HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
-HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
-HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
-HAVE_STDINT_H = @HAVE_STDINT_H@
-HAVE_STPCPY = @HAVE_STPCPY@
-HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
-HAVE_STRCASESTR = @HAVE_STRCASESTR@
-HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
-HAVE_STRNDUP = @HAVE_STRNDUP@
-HAVE_STRPBRK = @HAVE_STRPBRK@
-HAVE_STRSEP = @HAVE_STRSEP@
-HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
-HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
-HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
-HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
-HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
-HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
-HAVE_UNISTD_H = @HAVE_UNISTD_H@
-HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
-HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
-HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
-HAVE_WINT_T = @HAVE_WINT_T@
-HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
-HAVE__BOOL = @HAVE__BOOL@
-HELP2MAN = @HELP2MAN@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-INTTYPES_H = @INTTYPES_H@
-KMEM_GROUP = @KMEM_GROUP@
-LDFLAGS = @LDFLAGS@
-LIBCOREUTILS_LIBDEPS = @LIBCOREUTILS_LIBDEPS@
-LIBCOREUTILS_LTLIBDEPS = @LIBCOREUTILS_LTLIBDEPS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIB_ACL = @LIB_ACL@
-LIB_ACL_TRIVIAL = @LIB_ACL_TRIVIAL@
-LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
-LIB_CRYPT = @LIB_CRYPT@
-LIB_EACCESS = @LIB_EACCESS@
-LIB_FDATASYNC = @LIB_FDATASYNC@
-LIB_GETHRXTIME = @LIB_GETHRXTIME@
-LIB_NANOSLEEP = @LIB_NANOSLEEP@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MAN = @MAN@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-NEED_SETGID = @NEED_SETGID@
-NETINET_IN_H = @NETINET_IN_H@
-OBJEXT = @OBJEXT@
-OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PERL = @PERL@
-POSUB = @POSUB@
-POW_LIB = @POW_LIB@
-PRIPTR_PREFIX = @PRIPTR_PREFIX@
-PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
-PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
-RANLIB = @RANLIB@
-REPLACE_CHOWN = @REPLACE_CHOWN@
-REPLACE_FCHDIR = @REPLACE_FCHDIR@
-REPLACE_FPRINTF = @REPLACE_FPRINTF@
-REPLACE_GETCWD = @REPLACE_GETCWD@
-REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
-REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
-REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
-REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
-REPLACE_PRINTF = @REPLACE_PRINTF@
-REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
-REPLACE_SPRINTF = @REPLACE_SPRINTF@
-REPLACE_STRPTIME = @REPLACE_STRPTIME@
-REPLACE_TIMEGM = @REPLACE_TIMEGM@
-REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
-REPLACE_VPRINTF = @REPLACE_VPRINTF@
-REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
-REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
-SEQ_LIBM = @SEQ_LIBM@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
-SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
-STDBOOL_H = @STDBOOL_H@
-STDINT_H = @STDINT_H@
-STRIP = @STRIP@
-SYS_SOCKET_H = @SYS_SOCKET_H@
-SYS_STAT_H = @SYS_STAT_H@
-SYS_TIME_H = @SYS_TIME_H@
-SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
-TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
-U = @U@
-USE_NLS = @USE_NLS@
-VERSION = @VERSION@
-WCHAR_H = @WCHAR_H@
-WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
-WCTYPE_H = @WCTYPE_H@
-WINT_T_SUFFIX = @WINT_T_SUFFIX@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-gl_LIBOBJS = @gl_LIBOBJS@
-gl_LTLIBOBJS = @gl_LTLIBOBJS@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-TESTS = \
- one-file-system \
- inacc-dest \
- long-from-unreadable \
- long-sloop \
- 2g \
- 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)
-TESTS_ENVIRONMENT = \
- PERL="$(PERL)" \
- CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
- PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH"
-
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/du/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu tests/du/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-check-TESTS: $(TESTS)
- @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
- srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- if test -n "$$list"; then \
- for tst in $$list; do \
- if test -f ./$$tst; then dir=./; \
- elif test -f $$tst; then dir=; \
- else dir="$(srcdir)/"; fi; \
- if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *$$ws$$tst$$ws*) \
- xpass=`expr $$xpass + 1`; \
- failed=`expr $$failed + 1`; \
- echo "XPASS: $$tst"; \
- ;; \
- *) \
- echo "PASS: $$tst"; \
- ;; \
- esac; \
- elif test $$? -ne 77; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *$$ws$$tst$$ws*) \
- xfail=`expr $$xfail + 1`; \
- echo "XFAIL: $$tst"; \
- ;; \
- *) \
- failed=`expr $$failed + 1`; \
- echo "FAIL: $$tst"; \
- ;; \
- esac; \
- else \
- skip=`expr $$skip + 1`; \
- echo "SKIP: $$tst"; \
- fi; \
- done; \
- if test "$$failed" -eq 0; then \
- if test "$$xfail" -eq 0; then \
- banner="All $$all tests passed"; \
- else \
- banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
- fi; \
- else \
- if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all tests failed"; \
- else \
- banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
- fi; \
- fi; \
- dashes="$$banner"; \
- skipped=""; \
- if test "$$skip" -ne 0; then \
- skipped="($$skip tests were not run)"; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$skipped"; \
- fi; \
- report=""; \
- if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
- report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$report"; \
- fi; \
- dashes=`echo "$$dashes" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes"; \
- test "$$failed" -eq 0; \
- else :; fi
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: check-am
-all-am: Makefile
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-TESTS check-am clean clean-generic \
- distclean distclean-generic distdir dvi dvi-am html html-am \
- info info-am install install-am install-data install-data-am \
- install-dvi install-dvi-am install-exec install-exec-am \
- install-html install-html-am install-info install-info-am \
- install-man install-pdf install-pdf-am install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
- uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/tests/du/basic b/tests/du/basic.sh
index 665a416..0218e97 100755
--- a/tests/du/basic
+++ b/tests/du/basic.sh
@@ -1,11 +1,11 @@
#!/bin/sh
# Compare actual numbers from du, assuming block size matches mine.
-# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
+# Copyright (C) 2003-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# 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 2 of the License, or
+# 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,
@@ -14,44 +14,22 @@
# 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-# DU_BLOCK_SIZE could cause problems
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-
-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
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir -p a/b d d/sub || framework_failure=1
+mkdir -p a/b d d/sub || framework_failure_
# Ensure that these files contain more than 64 bytes, so that we don't
# immediately disqualify file systems (e.g., NetApp) on which smaller
# files take up zero disk blocks.
-printf '%*s' 257 make-sure-the-file-is-non-empty > a/b/F || framework_failure=1
+printf '%*s' 257 make-sure-the-file-is-non-empty > a/b/F || framework_failure_
printf %4096s x > d/1
cp d/1 d/sub/2
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-B=`stat --format=%B a/b/F`
+B=$(stat --format=%B a/b/F)
du --block-size=$B -a a > out || fail=1
echo === >> out
@@ -59,11 +37,11 @@ du --block-size=$B -a -S a >> out || fail=1
echo === >> out
du --block-size=$B -s a >> out || fail=1
-f=`stat --format=%b a/b/F`
-b=`stat --format=%b a/b`
-a=`stat --format=%b a`
-bf=`expr $b + $f`
-tot=`expr $bf + $a`
+f=$(stat --format=%b a/b/F)
+b=$(stat --format=%b a/b)
+a=$(stat --format=%b a)
+bf=$(expr $b + $f)
+tot=$(expr $bf + $a)
cat <<EOF | sed 's/ *#.*//' > exp
$f a/b/F
@@ -77,24 +55,23 @@ $a a # size of dir entry, a
$tot a
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff -u out exp 2> /dev/null
+compare exp out || fail=1
# Perform this test only if "." is on a local file system.
# Otherwise, it would fail e.g., on an NFS-mounted Solaris ZFS file system.
-if df --local . >/dev/null 2>&1; then
+if is_local_dir_ .; then
rm -f out exp
du --block-size=$B -a d | sort -r -k2,2 > out || fail=1
echo === >> out
du --block-size=$B -S d | sort -r -k2,2 >> out || fail=1
- t2=`stat --format=%b d/sub/2`
- ts=`stat --format=%b d/sub`
- t1=`stat --format=%b d/1`
- td=`stat --format=%b d`
- tot=`expr $t1 + $t2 + $ts + $td`
- d1=`expr $td + $t1`
- s2=`expr $ts + $t2`
+ t2=$(stat --format=%b d/sub/2)
+ ts=$(stat --format=%b d/sub)
+ t1=$(stat --format=%b d/1)
+ td=$(stat --format=%b d)
+ tot=$(expr $t1 + $t2 + $ts + $td)
+ d1=$(expr $td + $t1)
+ s2=$(expr $ts + $t2)
cat <<EOF | sed 's/ *#.*//' > exp
$t2 d/sub/2
@@ -106,8 +83,7 @@ $s2 d/sub
$d1 d # d + d/1; don't count the dir. entry for d/sub
EOF
- cmp out exp || fail=1
- test $fail = 1 && diff out exp 2> /dev/null
+ compare exp out || fail=1
fi
-(exit $fail); exit $fail
+Exit $fail
diff --git a/tests/du/bigtime.sh b/tests/du/bigtime.sh
new file mode 100755
index 0000000..7640380
--- /dev/null
+++ b/tests/du/bigtime.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Exercise du on a file with a big time stamp.
+
+# Copyright (C) 2010-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+export LC_ALL=C
+export TZ=UTC0
+
+# 2**63 - 1
+bignum=9223372036854775807
+
+touch -d @$bignum future 2>/dev/null &&
+future_time=$(ls -l future) &&
+case "$future_time" in
+*" $bignum "*)
+ : ;;
+*' Dec 4 300627798676 '*)
+ skip_ "file system and localtime both handle big timestamps" ;;
+*)
+ skip_ "file system or localtime mishandles big time stamps:" \
+ "$future_time" ;;
+esac || skip_ "file system cannot represent big time stamps"
+
+printf "0\t$bignum\tfuture\n" > exp || framework_failure_
+printf "du: time '$bignum' is out of range\n" > err_ok || framework_failure_
+
+du --time future >out 2>err || fail=1
+
+# On some systems an empty file occupies 4 blocks.
+# Map the number of blocks to 0.
+sed 's/^[0-9][0-9]*/0/' out > k && mv k out
+
+compare exp out || fail=1
+compare err err_ok || fail=1
+
+Exit $fail
diff --git a/tests/du/bind-mount-dir-cycle-v2.sh b/tests/du/bind-mount-dir-cycle-v2.sh
new file mode 100755
index 0000000..e5d1d50
--- /dev/null
+++ b/tests/du/bind-mount-dir-cycle-v2.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Check that du can handle sub-bind-mounts cycles as well.
+
+# Copyright (C) 2014-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+require_root_
+
+cleanup_() { umount a/b/c; }
+
+mkdir -p a/b/c || framework_failure_
+mount --bind a a/b/c \
+ || skip_ 'This test requires mount with a working --bind option.'
+
+echo a/b/c > exp || framework_failure_
+echo a/b >> exp || framework_failure_
+
+du a/b > out 2> err || fail=1
+sed 's/^[0-9][0-9]* //' out > k && mv k out
+
+compare /dev/null err || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/bind-mount-dir-cycle.sh b/tests/du/bind-mount-dir-cycle.sh
new file mode 100755
index 0000000..42c9d1e
--- /dev/null
+++ b/tests/du/bind-mount-dir-cycle.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Exercise du's new ability to handle bind-mount-induced dir cycles.
+
+# Copyright (C) 2012-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+require_root_
+
+cleanup_() { umount a/b; }
+
+mkdir -p a/b || framework_failure_
+mount --bind a a/b \
+ || skip_ "This test requires mount with a working --bind option."
+
+echo a > exp || framework_failure_
+
+du a > out 2> err || fail=1
+sed 's/^[0-9][0-9]* //' out > k && mv k out
+
+compare /dev/null err || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/deref b/tests/du/deref
deleted file mode 100755
index 407797a..0000000
--- a/tests/du/deref
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/sh
-# 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 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-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
-mkdir -p a/sub || framework_failure=1
-ln -s a/sub slink || framework_failure=1
-touch b || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-# This used to fail with the following diagnostic:
-# du: `b': No such file or directory
-du -sD slink b > /dev/null 2>&1 || fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/du/deref-args b/tests/du/deref-args.sh
index 79225f5..b24bb41 100755
--- a/tests/du/deref-args
+++ b/tests/du/deref-args.sh
@@ -2,11 +2,11 @@
# Ensure that --dereference-args (-D) gives reasonable names.
# This test would fail for coreutils-5.0.91.
-# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# 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 2 of the License, or
+# 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,
@@ -15,36 +15,16 @@
# 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
-. $srcdir/../envvar-check
+mkdir -p dir/a || framework_failure_
+ln -s dir slink || framework_failure_
+printf %65536s x > 64k || framework_failure_
+ln -s 64k slink-to-64k || framework_failure_
-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
-mkdir -p dir/a
-ln -s dir slink
-printf %65536s x > 64k
-ln -s 64k slink-to-64k
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
du -D slink | sed 's/^[0-9][0-9]* //' > out
# Ensure that the trailing slash is preserved and handled properly.
@@ -63,7 +43,6 @@ slink/
64 slink-to-64k
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
-(exit $fail); exit $fail
+Exit $fail
diff --git a/tests/du/deref.sh b/tests/du/deref.sh
new file mode 100755
index 0000000..aca3cb5
--- /dev/null
+++ b/tests/du/deref.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# 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.
+# Also, up to coreutils-8.5, du -L sometimes incorrectly
+# counted the space of the followed symlinks.
+
+# Copyright (C) 2002-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+mkdir -p a/sub || framework_failure_
+ln -s a/sub slink || framework_failure_
+touch b || framework_failure_
+ln -s .. a/sub/dotdot || framework_failure_
+ln -s nowhere dangle || framework_failure_
+
+
+# This used to fail with the following diagnostic:
+# du: 'b': No such file or directory
+du -sD slink b > /dev/null 2>&1 || fail=1
+
+# This used to fail to report the dangling symlink.
+returns_ 1 du -L dangle > /dev/null 2>&1 || fail=1
+
+# du -L used to mess up, either by counting the symlink's disk space itself
+# (-L should follow symlinks, not count their space)
+# or (briefly in July 2010) by omitting the entry for "a".
+du_L_output=$(du -L a) || fail=1
+du_lL_output=$(du -lL a) || fail=1
+du_x_output=$(du --exclude=dotdot a) || fail=1
+test "X$du_L_output" = "X$du_x_output" || fail=1
+test "X$du_lL_output" = "X$du_x_output" || fail=1
+
+Exit $fail
diff --git a/tests/du/exclude b/tests/du/exclude.sh
index e197fcd..431318d 100755
--- a/tests/du/exclude
+++ b/tests/du/exclude.sh
@@ -1,11 +1,11 @@
#!/bin/sh
# make sure du's --exclude option works
-# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# 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 2 of the License, or
+# 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,
@@ -14,33 +14,13 @@
# 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
-. $srcdir/../envvar-check
+mkdir -p a/b/c a/x/y a/u/v || framework_failure_
-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
-mkdir -p a/b/c a/x/y a/u/v
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
du --exclude=x a | sed 's/^[0-9][0-9]* //' | sort > out || fail=1
printf '===\n' >> out
@@ -73,7 +53,6 @@ a/x
a/x/y
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
-(exit $fail); exit $fail
+Exit $fail
diff --git a/tests/du/fd-leak b/tests/du/fd-leak.sh
index 465fcae..c32b965 100755
--- a/tests/du/fd-leak
+++ b/tests/du/fd-leak.sh
@@ -1,11 +1,11 @@
#!/bin/sh
# check for file descriptor leak
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# 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 2 of the License, or
+# 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,
@@ -14,27 +14,15 @@
# 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
# Call this an expensive test. It's not that expensive, but command line
# limitations might induce failure on some losing systems.
-. $srcdir/../expensive
+expensive_
-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
# Create 1296 (36^2) files.
# Their names and separating spaces take up 3887 bytes.
x='a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9'
@@ -46,16 +34,10 @@ for i in $x; do
done
# This may fail due to command line limitations.
-touch $f || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+touch $f || framework_failure_
-fail=0
# With coreutils-5.0, this would fail due to a file descriptor leak.
du $f > out || fail=1
-(exit $fail); exit $fail
+Exit $fail
diff --git a/tests/du/files0-from-dir.sh b/tests/du/files0-from-dir.sh
new file mode 100755
index 0000000..7b6409b
--- /dev/null
+++ b/tests/du/files0-from-dir.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+# ensure that du and wc handle --files0-from=DIR
+
+# Copyright (C) 2011-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du wc
+
+mkdir dir
+
+# Skip this test if reading from a directory succeeds.
+# In that case, using --files0-from=dir would yield garbage,
+# interpreting the directory entry as a sequence of
+# NUL-separated file names.
+cat dir > /dev/null && skip_ "cat dir/ succeeds"
+
+for prog in du wc; do
+ $prog --files0-from=dir > /dev/null 2>err && fail=1
+ printf "$prog: dir:\n" > exp || fail=1
+ # The diagnostic string is usually "Is a directory" (ENOTDIR),
+ # but accept a different string or errno value.
+ sed "s/dir:.*/dir:/" err > k; mv k err
+ compare exp err || fail=1
+done
+
+Exit $fail
diff --git a/tests/du/files0-from b/tests/du/files0-from.pl
index fdcb595..b7ca3fd 100755
--- a/tests/du/files0-from
+++ b/tests/du/files0-from.pl
@@ -1,12 +1,12 @@
-#!/bin/sh
-# -*- perl -*-
+#!/usr/bin/perl
# Exercise du's --files0-from option.
+# FIXME: keep this file in sync with tests/misc/wc-files0-from.
-# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2004-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# 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 2 of the License, or
+# 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,
@@ -15,61 +15,50 @@
# 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
-: ${srcdir=.}
-
-. $srcdir/../envvar-check
-
-$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
-}
-
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
-#/
-require 5.003;
use strict;
(my $program_name = $0) =~ s|.*/||;
-$ENV{PROG} = 'du';
+my $prog = 'du';
-# Turn off localization of executable's ouput.
+# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
my @Tests =
(
# invalid extra command line argument
['f-extra-arg', '--files0-from=- no-such', {IN=>"a"}, {EXIT=>1},
- {ERR => "du: extra operand `no-such'\n"
- . "File operands cannot be combined with --files0-from.\n"
- . "Try `du --help' for more information.\n"}
+ {ERR => "$prog: extra operand 'no-such'\n"
+ . "file operands cannot be combined with --files0-from\n"
+ . "Try '$prog --help' for more information.\n"}
],
# missing input file
['missing', '--files0-from=missing', {EXIT=>1},
- {ERR => "du: cannot open `missing' for reading: "
+ {ERR => "$prog: cannot open 'missing' for reading: "
. "No such file or directory\n"}],
- # empty input
- ['empty', '--files0-from=-'],
+ # input file name of '-'
+ ['minus-in-stdin', '--files0-from=-', '<', {IN=>{f=>'-'}}, {EXIT=>1},
+ {ERR => "$prog: when reading file names from stdin, no file name of"
+ . " '-' allowed\n"}],
+
+ # empty input, regular file
+ ['empty', '--files0-from=@AUX@', {AUX=>''}],
# empty input, from non-regular file
['empty-nonreg', '--files0-from=/dev/null'],
# one NUL
['nul-1', '--files0-from=-', '<', {IN=>"\0"}, {EXIT=>1},
- {ERR => "du: -:1: invalid zero-length file name\n"}],
+ {ERR => "$prog: -:1: invalid zero-length file name\n"}],
# two NULs
['nul-2', '--files0-from=-', '<', {IN=>"\0\0"}, {EXIT=>1},
- {ERR => "du: -:1: invalid zero-length file name\n"
- . "du: -:2: invalid zero-length file name\n"}],
+ {ERR => "$prog: -:1: invalid zero-length file name\n"
+ . "$prog: -:2: invalid zero-length file name\n"}],
# one file name, no NUL
['1', '--files0-from=-', '<',
@@ -81,27 +70,25 @@ my @Tests =
{IN=>{f=>"g\0"}}, {AUX=>{g=>''}},
{OUT=>"0\tg\n"}, {OUT_SUBST=>'s/^\d+/0/'} ],
- # two file names, no final NUL
+ # two identical file names, no final NUL
['2', '--files0-from=-', '<',
{IN=>{f=>"g\0g"}}, {AUX=>{g=>''}},
- {OUT=>"0\tg\n0\tg\n"}, {OUT_SUBST=>'s/^\d+/0/'} ],
+ {OUT=>"0\tg\n"}, {OUT_SUBST=>'s/^\d+/0/'} ],
- # two file names, with final NUL
+ # two identical file names, with final NUL
['2a', '--files0-from=-', '<',
{IN=>{f=>"g\0g\0"}}, {AUX=>{g=>''}},
- {OUT=>"0\tg\n0\tg\n"}, {OUT_SUBST=>'s/^\d+/0/'} ],
+ {OUT=>"0\tg\n"}, {OUT_SUBST=>'s/^\d+/0/'} ],
- # Ensure that du processes FILEs following a zero-length name.
+ # Ensure that $prog processes FILEs following a zero-length name.
['zero-len', '--files0-from=-', '<',
{IN=>{f=>"\0g\0"}}, {AUX=>{g=>''}},
{OUT=>"0\tg\n"}, {OUT_SUBST=>'s/^\d+/0/'},
- {ERR => "du: -:1: invalid zero-length file name\n"}, {EXIT=>1} ],
+ {ERR => "$prog: -:1: invalid zero-length file name\n"}, {EXIT=>1} ],
);
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
-EOF
diff --git a/tests/du/hard-link b/tests/du/hard-link
deleted file mode 100755
index 1e7a5f9..0000000
--- a/tests/du/hard-link
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh
-# Ensure that hard-linked files are counted (and listed) only once.
-# Likewise for excluded directories.
-# Ensure that hard links _are_ listed twice when using --count-links.
-
-# Copyright (C) 2003, 2006 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-
-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
-
-mkdir -p dir/sub
-( cd dir && { echo non-empty > f1; ln f1 f2; echo non-empty > sub/F; } )
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-# Note that for this first test, we transform f1 or f2
-# (whichever name we find first) to f_. That is necessary because,
-# depending on the type of file system, du could encounter either of those
-# two hard-linked files first, thus listing that one and not the other.
-du -a --exclude=sub dir \
- | sed 's/^[0-9][0-9]* //' | sed 's/f[12]/f_/' > out || fail=1
-echo === >> out
-du -a --exclude=sub --count-links dir \
- | sed 's/^[0-9][0-9]* //' | sort -r >> out || fail=1
-cat <<\EOF > exp
-dir/f_
-dir
-===
-dir/f2
-dir/f1
-dir
-EOF
-
-cmp out exp || fail=1
-test $fail = 1 && diff -u out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/du/hard-link.sh b/tests/du/hard-link.sh
new file mode 100755
index 0000000..fcdc5a5
--- /dev/null
+++ b/tests/du/hard-link.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+# Ensure that hard-linked files are counted (and listed) only once.
+# Likewise for excluded directories.
+# Ensure that hard links _are_ listed twice when using --count-links.
+
+# Copyright (C) 2003-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+mkdir -p dir/sub
+( cd dir &&
+ { echo non-empty > f1
+ ln f1 f2
+ ln -s f1 f3
+ echo non-empty > sub/F; } )
+
+du -a -L --exclude=sub --count-links dir \
+ | sed 's/^[0-9][0-9]* //' | sort -r > out || fail=1
+
+# For these tests, transform f1 or f2 or f3 (whichever name is find
+# first) to f_. That is necessary because, depending on the type of
+# file system, du could encounter any of those linked files first,
+# thus listing that one and not the others.
+for args in '-L' 'dir' '-L dir'
+do
+ echo === >> out
+ du -a --exclude=sub $args dir \
+ | sed 's/^[0-9][0-9]* //' | sed 's/f[123]/f_/' >> out || fail=1
+done
+
+cat <<\EOF > exp
+dir/f3
+dir/f2
+dir/f1
+dir
+===
+dir/f_
+dir
+===
+dir/f_
+dir/f_
+dir
+===
+dir/f_
+dir
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/inacc-dest b/tests/du/inacc-dest
deleted file mode 100755
index 0ff6b96..0000000
--- a/tests/du/inacc-dest
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/sh
-# 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 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-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
-
-mkdir f && cd f && mkdir a b c d e && touch c/j && chmod a-x c \
- || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-du > ../t 2>&1 && fail=1
-
-# Accept either of the following outputs.
-# You get the first from a system with openat _emulation_ (via /proc),
-# the second from a system with native openat support.
-# FIXME: there may well be a third output, for systems with neither
-# /proc support, nor native openat support.
-
-sed 's/^[0-9][0-9]* //' ../t | sort -u > out
-cat <<\EOF > exp || fail=1
-.
-./a
-./b
-./d
-./e
-du: `./c': Permission denied
-EOF
-
-cat <<\EOF > exp2 || fail=1
-.
-./a
-./b
-./c
-./d
-./e
-du: cannot access `./c/j': Permission denied
-EOF
-
-cmp out exp > /dev/null 2>&1 || {
- cmp out exp2 || fail=1
- }
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/du/inacc-dest.sh b/tests/du/inacc-dest.sh
new file mode 100755
index 0000000..29c9f72
--- /dev/null
+++ b/tests/du/inacc-dest.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+# 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-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+skip_if_root_
+
+mkdir f && cd f && mkdir a b c d e && touch c/j && chmod a-x c \
+ || framework_failure_
+
+du > ../t 2>&1 && fail=1
+
+# Accept either of the following outputs.
+# You get the first from a system with openat _emulation_ (via /proc),
+# the second from a system with native openat support.
+# FIXME: there may well be a third output, for systems with neither
+# /proc support, nor native openat support.
+
+sed 's/^[0-9][0-9]* //' ../t | sort -u > out
+cat <<\EOF > exp || fail=1
+.
+./a
+./b
+./c
+./d
+./e
+du: cannot read directory './c': Permission denied
+EOF
+
+# Map a diagnostic like this
+# du: cannot access './c/j': Permission denied
+# to this:
+# du: cannot access './c': Permission denied
+# And accept "cannot read directory" in place of "cannot access"
+sed "s,/c/j': ,/c': ," out > t && mv t out
+sed 's,cannot access,cannot read directory,' out > t && mv t out
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/inacc-dir.sh b/tests/du/inacc-dir.sh
new file mode 100755
index 0000000..ee71fe4
--- /dev/null
+++ b/tests/du/inacc-dir.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Ensure that du counts the size of an inaccessible directory.
+# Copyright (C) 2007-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+skip_if_root_
+
+mkdir -p a/sub || framework_failure_
+
+
+du -s a > exp || fail=1
+chmod 0 a/sub || fail=1
+# Expect failure, ignore diagnostics.
+du -s a > out 2> /dev/null && fail=1
+
+compare exp out || fail=1
+
+# Same as above, but don't use -s, so we print
+# an entry for the unreadable "sub", too.
+chmod 700 a/sub || fail=1
+du -k a > exp || fail=1
+chmod 0 a/sub || fail=1
+# Expect failure, ignore diagnostics.
+du -k a > out 2> /dev/null && fail=1
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/inaccessible-cwd b/tests/du/inaccessible-cwd
deleted file mode 100755
index 0f9f9b7..0000000
--- a/tests/du/inaccessible-cwd
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/sh
-# Ensure that even when run from an inaccessible directory, du can still
-# operate on accessible directories elsewhere.
-
-# Copyright (C) 2003, 2006 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# Before the switch to an fts-based implementation in coreutils 5.0.92,
-# this test would fail.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-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
-mkdir -p no-x a/b || framework_failure=1
-cd no-x || framework_failure=1
-chmod 0 . || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-du "$pwd/$tmp/a" > /dev/null || fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/du/inaccessible-cwd.sh b/tests/du/inaccessible-cwd.sh
new file mode 100755
index 0000000..c6ab6d8
--- /dev/null
+++ b/tests/du/inaccessible-cwd.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Ensure that even when run from an inaccessible directory, du can still
+# operate on accessible directories elsewhere.
+
+# Copyright (C) 2003-2016 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/>.
+
+# Before the switch to an fts-based implementation in coreutils 5.0.92,
+# this test would fail.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+# Skip this test if your system has neither the openat-style functions
+# nor /proc/self/fd support with which to emulate them.
+require_openat_support_
+
+skip_if_root_
+
+cwd=$(pwd)
+mkdir -p no-x a/b || framework_failure_
+cd no-x || framework_failure_
+chmod 0 . || framework_failure_
+
+
+du "$cwd/a" > /dev/null || fail=1
+
+Exit $fail
diff --git a/tests/du/inodes.sh b/tests/du/inodes.sh
new file mode 100755
index 0000000..ba26962
--- /dev/null
+++ b/tests/du/inodes.sh
@@ -0,0 +1,140 @@
+#!/bin/sh
+# exercise du's --inodes option
+
+# Copyright (C) 2010-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+# An empty directory uses only 1 inode.
+mkdir d || framework_failure_
+printf '1\td\n' > exp || framework_failure_
+
+du --inodes d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Add a regular file: 2 inodes used.
+touch d/f || framework_failure_
+printf '2\td\n' > exp || framework_failure_
+
+du --inodes d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Add a hardlink to the file: still only 2 inodes used.
+ln -v d/f d/h || framework_failure_
+du --inodes d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Now count also hardlinks (-l,--count-links): 3 inodes.
+printf '3\td\n' > exp || framework_failure_
+du --inodes -l d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Create a directory and summarize: 3 inodes.
+mkdir d/d || framework_failure_
+du --inodes -s d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Count inodes separated: 1-2.
+printf '1\td/d\n2\td\n' > exp || framework_failure_
+du --inodes -S d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Count inodes cumulative (default): 1-3.
+printf '1\td/d\n3\td\n' > exp || framework_failure_
+du --inodes d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Count all items: 1-1-3.
+# Sort output because the directory entry order is not defined.
+# Also replace the hardlink with the original file name because
+# the system may either return 'd/f' or 'd/h' first, and du(1)
+# will ignore the other one.
+printf '1\td/d\n1\td/f\n3\td\n' | sort > exp || framework_failure_
+du --inodes -a d > out.tmp 2>err || fail=1
+sed 's/h$/f/' out.tmp | sort >out || framework_failure_
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Count all items and hardlinks again: 1-1-1-4
+# Sort output because the directory entry order is not defined.
+printf '1\td/d\n1\td/h\n1\td/f\n4\td\n' | sort > exp || framework_failure_
+du --inodes -al d > out.tmp 2>err || fail=1
+sort <out.tmp >out || framework_failure_
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Run with total (-c) line: 1-3-3
+printf '1\td/d\n3\td\n3\ttotal\n' > exp || framework_failure_
+du --inodes -c d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Create another file in the subdirectory: 2-4
+touch d/d/f || framework_failure_
+printf '2\td/d\n4\td\n' > exp || framework_failure_
+du --inodes d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Ensure human output (-h, --si) works.
+rm -rf d || framework_failure_
+mkdir d || framework_failure_
+seq --format="d/file%g" 1023 | xargs touch || framework_failure_
+printf '1.0K\td\n' > exp || framework_failure_
+du --inodes -h d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+printf '1.1k\td\n' > exp || framework_failure_
+du --inodes --si d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Verify --inodes ignores -B.
+printf '1024\td\n' > exp || framework_failure_
+du --inodes -B10 d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Verify --inodes works with --threshold.
+printf '1024\td\n' > exp || framework_failure_
+du --inodes --threshold=1000 d > out 2>err || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+du --inodes --threshold=-1000 d > out 2>err || fail=1
+compare /dev/null out || fail=1
+compare /dev/null err || fail=1
+
+# Verify --inodes raises a warning for --apparent-size and -b.
+du --inodes -b d > out 2>err || fail=1
+grep ' ineffective ' err >/dev/null || { fail=1; cat out err; }
+
+du --inodes --apparent-size d > out 2>err || fail=1
+grep ' ineffective ' err >/dev/null || { fail=1; cat out err; }
+
+# Ensure that --inodes is mentioned in the usage.
+du --help > out || fail=1
+grep ' --inodes ' out >/dev/null || { fail=1; cat out; }
+Exit $fail
diff --git a/tests/du/long-from-unreadable b/tests/du/long-from-unreadable.sh
index f43a6db..2d9bfc4 100755
--- a/tests/du/long-from-unreadable
+++ b/tests/du/long-from-unreadable.sh
@@ -1,11 +1,11 @@
#!/bin/sh
# Show fts fails on old-fashioned systems.
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# 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 2 of the License, or
+# 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,
@@ -14,76 +14,60 @@
# 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Show that fts (hence du, chmod, chgrp, chown) fails when all of the
# following are true:
-# - `.' is not readable
+# - '.' is not readable
# - operating on a hierarchy containing a relative name longer than PATH_MAX
# - run on a system where gnulib's openat emulation must resort to using
-# save_cwd and restore_cwd (which fail if `.' is not readable).
+# save_cwd and restore_cwd (which fail if '.' is not readable).
# Thus, the following du invocation should succeed on newer Linux and
# Solaris systems, yet it must fail on systems lacking both openat and
# /proc support. However, before coreutils-6.0 this test would fail even
# on Linux+PROC_FS systems because its fts implementation would revert
# unnecessarily to using FTS_NOCHDIR mode in this corner case.
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
-. $srcdir/../envvar-check
+# ecryptfs for example uses some of the file name space
+# for encrypting filenames, so we must check dynamically.
+name_max=$(stat -f -c %l .)
+test "$name_max" -ge '200' || skip_ "NAME_MAX=$name_max is not sufficient"
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_ 'This test would fail, since your system lacks /proc support.'
fi
-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
-
-dir=`printf '%200s\n' ' '|tr ' ' x`
+dir=$(printf '%200s\n' ' '|tr ' ' x)
# Construct a hierarchy containing a relative file with a name
# longer than PATH_MAX.
-# for i in `seq 52`; do
-# mkdir $dir || framework_failure=1
-# cd $dir || framework_failure=1
+# for i in $(seq 52); do
+# mkdir $dir || framework_failure_
+# cd $dir || framework_failure_
# done
-# cd $tmp || framework_failure=1
+# cd $tmp || framework_failure_
# Sheesh. Bash 3.1.5 can't create this hierarchy. I get
-# cd: error retrieving current directory: getcwd: cannot access parent directories:
+# cd: error retrieving current directory: getcwd:
+# cannot access parent directories:
+# (all on one line).
+
+cwd=$(pwd)
# Use perl instead:
: ${PERL=perl}
$PERL \
-e 'my $d = '$dir'; foreach my $i (1..52)' \
-e ' { mkdir ($d, 0700) && chdir $d or die "$!" }' \
- || framework_failure=1
-
-mkdir inaccessible || framework_failure=1
-cd inaccessible || framework_failure=1
-chmod 0 . || framework_failure=1
+ || framework_failure_
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir inaccessible || framework_failure_
+cd inaccessible || framework_failure_
+chmod 0 . || framework_failure_
-fail=0
-du -s "$pwd/$tmp/$dir" > /dev/null || fail=1
+du -s "$cwd/$dir" > /dev/null || fail=1
-(exit $fail); exit $fail
+Exit $fail
diff --git a/tests/du/long-sloop b/tests/du/long-sloop
deleted file mode 100755
index f5f9423..0000000
--- a/tests/du/long-sloop
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/bin/sh
-# Use du to exercise a corner of fts's FTS_LOGICAL code.
-# Show that du fails with ELOOP (Too many levels of symbolic links)
-# when it encounters that condition.
-
-# Copyright (C) 2006 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-. $srcdir/../lang-default
-
-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
-
-# Create lots of directories, each containing a single symlink
-# pointing at the next directory in the list.
-
-# This number should be larger than the number of symlinks allowed in
-# file name resolution, but not too large as a number of entries
-# in a single directory.
-n=400
-
-dir_list=`seq $n`
-mkdir $dir_list || framework_failure=1
-file=1
-i_minus_1=0
-for i in $dir_list `expr $n + 1`; do
- case $i_minus_1 in
- 0) ;;
- *)
- ln -s ../$i $i_minus_1/s || framework_failure=1
- file=$file/s;;
- esac
- i_minus_1=$i
-done
-echo foo > $i
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-# If a system can handle this many symlinks in a file name,
-# just skip this test.
-
-# The following also serves to record in `err' the string
-# corresponding to strerror (ELOOP). This is necessary because while
-# Linux/libc gives `Too many levels of symbolic links', Solaris
-# 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
- }
-too_many=`sed 's/.*: //' err`
-
-fail=0
-
-# With coreutils-5.93 there was no failure.
-# With coreutils-5.94 we get the desired diagnostic:
-# du: cannot access `1/s/s/s/.../s': Too many levels of symbolic links
-du -L 1 > /dev/null 2> out1 && fail=1
-sed "s, .1/s/s/s/[/s]*',," out1 > out || fail=1
-
-echo "du: cannot access: $too_many" > exp || fail=1
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/du/long-sloop.sh b/tests/du/long-sloop.sh
new file mode 100755
index 0000000..ae2b5c9
--- /dev/null
+++ b/tests/du/long-sloop.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+# Use du to exercise a corner of fts's FTS_LOGICAL code.
+# Show that du fails with ELOOP (Too many levels of symbolic links)
+# when it encounters that condition.
+
+# Copyright (C) 2006-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+# Create lots of directories, each containing a single symlink
+# pointing at the next directory in the list.
+
+# This number should be larger than the number of symlinks allowed in
+# file name resolution, but not too large as a number of entries
+# in a single directory.
+n=400
+
+dir_list=$(seq $n)
+mkdir $dir_list || framework_failure_
+file=1
+i_minus_1=0
+for i in $dir_list $(expr $n + 1); do
+ case $i_minus_1 in
+ 0) ;;
+ *)
+ ln -s ../$i $i_minus_1/s || framework_failure_
+ file=$file/s;;
+ esac
+ i_minus_1=$i
+done
+echo foo > $i
+
+# If a system can handle this many symlinks in a file name,
+# just skip this test.
+
+# The following also serves to record in 'err' the string
+# corresponding to strerror (ELOOP). This is necessary because while
+# Linux/libc gives 'Too many levels of symbolic links', Solaris
+# renders it as "Number of symbolic links encountered during path
+# name traversal exceeds MAXSYMLINKS".
+
+cat $file > /dev/null 2> err &&
+ skip_ 'Your system appears to be able to handle more than $n symlinks
+in file name resolution'
+too_many=$(sed 's/.*: //' err)
+
+
+# With coreutils-5.93 there was no failure.
+# With coreutils-5.94 we get the desired diagnostic:
+# du: cannot access '1/s/s/s/.../s': Too many levels of symbolic links
+du -L 1 > /dev/null 2> out1 && fail=1
+sed "s, .1/s/s/s/[/s]*',," out1 > out || fail=1
+
+echo "du: cannot access: $too_many" > exp || fail=1
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/max-depth.sh b/tests/du/max-depth.sh
new file mode 100755
index 0000000..b2e45a1
--- /dev/null
+++ b/tests/du/max-depth.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+# exercise du's --max-depth=N option
+
+# Copyright (C) 2010-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+mkdir -p a/b/c/d/e || framework_failure_
+printf 'a/b/c\na/b\na\n' > exp || framework_failure_
+
+du --max-depth=2 a > out 2>err || fail=1
+
+# Remove the sizes. They vary between file systems.
+cut -f2- out > k && mv k out
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+# Repeat, but use -d 1.
+printf 'a/b\na\n' > exp || framework_failure_
+du -d 1 a > out 2>err || fail=1
+cut -f2- out > k && mv k out
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+Exit $fail
diff --git a/tests/du/move-dir-while-traversing.sh b/tests/du/move-dir-while-traversing.sh
new file mode 100755
index 0000000..e80e94c
--- /dev/null
+++ b/tests/du/move-dir-while-traversing.sh
@@ -0,0 +1,100 @@
+#!/bin/sh
+# Trigger a failed assertion in coreutils-8.9 and earlier.
+
+# Copyright (C) 2011-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+require_trap_signame_
+
+# We use a python-inotify script, so...
+python -m pyinotify -h > /dev/null \
+ || skip_ 'python inotify package not installed'
+
+# Move a directory "up" while du is processing its sub-directories.
+# While du is processing a hierarchy .../B/C/D/... this script
+# detects when du opens D/, and then moves C/ "up" one level
+# so that it is a sibling of B/.
+# Given the inherent race condition, we have to add enough "weight"
+# under D/ so that in most cases, the monitor performs the single
+# rename syscall before du finishes processing the subtree under D/.
+
+cat <<'EOF' > inotify-watch-for-dir-access.py
+#!/usr/bin/env python
+import pyinotify as pn
+import os,sys
+
+dir = sys.argv[1]
+dest_parent = os.path.dirname(os.path.dirname(dir))
+dest = os.path.join(dest_parent, os.path.basename(dir))
+
+class ProcessDir(pn.ProcessEvent):
+
+ def process_IN_OPEN(self, event):
+ os.rename(dir, dest)
+ sys.exit(0)
+
+ def process_default(self, event):
+ pass
+
+wm = pn.WatchManager()
+notifier = pn.Notifier(wm)
+wm.watch_transient_file(dir, pn.IN_OPEN, ProcessDir)
+sys.stdout.write('started\n')
+sys.stdout.flush()
+notifier.loop()
+EOF
+chmod a+x inotify-watch-for-dir-access.py
+
+t=T/U
+mkdir d2 || framework_failure_
+long=d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z
+# One iteration of this loop creates a tree with which
+# du sometimes completes its traversal before the above rename.
+# Five iterations was not enough in 2 of 7 "make -j20 check" runs on a
+# 6/12-core system. However, using "10", I saw no failure in 20 trials.
+# Using 10 iterations was not enough, either.
+# Using 50, I saw no failure in 200 trials.
+for i in $(seq 50); do
+ mkdir -p $t/3/a/b/c/$i/$long || framework_failure_
+done
+
+# Terminate any background cp process
+cleanup_() { kill $pid 2>/dev/null && wait $pid; }
+
+# Prohibit suspension, which could otherwise cause a timeout-induced FP failure.
+trap '' TSTP
+
+timeout 6 ./inotify-watch-for-dir-access.py $t/3/a/b > start-msg & pid=$!
+
+# Wait for the watcher to start...
+nonempty() { sleep $1; test -s start-msg; }
+retry_delay_ nonempty .1 5 || fail=1
+
+# The above watches for an IN_OPEN event on $t/3/a/b,
+# and when it triggers, moves the parent, $t/3/a, up one level
+# so it's directly under $t.
+
+du -a $t d2 2> err
+# Before coreutils-8.10, du would abort.
+test $? = 1 || fail=1
+
+# check for the new diagnostic
+printf "du: fts_read failed: $t/3/a/b: No such file or directory\n" > exp \
+ || fail=1
+compare exp err || fail=1
+
+Exit $fail
diff --git a/tests/du/no-deref b/tests/du/no-deref
deleted file mode 100755
index 167f9c2..0000000
--- a/tests/du/no-deref
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-# Ensure that by default, du doesn't dereference command-line symlinks.
-
-# Copyright (C) 2003, 2004, 2006 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-. $srcdir/../envvar-check
-
-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
-mkdir -p dir/a/b
-ln -s dir slink
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-du slink | sed 's/^[0-9][0-9]* //' > out
-cat <<\EOF > exp
-slink
-EOF
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/du/no-deref.sh b/tests/du/no-deref.sh
new file mode 100755
index 0000000..3dd4a9e
--- /dev/null
+++ b/tests/du/no-deref.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# Ensure that by default, du doesn't dereference command-line symlinks.
+
+# Copyright (C) 2003-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+mkdir -p dir/a/b || framework_failure_
+ln -s dir slink || framework_failure_
+
+
+du slink | sed 's/^[0-9][0-9]* //' > out
+cat <<\EOF > exp
+slink
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/no-x b/tests/du/no-x
deleted file mode 100755
index fa93e97..0000000
--- a/tests/du/no-x
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/sh
-# Make sure du gives the right diagnostic for a readable,
-# but inaccessible directory.
-
-# Copyright (C) 2003, 2006 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-. $srcdir/../lang-default
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-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
-mkdir -p d/no-x/y || framework_failure=1
-chmod u=rw d/no-x || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-# This must exit nonzero.
-du d >/dev/null 2>out && fail=1
-
-cat <<\EOF > exp
-du: `d/no-x': Permission denied
-EOF
-
-# With native fdopendir, du uses a different code path.
-cat <<\EOF > exp-native-fdopendir
-du: cannot access `d/no-x/y': Permission denied
-EOF
-
-if cmp out exp >/dev/null 2>&1; then
- :
-else
- if cmp out exp-native-fdopendir; then
- :
- else
- fail=1
- fi
-fi
-
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/du/no-x.sh b/tests/du/no-x.sh
new file mode 100755
index 0000000..64c6fa5
--- /dev/null
+++ b/tests/du/no-x.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Make sure du gives the right diagnostic for a readable,
+# but inaccessible directory.
+
+# Copyright (C) 2003-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+skip_if_root_
+
+mkdir -p d/no-x/y || framework_failure_
+chmod u=rw d/no-x || framework_failure_
+
+
+# This must exit nonzero.
+du d >/dev/null 2>out && fail=1
+
+prog=du
+# NOTE: this code is the same for all tests/*/no-x tests.
+# Depending on whether fts is using native fdopendir, we see one
+# of the following diagnostics (note also the /y suffix in one case):
+# prog: 'd/no-x': Permission denied
+# prog: cannot access 'd/no-x/y': Permission denied
+# prog: cannot read directory 'd/no-x': Permission denied
+# Convert either of the latter two to the first one.
+sed "s/^$prog: cannot access /$prog: /" out > t && mv t out
+sed "s/^$prog: cannot read directory /$prog: /" out > t && mv t out
+sed 's,d/no-x/y,d/no-x,' out > t && mv t out
+
+cat <<EOF > exp
+$prog: 'd/no-x': Permission denied
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/one-file-system b/tests/du/one-file-system
deleted file mode 100755
index b595dc6..0000000
--- a/tests/du/one-file-system
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-# Test for a bug in fts's handling of FTS_XDEV, the flag behind
-# du's --one-file-system (-x) option.
-
-# Copyright (C) 2006 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-. $srcdir/../envvar-check
-
-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
-mkdir -p b/c y/z || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-# Due to a used-uninitialized variable, the "du -x" from coreutils-6.6
-# would not traverse into second and subsequent directories listed
-# on the command line.
-du -ax b y > t || fail=1
-sed 's/^[0-9][0-9]* //' t > out
-cat <<\EOF > exp || fail=1
-b/c
-b
-y/z
-y
-EOF
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/du/one-file-system.sh b/tests/du/one-file-system.sh
new file mode 100755
index 0000000..17ec63b
--- /dev/null
+++ b/tests/du/one-file-system.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# Test for bugs in du's --one-file-system (-x) option.
+
+# Copyright (C) 2006-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+mkdir -p b/c y/z d "$other_partition_tmpdir/x" || framework_failure_
+ln -s "$other_partition_tmpdir/x" d || framework_failure_
+
+# Due to a used-uninitialized variable, the "du -x" from coreutils-6.6
+# would not traverse into second and subsequent directories listed
+# on the command line.
+du -ax b y > t || fail=1
+sed 's/^[0-9][0-9]* //' t > out
+cat <<\EOF > exp || fail=1
+b/c
+b
+y/z
+y
+EOF
+
+compare exp out || fail=1
+
+# "du -xL" reported a zero count for a file in a different file system,
+# instead of ignoring it.
+du -xL d > u || fail=1
+sed 's/^[0-9][0-9]* //' u > out1
+echo d > exp1 || fail=1
+compare exp1 out1 || fail=1
+
+# With coreutils-8.15, "du -xs FILE" would print no output.
+touch f
+for opt in -x -xs; do
+ du $opt f > u || fail=1
+ sed 's/^[0-9][0-9]* //' u > out2
+ echo f > exp2 || fail=1
+ compare exp2 out2 || fail=1
+done
+
+Exit $fail
diff --git a/tests/du/restore-wd b/tests/du/restore-wd
deleted file mode 100755
index 3b8a3c9..0000000
--- a/tests/du/restore-wd
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-# 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 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-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
-mkdir a b || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-# With du from coreutils-4.5.5 and 4.5.6, this would fail with
-# du: `b': No such file or directory
-
-du a b > out || fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/du/restore-wd.sh b/tests/du/restore-wd.sh
new file mode 100755
index 0000000..a8a900c
--- /dev/null
+++ b/tests/du/restore-wd.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# 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-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+mkdir a b || framework_failure_
+
+
+# With du from coreutils-4.5.5 and 4.5.6, this would fail with
+# du: 'b': No such file or directory
+
+du a b > out || fail=1
+
+Exit $fail
diff --git a/tests/du/slash b/tests/du/slash
deleted file mode 100755
index d3e1335..0000000
--- a/tests/du/slash
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-# `du /' would omit the `/' on the last line.
-
-# Copyright (C) 2003, 2004, 2006 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-. $srcdir/../envvar-check
-
-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
-
-fail=0
-
-du --exclude='[^/]*' -x / > out-t || fail=1
-sed 's/^[0-9][0-9]* //' out-t > out
-rm -f out-t
-cat <<\EOF > exp
-/
-EOF
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/du/slash.sh b/tests/du/slash.sh
new file mode 100755
index 0000000..bb6d1fb
--- /dev/null
+++ b/tests/du/slash.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# 'du /' would omit the '/' on the last line.
+
+# Copyright (C) 2003-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+require_readable_root_
+
+
+du --exclude='[^/]*' -x / > out-t || fail=1
+sed 's/^[0-9][0-9]* //' out-t > out
+rm -f out-t
+cat <<\EOF > exp
+/
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/slink b/tests/du/slink
deleted file mode 100755
index 8be1a30..0000000
--- a/tests/du/slink
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-# Ensure that the size of a long-named-symlink is > 0.
-
-# Copyright (C) 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-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
-
-# Determine if `.' is on a local (would non-NFS be sufficient?) file system.
-# On at least some NFS implementations, symlinks never take up space,
-
-# So if this is a non-local file system, skip the test.
-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
-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
-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
-fi
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-symlink_name_lengths='1 15 16 31 32 59 60 63 64 127 128 255 256 511 512 1024'
-for len in $symlink_name_lengths; do
- name=`seq 1 $len|tr -c x y |head -c$len`
- # Record the names of symlinks that are successfully created.
- ln -fs $name $len > /dev/null 2>&1 \
- && symlinks="$symlinks $len"
-done
-
-du -a $symlinks > out || fail=1
-
-# Require that at least one of these symlinks has a non-zero size.
-grep '^[1-9]' out > /dev/null || fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/du/threshold.sh b/tests/du/threshold.sh
new file mode 100755
index 0000000..d4746df
--- /dev/null
+++ b/tests/du/threshold.sh
@@ -0,0 +1,362 @@
+#!/bin/sh
+# Exercise du's --threshold option.
+
+# Copyright (C) 2013-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+mkdir -p a/b a/c || framework_failure_
+
+touch a/b/0 || framework_failure_
+printf '%1s' x > a/b/1 || framework_failure_
+printf '%2s' x > a/b/2 || framework_failure_
+printf '%3s' x > a/b/3 || framework_failure_
+
+Ba=$(stat --format="%B * %b" a | xargs expr)
+Bb=$(stat --format="%B * %b" a/b | xargs expr)
+Bc=$(stat --format="%B * %b" a/c | xargs expr)
+B0=$(stat --format="%B * %b" a/b/0 | xargs expr)
+B1=$(stat --format="%B * %b" a/b/1 | xargs expr)
+B2=$(stat --format="%B * %b" a/b/2 | xargs expr)
+B3=$(stat --format="%B * %b" a/b/3 | xargs expr)
+
+Sa=$(stat --format=%s a )
+Sb=$(stat --format=%s a/b )
+Sc=$(stat --format=%s a/c )
+S0=$(stat --format=%s a/b/0)
+S1=$(stat --format=%s a/b/1)
+S2=$(stat --format=%s a/b/2)
+S3=$(stat --format=%s a/b/3)
+
+Bb0123=$(expr $Bb + $B0 + $B1 + $B2 + $B3)
+Sb0123=$(expr $Sb + $S0 + $S1 + $S2 + $S3)
+
+Bab0123=$(expr $Ba + $Bc + $Bb0123)
+Sab0123=$(expr $Sa + $Sc + $Sb0123)
+
+# Sanity checks
+test $Ba -gt 4 || skip_ "block size of a directory is smaller than 4 bytes"
+test $Bc -gt 4 || skip_ "block size of an empty directory is smaller than 4 \
+bytes"
+test $Sa -gt 4 || skip_ "apparent size of a directory is smaller than 4 bytes"
+test $B1 -gt 4 || skip_ "block size of small file smaller than 4 bytes"
+test $S3 -eq 3 || framework_failure_
+test $S2 -eq 2 || framework_failure_
+test $S1 -eq 1 || framework_failure_
+test $S0 -eq 0 || framework_failure_
+test $B0 -eq 0 || skip_ "block size of an empty file unequal Zero"
+# block size of a/b/1 == a/b/2
+test $B1 -eq $B2 || framework_failure_
+# a is bigger than a/b.
+test $Sab0123 -gt $Sb0123 || framework_failure_
+test $Bab0123 -gt $Bb0123 || framework_failure_
+# a/b is bigger than empty a/c.
+test $Sb0123 -gt $Sc || framework_failure_
+test $Bb0123 -gt $Bc || framework_failure_
+
+# Exercise a bad argument: unparsable number.
+cat <<EOF > exp
+du: invalid --threshold argument 'SIZE'
+EOF
+du --threshold=SIZE a > out 2>&1 && fail=1
+compare exp out || fail=1
+
+cat <<EOF > exp
+du: invalid -t argument 'SIZE'
+EOF
+du -t SIZE a > out 2>&1 && fail=1
+compare exp out || fail=1
+
+# Exercise a bad argument: -0 is not valid.
+cat <<EOF > exp
+du: invalid --threshold argument '-0'
+EOF
+du --threshold=-0 a > out 2>&1 && fail=1
+compare exp out || fail=1
+
+du -t -0 a > out 2>&1 && fail=1
+compare exp out || fail=1
+
+du -t-0 a > out 2>&1 && fail=1
+compare exp out || fail=1
+
+# Exercise a bad argument: empty argument.
+cat <<EOF > exp
+du: invalid --threshold argument ''
+EOF
+du --threshold= a > out 2>&1 && fail=1
+compare exp out || fail=1
+
+# Exercise a bad argument: no argument.
+du --threshold > out.tmp 2>&1 && fail=1
+sed 's/argument.*/argument/; s/option.*requires/option requires/' \
+ < out.tmp > out || framework_failure_
+cat <<EOF > exp
+du: option requires an argument
+Try 'du --help' for more information.
+EOF
+compare exp out || fail=1
+rm -f out
+
+dutest ()
+{
+ args="$1"
+ exp="$2"
+
+ rm -f exp out
+
+ # Expected output.
+ if [ "$exp" = "" ] ; then
+ touch exp
+ else
+ printf "%s\n" $exp > exp
+ fi
+
+ rc=0
+ du -B1 $args a > out1 2>&1 || { cat out1 ; rc=1 ; }
+
+ # Remove the size column and sort the output.
+ cut -f2- out1 | sort > out || framework_failure_
+
+ compare exp out || { cat out1 ; rc=1 ; }
+ return $rc
+}
+
+# Check numbers around the total size of the main directory 'a'.
+# One byte greater than 'a'.
+s=$(expr $Sab0123 + 1) # apparent size
+dutest "--app -t $s" '' || fail=1
+dutest "--app -a -t $s" '' || fail=1
+dutest "--app -S -t $s" '' || fail=1
+dutest "--app -a -S -t $s" '' || fail=1
+dutest "--app -t -$s" 'a a/b a/c' || fail=1
+dutest "--app -a -t -$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest "--app -S -t -$s" 'a a/b a/c' || fail=1
+dutest "--app -a -S -t -$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+s=$(expr $Bab0123 + 1) # block size
+dutest " -t $s" '' || fail=1
+dutest " -a -t $s" '' || fail=1
+dutest " -S -t $s" '' || fail=1
+dutest " -a -S -t $s" '' || fail=1
+dutest " -t -$s" 'a a/b a/c' || fail=1
+dutest " -a -t -$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S -t -$s" 'a a/b a/c' || fail=1
+dutest " -a -S -t -$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+
+# Exactly the size of 'a'.
+s=$Sab0123 # apparent size
+dutest "--app --th=$s" 'a' || fail=1
+dutest "--app -a --th=$s" 'a' || fail=1
+dutest "--app -S --th=$s" '' || fail=1
+dutest "--app -a -S --th=$s" '' || fail=1
+dutest "--app --th=-$s" 'a a/b a/c' || fail=1
+dutest "--app -a --th=-$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest "--app -S --th=-$s" 'a a/b a/c' || fail=1
+dutest "--app -a -S --th=-$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+s=$Bab0123 # block size
+dutest " --th=$s" 'a' || fail=1
+dutest " -a --th=$s" 'a' || fail=1
+dutest " -S --th=$s" '' || fail=1
+dutest " -a -S --th=$s" '' || fail=1
+dutest " --th=-$s" 'a a/b a/c' || fail=1
+dutest " -a --th=-$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=-$s" 'a a/b a/c' || fail=1
+dutest " -a -S --th=-$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+
+# One byte smaller than 'a'.
+s=$(expr $Sab0123 - 1) # apparent size
+dutest "--app --th=$s" 'a' || fail=1
+dutest "--app -a --th=$s" 'a' || fail=1
+dutest "--app -S --th=$s" '' || fail=1
+dutest "--app -a -S --th=$s" '' || fail=1
+dutest "--app --th=-$s" 'a/b a/c' || fail=1
+dutest "--app -a --th=-$s" 'a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest "--app -S --th=-$s" 'a a/b a/c' || fail=1
+dutest "--app -a -S --th=-$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+s=$(expr $Bab0123 - 1) # block size
+dutest " --th=$s" 'a' || fail=1
+dutest " -a --th=$s" 'a' || fail=1
+dutest " -S --th=$s" '' || fail=1
+dutest " -a -S --th=$s" '' || fail=1
+dutest " --th=-$s" 'a/b a/c' || fail=1
+dutest " -a --th=-$s" 'a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=-$s" 'a a/b a/c' || fail=1
+dutest " -a -S --th=-$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+
+
+# Check numbers around the total size of the sub directory 'a/b'.
+# One byte greater than 'a/b'.
+s=$(expr $Sb0123 + 1) # apparent size
+dutest "--app --th=$s" 'a' || fail=1
+dutest "--app -a --th=$s" 'a' || fail=1
+dutest "--app -S --th=$s" '' || fail=1
+dutest "--app -a -S --th=$s" '' || fail=1
+dutest "--app --th=-$s" 'a/b a/c' || fail=1
+dutest "--app -a --th=-$s" 'a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest "--app -S --th=-$s" 'a a/b a/c' || fail=1
+dutest "--app -a -S --th=-$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+s=$(expr $Bb0123 + 1) # block size
+dutest " --th=$s" 'a' || fail=1
+dutest " -a --th=$s" 'a' || fail=1
+dutest " -S --th=$s" '' || fail=1
+dutest " -a -S --th=$s" '' || fail=1
+dutest " --th=-$s" 'a/b a/c' || fail=1
+dutest " -a --th=-$s" 'a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=-$s" 'a a/b a/c' || fail=1
+dutest " -a -S --th=-$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+
+# Exactly the size of 'a/b'.
+s=$Sb0123 # apparent size
+dutest "--app --th=$s" 'a a/b' || fail=1
+dutest "--app -a --th=$s" 'a a/b' || fail=1
+dutest "--app -S --th=$s" 'a/b' || fail=1
+dutest "--app -a -S --th=$s" 'a/b' || fail=1
+dutest "--app --th=-$s" 'a/b a/c' || fail=1
+dutest "--app -a --th=-$s" 'a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest "--app -S --th=-$s" 'a a/b a/c' || fail=1
+dutest "--app -a -S --th=-$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+s=$Bb0123 # block size
+dutest " --th=$s" 'a a/b' || fail=1
+dutest " -a --th=$s" 'a a/b' || fail=1
+dutest " -S --th=$s" 'a/b' || fail=1
+dutest " -a -S --th=$s" 'a/b' || fail=1
+dutest " --th=-$s" 'a/b a/c' || fail=1
+dutest " -a --th=-$s" 'a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=-$s" 'a a/b a/c' || fail=1
+dutest " -a -S --th=-$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+
+# One byte smaller than 'a/b'.
+s=$(expr $Sb0123 - 1) # apparent size
+dutest "--app --th=$s" 'a a/b' || fail=1
+dutest "--app -a --th=$s" 'a a/b' || fail=1
+dutest "--app -S --th=$s" 'a/b' || fail=1
+dutest "--app -a -S --th=$s" 'a/b' || fail=1
+dutest "--app --th=-$s" 'a/c' || fail=1
+dutest "--app -a --th=-$s" 'a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest "--app -S --th=-$s" 'a a/c' || fail=1
+dutest "--app -a -S --th=-$s" 'a a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+s=$(expr $Bb0123 - 1) # block size
+dutest " --th=$s" 'a a/b' || fail=1
+dutest " -a --th=$s" 'a a/b' || fail=1
+dutest " -S --th=$s" 'a/b' || fail=1
+dutest " -a -S --th=$s" 'a/b' || fail=1
+dutest " --th=-$s" 'a/c' || fail=1
+dutest " -a --th=-$s" 'a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=-$s" 'a a/c' || fail=1
+dutest " -a -S --th=-$s" 'a a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+
+
+# Check numbers around the total size of the files a/b/[0123]'.
+echo One byte greater than 'a/b/3'.
+s=$(expr $S3 + 1) # apparent size
+dutest "--app --th=$s" 'a a/b a/c' || fail=1
+dutest "--app -a --th=$s" 'a a/b a/c' || fail=1
+dutest "--app -S --th=$s" 'a a/b a/c' || fail=1
+dutest "--app -a -S --th=$s" 'a a/b a/c' || fail=1
+dutest "--app --th=-$s" '' || fail=1
+dutest "--app -a --th=-$s" 'a/b/0 a/b/1 a/b/2 a/b/3' || fail=1
+dutest "--app -S --th=-$s" '' || fail=1
+dutest "--app -a -S --th=-$s" 'a/b/0 a/b/1 a/b/2 a/b/3' || fail=1
+s=$(expr $B3 + 1) # block size
+dutest " --th=$s" 'a a/b' || fail=1
+dutest " -a --th=$s" 'a a/b' || fail=1
+dutest " -S --th=$s" 'a/b' || fail=1
+dutest " -a -S --th=$s" 'a/b' || fail=1
+dutest " --th=-$s" 'a/c' || fail=1
+dutest " -a --th=-$s" 'a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=-$s" 'a a/c' || fail=1
+dutest " -a -S --th=-$s" 'a a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+
+# Exactly the size of 'a/b/3'.
+echo Exactly the size of 'a/b/3'.
+s=$S3 # apparent size
+dutest "--app --th=$s" 'a a/b a/c' || fail=1
+dutest "--app -a --th=$s" 'a a/b a/b/3 a/c' || fail=1
+dutest "--app -S --th=$s" 'a a/b a/c' || fail=1
+dutest "--app -a -S --th=$s" 'a a/b a/b/3 a/c' || fail=1
+dutest "--app --th=-$s" '' || fail=1
+dutest "--app -a --th=-$s" 'a/b/0 a/b/1 a/b/2 a/b/3' || fail=1
+dutest "--app -S --th=-$s" '' || fail=1
+dutest "--app -a -S --th=-$s" 'a/b/0 a/b/1 a/b/2 a/b/3' || fail=1
+s=$B3 # block size
+dutest " --th=$s" 'a a/b a/c' || fail=1
+dutest " -a --th=$s" 'a a/b a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=$s" 'a a/b a/c' || fail=1
+dutest " -a -S --th=$s" 'a a/b a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " --th=-$s" 'a/c' || fail=1
+dutest " -a --th=-$s" 'a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=-$s" 'a a/c' || fail=1
+dutest " -a -S --th=-$s" 'a a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+
+# Exactly the size of 'a/b/2'.
+echo Exactly the size of 'a/b/2'.
+s=$S2 # apparent size
+dutest "--app --th=$s" 'a a/b a/c' || fail=1
+dutest "--app -a --th=$s" 'a a/b a/b/2 a/b/3 a/c' || fail=1
+dutest "--app -S --th=$s" 'a a/b a/c' || fail=1
+dutest "--app -a -S --th=$s" 'a a/b a/b/2 a/b/3 a/c' || fail=1
+dutest "--app --th=-$s" '' || fail=1
+dutest "--app -a --th=-$s" 'a/b/0 a/b/1 a/b/2' || fail=1
+dutest "--app -S --th=-$s" '' || fail=1
+dutest "--app -a -S --th=-$s" 'a/b/0 a/b/1 a/b/2' || fail=1
+s=$B2 # block size
+dutest " --th=$s" 'a a/b a/c' || fail=1
+dutest " -a --th=$s" 'a a/b a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=$s" 'a a/b a/c' || fail=1
+dutest " -a -S --th=$s" 'a a/b a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " --th=-$s" 'a/c' || fail=1
+dutest " -a --th=-$s" 'a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=-$s" 'a a/c' || fail=1
+dutest " -a -S --th=-$s" 'a a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+
+# Exactly the size of 'a/b/1'.
+echo Exactly the size of 'a/b/1'.
+s=$S1 # apparent size
+dutest "--app --th=$s" 'a a/b a/c' || fail=1
+dutest "--app -a --th=$s" 'a a/b a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest "--app -S --th=$s" 'a a/b a/c' || fail=1
+dutest "--app -a -S --th=$s" 'a a/b a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest "--app --th=-$s" '' || fail=1
+dutest "--app -a --th=-$s" 'a/b/0 a/b/1' || fail=1
+dutest "--app -S --th=-$s" '' || fail=1
+dutest "--app -a -S --th=-$s" 'a/b/0 a/b/1' || fail=1
+s=$B1 # block size
+dutest " --th=$s" 'a a/b a/c' || fail=1
+dutest " -a --th=$s" 'a a/b a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=$s" 'a a/b a/c' || fail=1
+dutest " -a -S --th=$s" 'a a/b a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " --th=-$s" 'a/c' || fail=1
+dutest " -a --th=-$s" 'a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=-$s" 'a a/c' || fail=1
+dutest " -a -S --th=-$s" 'a a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+
+# Exactly the size of 'a/b/0'.
+echo Exactly the size of 'a/b/0'.
+s=$S0 # apparent size
+dutest "--app --th=$s" 'a a/b a/c' || fail=1
+dutest "--app -a --th=$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest "--app -S --th=$s" 'a a/b a/c' || fail=1
+dutest "--app -a -S --th=$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+# (maximum tests (-0) not possible).
+s=$B0 # block size
+dutest " --th=$s" 'a a/b a/c' || fail=1
+dutest " -a --th=$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+dutest " -S --th=$s" 'a a/b a/c' || fail=1
+dutest " -a -S --th=$s" 'a a/b a/b/0 a/b/1 a/b/2 a/b/3 a/c' || fail=1
+# (maximum tests (-0) not possible).
+
+Exit $fail
diff --git a/tests/du/trailing-slash b/tests/du/trailing-slash
deleted file mode 100755
index 4d607cd..0000000
--- a/tests/du/trailing-slash
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-# 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, 2003, 2004, 2006 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# Before coreutils-4.5.3, it would remove a single trailing slash.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-. $srcdir/../envvar-check
-
-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
-mkdir -p dir/1/2 || framework_failure=1
-ln -s dir slink || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-du slink/ | sed 's/^[0-9][0-9]* //' > out
-echo === >> out
-
-# Ensure that with -L we get the same results (modulo the trailing slash
-# on the third line) even without the trailing slash on the command line.
-du -L slink | sed 's/^[0-9][0-9]* //' >> out
-cat <<\EOF > exp
-slink/1/2
-slink/1
-slink/
-===
-slink/1/2
-slink/1
-slink
-EOF
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/du/trailing-slash.sh b/tests/du/trailing-slash.sh
new file mode 100755
index 0000000..c483c65
--- /dev/null
+++ b/tests/du/trailing-slash.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# 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-2016 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/>.
+
+# Before coreutils-4.5.3, it would remove a single trailing slash.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+mkdir -p dir/1/2 || framework_failure_
+ln -s dir slink || framework_failure_
+
+
+du slink/ | sed 's/^[0-9][0-9]* //' > out
+echo === >> out
+
+# Ensure that with -L we get the same results (modulo the trailing slash
+# on the third line) even without the trailing slash on the command line.
+du -L slink | sed 's/^[0-9][0-9]* //' >> out
+cat <<\EOF > exp
+slink/1/2
+slink/1
+slink/
+===
+slink/1/2
+slink/1
+slink
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/du/two-args b/tests/du/two-args
deleted file mode 100755
index 93700a0..0000000
--- a/tests/du/two-args
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-# Make sure `du d/1 d/2' works.
-# That command failed with du from fileutils-4.0q.
-
-# Copyright (C) 2000, 2004, 2006 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 2 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- du --version
-fi
-
-pwd=`pwd`
-tmp=du2-$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- (exit 1); exit 1
-fi
-
-mkdir -p $tmp/1 $tmp/2
-
-test -d $tmp || fail=1
-du $tmp/1 $tmp/2 > /dev/null || fail=1
-
-# Make sure `du . $tmp' and `du .. $tmp' work.
-# These would fail prior to fileutils-4.0y.
-du . $tmp > /dev/null || fail=1
-du .. $tmp > /dev/null || fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/du/two-args.sh b/tests/du/two-args.sh
new file mode 100755
index 0000000..15db12b
--- /dev/null
+++ b/tests/du/two-args.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Make sure 'du d/1 d/2' works.
+# That command failed with du from fileutils-4.0q.
+
+# Copyright (C) 2000-2016 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/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
+
+# Run this test from a sub-directory one level deeper than normal,
+# so that the "du .." below doesn't traverse sibling directories
+# that may be inaccessible due concurrently-running tests.
+mkdir sub || framework_failure_
+cd sub || framework_failure_
+
+t=t
+mkdir -p $t/1 $t/2 || framework_failure_
+
+test -d $t || fail=1
+du $t/1 $t/2 > /dev/null || fail=1
+
+# Make sure 'du . $t' and 'du .. $t' work.
+# These would fail prior to fileutils-4.0y.
+du . $t > /dev/null || fail=1
+du .. $t > /dev/null || fail=1
+
+Exit $fail