2003-02-05 09:17:22 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
# make sure du's --exclude option works
|
|
|
|
|
|
2011-01-01 11:37:32 +01:00
|
|
|
# Copyright (C) 2003-2011 Free Software Foundation, Inc.
|
2006-08-17 19:58:17 +00:00
|
|
|
|
2007-07-23 14:35:58 +02:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2006-08-17 19:58:17 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-07-23 14:35:58 +02:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
2006-08-17 19:58:17 +00:00
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-07-23 14:35:58 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-08-17 19:58:17 +00:00
|
|
|
|
2010-11-14 11:05:05 +01:00
|
|
|
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
2010-11-17 21:35:31 +01:00
|
|
|
print_ver_ du
|
2004-03-02 22:59:47 +00:00
|
|
|
|
2011-08-04 20:52:31 +02:00
|
|
|
mkdir -p a/b/c a/x/y a/u/v || framework_failure_
|
2003-02-05 09:17:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
du --exclude=x a | sed 's/^[0-9][0-9]* //' | sort > out || fail=1
|
2003-02-05 09:18:33 +00:00
|
|
|
printf '===\n' >> out
|
2003-02-05 09:17:22 +00:00
|
|
|
printf 'b\n' > excl
|
2003-02-05 09:18:33 +00:00
|
|
|
du --exclude-from=excl a | sed 's/^[0-9][0-9]* //' | sort >> out || fail=1
|
2003-02-05 14:29:59 +00:00
|
|
|
printf '===\n' >> out
|
|
|
|
|
# Make sure that we can exclude an entire hierarchy.
|
|
|
|
|
du --exclude=a a >> out || fail=1
|
2005-01-05 07:53:11 +00:00
|
|
|
# Make sure that we can exclude based on more than one component.
|
|
|
|
|
# Before coreutils-5.3.0, this part would fail.
|
|
|
|
|
printf '===\n' >> out
|
|
|
|
|
du --exclude=a/u --exclude=a/b a \
|
|
|
|
|
| sed 's/^[0-9][0-9]* //' | sort >> out || fail=1
|
2003-02-05 09:17:22 +00:00
|
|
|
cat <<\EOF > exp
|
2003-02-05 09:18:33 +00:00
|
|
|
a
|
2003-02-05 09:17:22 +00:00
|
|
|
a/b
|
2003-02-05 09:18:33 +00:00
|
|
|
a/b/c
|
2003-02-05 09:17:22 +00:00
|
|
|
a/u
|
|
|
|
|
a/u/v
|
2003-02-05 09:18:33 +00:00
|
|
|
===
|
2003-02-05 09:17:22 +00:00
|
|
|
a
|
2003-02-05 09:18:33 +00:00
|
|
|
a/u
|
|
|
|
|
a/u/v
|
|
|
|
|
a/x
|
|
|
|
|
a/x/y
|
2003-02-05 14:29:59 +00:00
|
|
|
===
|
2005-01-05 07:53:11 +00:00
|
|
|
===
|
|
|
|
|
a
|
|
|
|
|
a/x
|
|
|
|
|
a/x/y
|
2003-02-05 09:17:22 +00:00
|
|
|
EOF
|
|
|
|
|
|
2007-09-07 15:25:23 +02:00
|
|
|
compare out exp || fail=1
|
2003-02-05 09:17:22 +00:00
|
|
|
|
2008-09-07 10:31:27 +02:00
|
|
|
Exit $fail
|