1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-07-26 02:30:35 +02:00
Files
coreutils/tests/rm/ir-1
T

58 lines
993 B
Bash
Raw Normal View History

1997-08-24 19:18:03 +00:00
#!/bin/sh
test=ir-1
if test "$VERBOSE" = yes; then
set -x
2002-04-19 19:53:03 +00:00
rm --version
1997-08-24 19:18:03 +00:00
fi
2002-04-19 19:53:03 +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 $status' 0
2002-04-19 19:53:03 +00:00
trap '(exit $?); exit' 1 2 13 15
1997-08-24 19:18:03 +00:00
test_failure=0
2002-04-20 14:49:46 +00:00
mkdir -p $tmp $tmp/a $tmp/b $tmp/c || test_failure=1
1998-01-22 08:33:02 +00:00
> $tmp/a/a || test_failure=1
> $tmp/b/bb || test_failure=1
> $tmp/c/cc || test_failure=1
1997-08-24 19:18:03 +00:00
1997-08-24 20:30:06 +00:00
if test $test_failure = 1; then
1997-08-24 19:18:03 +00:00
echo 'failure in testing framework'
exit 1
fi
1997-08-24 20:30:06 +00:00
cat <<EOF > $test.I
y
y
y
y
y
y
y
y
n
n
n
1997-08-24 19:18:03 +00:00
EOF
1997-08-24 20:30:06 +00:00
# Remove all but one of a, b, c -- I doubt that this test can portably
1997-08-24 20:55:56 +00:00
# determine which one was removed based on order of dir entries.
1997-08-24 20:30:06 +00:00
# This is a good argument for switching to a dejagnu-style test suite.
fail=0
2002-04-19 19:53:03 +00:00
rm --verbose -i -r $tmp < $test.I > /dev/null 2>&1 || fail=1
1997-08-24 20:30:06 +00:00
# $tmp should not have been removed.
test -d $tmp || fail=1
# There should be only one directory left.
1997-08-24 21:06:00 +00:00
case `echo $tmp/*` in
1997-08-24 20:30:06 +00:00
$tmp/[abc]) ;;
*) fail=1 ;;
esac
1997-08-24 19:18:03 +00:00
1997-11-03 04:51:54 +00:00
rm -rf $tmp $test.I
1997-08-24 19:18:03 +00:00
2002-04-19 22:50:36 +00:00
(exit $fail); exit