1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-20 02:36:16 +02:00
Files
coreutils/tests/rm/r-2

69 lines
1.8 KiB
Plaintext
Raw Normal View History

1997-08-16 16:40:55 +00:00
#!/bin/sh
# Test "rm -r --verbose".
# Copyright (C) 1997, 1998, 2000, 2002, 2004, 2006 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
1997-08-16 16:40:55 +00:00
if test "$VERBOSE" = yes; then
2000-05-03 11:09:07 +00:00
rm --version
1997-08-16 16:40:55 +00:00
set -x
fi
2000-10-22 21:23:18 +00:00
. $srcdir/../lang-default
2000-05-20 08:42:44 +00:00
pwd=`pwd`
2002-04-20 14:49:46 +00:00
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
trap 'status=$?; cd $pwd; rm -rf $t0 || exit $?; exit $status' 0
2000-05-20 08:42:44 +00:00
trap 'exit $?' 1 2 13 15
framework_failure=0
2002-04-20 14:49:46 +00:00
mkdir -p $tmp || framework_failure=1
2000-05-20 08:42:44 +00:00
cd $tmp
1997-08-16 16:40:55 +00:00
2000-05-20 08:42:44 +00:00
mkdir t t/a t/a/b || framework_failure=1
> t/a/f || framework_failure=1
> t/a/b/g || framework_failure=1
1997-08-16 16:40:55 +00:00
# FIXME: if this fails, it's a framework failure
cat <<\EOF | sort > t/E || framework_failure=1
removed directory: `t/a'
removed directory: `t/a/b'
removed `t/a/b/g'
removed `t/a/f'
EOF
2000-05-20 08:42:44 +00:00
if test $framework_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
# Note that both the expected output (above) and the actual output lines
# are sorted, because directory entries may be processed in arbitrary order.
1997-08-16 16:40:55 +00:00
fail=0
2000-05-20 08:52:03 +00:00
rm --verbose -r t/a | sort > t/O || fail=1
1997-08-16 16:40:55 +00:00
2000-05-20 08:42:44 +00:00
if test -d t/a; then
1997-08-16 16:40:55 +00:00
fail=1
fi
# Compare expected and actual output.
2000-05-20 08:52:03 +00:00
cmp t/E t/O || fail=1
test $fail = 1 && diff t/E t/O 2> /dev/null
1997-08-16 16:40:55 +00:00
(exit $fail); exit $fail