Remove declaration of statfs.
[coreutils.git] / tests / du / exclude
blob3003003001db79fca29afc1160b6238899ff1692
1 #!/bin/sh
2 # make sure du's --exclude option works
4 if test "$VERBOSE" = yes; then
5 set -x
6 du --version
7 fi
9 pwd=`pwd`
10 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
11 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
12 trap '(exit $?); exit $?' 1 2 13 15
14 framework_failure=0
15 mkdir -p $tmp || framework_failure=1
16 cd $tmp || framework_failure=1
17 mkdir -p a/b/c a/x/y a/u/v
19 if test $framework_failure = 1; then
20 echo "$0: failure in testing framework" 1>&2
21 (exit 1); exit 1
24 fail=0
26 du --exclude=x a | sed 's/^[0-9][0-9]* //' | sort > out || fail=1
27 printf '===\n' >> out
28 printf 'b\n' > excl
29 du --exclude-from=excl a | sed 's/^[0-9][0-9]* //' | sort >> out || fail=1
30 printf '===\n' >> out
31 # Make sure that we can exclude an entire hierarchy.
32 du --exclude=a a >> out || fail=1
33 cat <<\EOF > exp
35 a/b
36 a/b/c
37 a/u
38 a/u/v
39 ===
41 a/u
42 a/u/v
43 a/x
44 a/x/y
45 ===
46 EOF
48 cmp out exp || fail=1
49 test $fail = 1 && diff out exp 2> /dev/null
51 (exit $fail); exit $fail