summaryrefslogtreecommitdiff
path: root/tests/du/exclude
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-02-05 09:17:22 +0000
committerJim Meyering <jim@meyering.net>2003-02-05 09:17:22 +0000
commita5f617b2b4a26156d1cb8b51de60758c98bab82e (patch)
tree2b0586ada249d724e52ad511372c592a4049ed2b /tests/du/exclude
parent3c1dbea18f07920a3be938993bfefc33eb86e6e9 (diff)
downloadcoreutils-a5f617b2b4a26156d1cb8b51de60758c98bab82e.tar.xz
*** empty log message ***
Diffstat (limited to 'tests/du/exclude')
-rwxr-xr-xtests/du/exclude47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/du/exclude b/tests/du/exclude
new file mode 100755
index 000000000..10e138a65
--- /dev/null
+++ b/tests/du/exclude
@@ -0,0 +1,47 @@
+#!/bin/sh
+# make sure du's --exclude option works
+
+if test "$VERBOSE" = yes; then
+ set -x
+ 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
+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
+
+fail=0
+
+du --exclude=x a | sed 's/^[0-9][0-9]* //' | sort > out || fail=1
+printf '===\n'
+printf 'b\n' > excl
+du --exclude-from=excl a | sed 's/^[0-9][0-9]* //' | sort > out || fail=1
+cat <<\EOF > exp
+a/b/c
+a/b
+a/u/v
+a/u
+a
+===
+a/x/y
+a/x
+a/u/v
+a/u
+a
+EOF
+
+cmp out exp || fail=1
+test $fail = 1 && diff out exp 2> /dev/null
+
+(exit $fail); exit $fail