# 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.
+# Copyright (C) 2005-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
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
+. $srcdir/../test-lib.sh
fail=0
~2M
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
# 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.
+# Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
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
+. $srcdir/../test-lib.sh
dd bs=1 seek=8G of=big < /dev/null 2> /dev/null
if test $? != 0; then
8589934592 big
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
fi
# DU_BLOCK_SIZE could cause problems
-. $srcdir/../envvar-check
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
-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 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`
$tot a
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff -u out exp 2> /dev/null
+compare out exp || 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.
$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 out exp || fail=1
fi
(exit $fail); exit $fail
# 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.
+# Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
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
+. $srcdir/../test-lib.sh
+
+mkdir -p a/sub || framework_failure
+ln -s a/sub slink || framework_failure
+touch b || framework_failure
fail=0
# 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-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
du --version
fi
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
-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
+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
fail=0
64 slink-to-64k
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
#!/bin/sh
# make sure du's --exclude option works
-# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003-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
du --version
fi
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
-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
+mkdir -p a/b/c a/x/y a/u/v || framework_failure
fail=0
a/x/y
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
#!/bin/sh
# check for file descriptor leak
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Call this an expensive test. It's not that expensive, but command line
# limitations might induce failure on some losing systems.
. $srcdir/../expensive
+. $srcdir/../test-lib.sh
-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'
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
: ${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," \
# Likewise for excluded directories.
# Ensure that hard links _are_ listed twice when using --count-links.
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
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
+. $srcdir/../test-lib.sh
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
dir
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff -u out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
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
+. $srcdir/../test-lib.sh
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
+ || framework_failure
fail=0
-
du > ../t 2>&1 && fail=1
# Accept either of the following outputs.
du: cannot read directory `./c': Permission denied
EOF
-cat <<\EOF > exp2 || fail=1
-.
-./a
-./b
-./c
-./d
-./e
-du: cannot access `./c/j': 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
-cmp out exp > /dev/null 2>&1 || {
- cmp out exp2 || fail=1
- }
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+
+mkdir -p a/sub || framework_failure
fail=0
# Expect failure, ignore diagnostics.
du -s a > out 2> /dev/null && fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
# Same as above, but don't use -s, so we print
# an entry for the unreadable "sub", too.
# Expect failure, ignore diagnostics.
du -k a > out 2> /dev/null && fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
# 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.
+# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
fi
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
-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
+cwd=`pwd`
+mkdir -p no-x a/b || framework_failure
+cd no-x || framework_failure
+chmod 0 . || framework_failure
fail=0
-du "$pwd/$tmp/a" > /dev/null || fail=1
+du "$cwd/a" > /dev/null || fail=1
(exit $fail); exit $fail
#!/bin/sh
# Show fts fails on old-fashioned systems.
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
du --version
fi
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
proc_file=/proc/self/fd
if test ! -d $proc_file; then
(exit 77); exit 77
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`
# 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
+# 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:
+
+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
+ || framework_failure
-mkdir inaccessible || framework_failure=1
-cd inaccessible || 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
+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
# Show that du fails with ELOOP (Too many levels of symbolic links)
# when it encounters that condition.
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
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
+. $srcdir/../test-lib.sh
# Create lots of directories, each containing a single symlink
# pointing at the next directory in the list.
n=400
dir_list=`seq $n`
-mkdir $dir_list || framework_failure=1
+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=1
+ ln -s ../$i $i_minus_1/s || framework_failure
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.
echo "du: cannot access: $too_many" > exp || fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
#!/bin/sh
# Ensure that by default, du doesn't dereference command-line symlinks.
-# Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
du --version
fi
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
-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
+mkdir -p dir/a/b || framework_failure
+ln -s dir slink || framework_failure
fail=0
slink
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
-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
+mkdir -p d/no-x/y || framework_failure
+chmod u=rw d/no-x || framework_failure
fail=0
$prog: \`d/no-x': Permission denied
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
# 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.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
du --version
fi
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
-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
+mkdir -p b/c y/z || framework_failure
fail=0
y
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
# 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.
+# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
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
+. $srcdir/../test-lib.sh
-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
+mkdir a b || framework_failure
fail=0
#!/bin/sh
# `du /' would omit the `/' on the last line.
-# Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
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
+. $srcdir/../test-lib.sh
fail=0
/
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
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
+. $srcdir/../test-lib.sh
# Determine if `.' is on a local (would non-NFS be sufficient?) file system.
# On at least some NFS implementations, symlinks never take up space,
(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
# 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.
+# 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
du --version
fi
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
-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
+mkdir -p dir/1/2 || framework_failure
+ln -s dir slink || framework_failure
fail=0
slink
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
# 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.
+# Copyright (C) 2000, 2004-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
du --version
fi
-pwd=`pwd`
-tmp=du2-$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
+t=t
+mkdir -p $t/1 $t/2 || framework_failure
-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
+fail=0
+test -d $t || fail=1
+du $t/1 $t/2 > /dev/null || fail=1
-# Make sure `du . $tmp' and `du .. $tmp' work.
+# Make sure `du . $t' and `du .. $t' work.
# These would fail prior to fileutils-4.0y.
-du . $tmp > /dev/null || fail=1
-du .. $tmp > /dev/null || fail=1
+du . $t > /dev/null || fail=1
+du .. $t > /dev/null || fail=1
(exit $fail); exit $fail