mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-08-05 08:10:15 +02:00
Convert tests/du/*, too.
This commit is contained in:
+3
-18
@@ -3,7 +3,7 @@
|
||||
# Before coreutils-5.93, on systems with a signed, 32-bit stat.st_blocks
|
||||
# one of du's computations would overflow.
|
||||
|
||||
# Copyright (C) 2005, 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
|
||||
@@ -23,24 +23,10 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
|
||||
@@ -85,7 +71,6 @@ cat <<\EOF > exp || fail=1
|
||||
~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
|
||||
|
||||
+3
-18
@@ -2,7 +2,7 @@
|
||||
# Ensure that du does not rely on narrow types like size_t for
|
||||
# file sizes or sums.
|
||||
|
||||
# Copyright (C) 2003, 2005, 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
|
||||
@@ -22,22 +22,8 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
@@ -69,7 +55,6 @@ cat <<\EOF > exp
|
||||
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
|
||||
|
||||
+5
-20
@@ -22,31 +22,18 @@ if test "$VERBOSE" = yes; then
|
||||
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`
|
||||
@@ -75,8 +62,7 @@ $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 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.
|
||||
@@ -104,8 +90,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 out exp || fail=1
|
||||
fi
|
||||
|
||||
(exit $fail); exit $fail
|
||||
|
||||
+5
-16
@@ -2,7 +2,7 @@
|
||||
# prior to coreutils-4.5.3, du -D didn't work in some cases
|
||||
# Based on an example from Andreas Schwab and/or Michal Svec.
|
||||
|
||||
# Copyright (C) 2002, 2006 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
|
||||
@@ -22,22 +22,11 @@ if test "$VERBOSE" = yes; then
|
||||
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 -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
|
||||
mkdir -p a/sub || framework_failure
|
||||
ln -s a/sub slink || framework_failure
|
||||
touch b || framework_failure
|
||||
|
||||
fail=0
|
||||
|
||||
|
||||
+7
-21
@@ -2,7 +2,7 @@
|
||||
# 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
|
||||
@@ -22,25 +22,12 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
|
||||
@@ -61,7 +48,6 @@ slink/
|
||||
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
|
||||
|
||||
+4
-18
@@ -1,7 +1,7 @@
|
||||
#!/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
|
||||
@@ -21,22 +21,9 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
|
||||
@@ -71,7 +58,6 @@ a/x
|
||||
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
|
||||
|
||||
+3
-15
@@ -1,7 +1,7 @@
|
||||
#!/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
|
||||
@@ -24,15 +24,8 @@ fi
|
||||
# Call this an expensive test. It's not that expensive, but command line
|
||||
# limitations might induce failure on some losing systems.
|
||||
. $srcdir/../expensive
|
||||
. $srcdir/../test-lib.sh
|
||||
|
||||
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'
|
||||
@@ -44,12 +37,7 @@ 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
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
: ${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," \
|
||||
|
||||
+3
-18
@@ -3,7 +3,7 @@
|
||||
# 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
|
||||
@@ -23,26 +23,12 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
@@ -63,7 +49,6 @@ dir/f1
|
||||
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
|
||||
|
||||
+10
-30
@@ -22,29 +22,14 @@ if test "$VERBOSE" = yes; then
|
||||
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.
|
||||
@@ -64,19 +49,14 @@ cat <<\EOF > exp || fail=1
|
||||
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
|
||||
|
||||
+4
-17
@@ -20,20 +20,9 @@ if test "$VERBOSE" = yes; then
|
||||
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 -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
|
||||
mkdir -p a/sub || framework_failure
|
||||
|
||||
fail=0
|
||||
|
||||
@@ -42,8 +31,7 @@ chmod 0 a/sub || fail=1
|
||||
# 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.
|
||||
@@ -53,7 +41,6 @@ chmod 0 a/sub || fail=1
|
||||
# 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Ensure that even when run from an inaccessible directory, du can still
|
||||
# operate on accessible directories elsewhere.
|
||||
|
||||
# Copyright (C) 2003, 2006 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
|
||||
@@ -26,26 +26,15 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/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
|
||||
@@ -33,7 +33,7 @@ if test "$VERBOSE" = yes; then
|
||||
du --version
|
||||
fi
|
||||
|
||||
. $srcdir/../envvar-check
|
||||
. $srcdir/../test-lib.sh
|
||||
|
||||
proc_file=/proc/self/fd
|
||||
if test ! -d $proc_file; then
|
||||
@@ -44,44 +44,32 @@ EOF
|
||||
(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
|
||||
|
||||
+5
-19
@@ -3,7 +3,7 @@
|
||||
# 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
|
||||
@@ -24,15 +24,7 @@ if test "$VERBOSE" = yes; then
|
||||
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.
|
||||
@@ -43,25 +35,20 @@ cd $tmp || framework_failure=1
|
||||
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.
|
||||
|
||||
@@ -91,7 +78,6 @@ 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
|
||||
compare out exp || fail=1
|
||||
|
||||
(exit $fail); exit $fail
|
||||
|
||||
+5
-19
@@ -1,7 +1,7 @@
|
||||
#!/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
|
||||
@@ -21,23 +21,10 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
|
||||
@@ -46,7 +33,6 @@ cat <<\EOF > exp
|
||||
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
|
||||
|
||||
+4
-17
@@ -24,22 +24,10 @@ fi
|
||||
|
||||
. $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
|
||||
|
||||
@@ -62,7 +50,6 @@ cat <<EOF > exp
|
||||
$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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Test for a bug in fts's handling of FTS_XDEV, the flag behind
|
||||
# du's --one-file-system (-x) option.
|
||||
|
||||
# Copyright (C) 2006 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
|
||||
@@ -22,22 +22,9 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
|
||||
@@ -53,7 +40,6 @@ y/z
|
||||
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
|
||||
|
||||
+3
-14
@@ -2,7 +2,7 @@
|
||||
# due to a bug in glibc's ftw.c, in some cases, nftw w/FTW_CHDIR
|
||||
# would not restore the working directory.
|
||||
|
||||
# Copyright (C) 2003, 2006 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
|
||||
@@ -22,20 +22,9 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
|
||||
|
||||
+3
-18
@@ -1,7 +1,7 @@
|
||||
#!/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
|
||||
@@ -21,21 +21,7 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
|
||||
@@ -46,7 +32,6 @@ cat <<\EOF > exp
|
||||
/
|
||||
EOF
|
||||
|
||||
cmp out exp || fail=1
|
||||
test $fail = 1 && diff out exp 2> /dev/null
|
||||
compare out exp || fail=1
|
||||
|
||||
(exit $fail); exit $fail
|
||||
|
||||
+1
-13
@@ -21,14 +21,7 @@ if test "$VERBOSE" = yes; then
|
||||
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,
|
||||
@@ -55,11 +48,6 @@ if df --type=nfsv3 . >/dev/null 2>&1; then
|
||||
(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
|
||||
|
||||
+5
-19
@@ -2,7 +2,7 @@
|
||||
# Ensure that du works properly for an argument that refers to a
|
||||
# symbolic link, and that is specified with a trailing slash.
|
||||
|
||||
# Copyright (C) 2002, 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
|
||||
@@ -24,23 +24,10 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
|
||||
@@ -60,7 +47,6 @@ slink/1
|
||||
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
|
||||
|
||||
+10
-20
@@ -2,7 +2,7 @@
|
||||
# Make sure `du d/1 d/2' works.
|
||||
# That command failed with du from fileutils-4.0q.
|
||||
|
||||
# Copyright (C) 2000, 2004, 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
|
||||
@@ -22,28 +22,18 @@ if test "$VERBOSE" = yes; then
|
||||
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
|
||||
fail=0
|
||||
test -d $t || fail=1
|
||||
du $t/1 $t/2 > /dev/null || fail=1
|
||||
|
||||
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.
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user