*** empty log message ***
[coreutils.git] / tests / rm / ir-1
blobc5d76cde75fda5bf3f6b8a26a4de94a2789fe013
1 #!/bin/sh
3 test=ir-1
5 if test "$VERBOSE" = yes; then
6 set -x
7 rm --version
8 fi
10 pwd=`pwd`
11 t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
12 trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
13 trap '(exit $?); exit' 1 2 13 15
15 test_failure=0
16 mkdir -p $tmp $tmp/a $tmp/b $tmp/c || test_failure=1
17 > $tmp/a/a || test_failure=1
18 > $tmp/b/bb || test_failure=1
19 > $tmp/c/cc || test_failure=1
21 if test $test_failure = 1; then
22 echo 'failure in testing framework'
23 exit 1
26 cat <<EOF > $test.I
38 EOF
40 # Remove all but one of a, b, c -- I doubt that this test can portably
41 # determine which one was removed based on order of dir entries.
42 # This is a good argument for switching to a dejagnu-style test suite.
43 fail=0
44 rm --verbose -i -r $tmp < $test.I > /dev/null 2>&1 || fail=1
46 # $tmp should not have been removed.
47 test -d $tmp || fail=1
49 # There should be only one directory left.
50 case `echo $tmp/*` in
51 $tmp/[abc]) ;;
52 *) fail=1 ;;
53 esac
55 rm -rf $tmp $test.I
57 (exit $fail); exit