summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-03-08 08:39:07 +0000
committerJim Meyering <jim@meyering.net>2003-03-08 08:39:07 +0000
commit5fb608bc08d2d59ad252ed4d17d5e9374b7b3d7e (patch)
tree53a0fae3f5d1907a6ac38d3e80d508ecbcdd39bd /tests
parente20876e2ca771b44450be9c4a769242b3821cc11 (diff)
downloadcoreutils-5fb608bc08d2d59ad252ed4d17d5e9374b7b3d7e.tar.xz
Correct/add tests for the above fix.
Set LC_ALL, etc, now that we use sort. Check the block/size of a small file, too. Correct expected results for simple dir1/dir2/file case. Add another test of du -S.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/du/basic30
1 files changed, 19 insertions, 11 deletions
diff --git a/tests/du/basic b/tests/du/basic
index 52a1add44..69761c9bf 100755
--- a/tests/du/basic
+++ b/tests/du/basic
@@ -8,6 +8,7 @@ fi
# DU_BLOCK_SIZE could cause problems
. $srcdir/../envvar-check
+. $srcdir/../lang-default
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
@@ -18,9 +19,9 @@ framework_failure=0
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir -p a/b d d/sub || framework_failure=1
-printf 'make-sure-the-file-is-non-empty\n' > a/b/c || framework_failure=1
+printf 'make-sure-the-file-is-non-empty\n' > a/b/F || framework_failure=1
echo nonempty-file > d/1
-echo nonempty-file > d/sub/1
+echo nonempty-file > d/sub/2
if test $framework_failure = 1; then
echo "$0: failure in testing framework" 1>&2
@@ -46,27 +47,34 @@ echo === >> out
du -a -S a >> out || fail=1
echo === >> out
du -s a >> out || fail=1
-cat <<\EOF > exp
-4 a/b/c
+cat <<\EOF | sed 's/ *#.*//' > exp
+4 a/b/F
8 a/b
12 a
===
-4 a/b/c
-4 a/b
-4 a
+4 a/b/F # size of file, a/b/F
+8 a/b # size of dir entry, a/b, + size of file, a/b/F
+4 a # size of dir entry, a
===
12 a
EOF
cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+test $fail = 1 && diff -u out exp 2> /dev/null
rm -f out exp
-du -S d > out || fail=1
+du -a d | sort -r -k2,2 > out || fail=1
+echo === >> out
+du -S d | sort -r -k2,2 >> out || fail=1
-cat <<\EOF > exp
+cat <<\EOF | sed 's/ *#.*//' > exp
+4 d/sub/2
+8 d/sub
+4 d/1
+16 d
+===
8 d/sub
-8 d
+8 d # d + d/1; don't count the dir. entry for d/sub
EOF
cmp out exp || fail=1