summaryrefslogtreecommitdiff
path: root/tests/du/inacc-dest
diff options
context:
space:
mode:
Diffstat (limited to 'tests/du/inacc-dest')
-rwxr-xr-xtests/du/inacc-dest40
1 files changed, 10 insertions, 30 deletions
diff --git a/tests/du/inacc-dest b/tests/du/inacc-dest
index af28fcc04..cd2e1e828 100755
--- a/tests/du/inacc-dest
+++ b/tests/du/inacc-dest
@@ -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