Remove declaration of statfs.
[coreutils.git] / tests / du / no-x
blob207d4672d994415e08b16ab81be134fcf36e6a6f
1 #!/bin/sh
2 # Make sure du gives the right diagnostic for a readable,
3 # but inaccessible directory.
5 if test "$VERBOSE" = yes; then
6 set -x
7 du --version
8 fi
10 . $srcdir/../lang-default
11 PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
13 pwd=`pwd`
14 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
15 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
16 trap '(exit $?); exit $?' 1 2 13 15
18 framework_failure=0
19 mkdir -p $tmp || framework_failure=1
20 cd $tmp || framework_failure=1
21 mkdir -p d/no-x/y || framework_failure=1
22 chmod u=rw d/no-x || framework_failure=1
24 if test $framework_failure = 1; then
25 echo "$0: failure in testing framework" 1>&2
26 (exit 1); exit 1
29 fail=0
31 # This must exit nonzero.
32 du d >/dev/null 2>out && fail=1
33 cat <<\EOF > exp
34 du: cannot change to directory `d/no-x': Permission denied
35 EOF
37 cmp out exp || fail=1
38 test $fail = 1 && diff out exp 2> /dev/null
40 (exit $fail); exit $fail