(open_maybe_create): New function.
[coreutils.git] / tests / rm / r-3
blobbaba42d83353d62766467e255911b52ad9049158
1 #!/bin/sh
2 # Create and remove a directory with more than 254 files.
3 # An early version of my rewritten rm failed to remove all of
4 # the files on SunOS4 when there were 254 or more in a directory.
6 : ${RM=rm}
8 : ${TMPDIR=.}
10 if test "$VERBOSE" = yes; then
11 $RM --version
12 set -x
15 tmp=$TMPDIR/t-rm.$$
17 framework_fail=0
18 mkdir $tmp || framework_fail=1
20 a=1
21 n=300
22 i=$a
23 echo "creating $n files in $tmp..."
24 while :; do
25 > $tmp/$i || framework_fail=1
26 test $i = $n && break
27 i=`expr $i + 1`
28 done
30 test -f $tmp/$a || framework_fail=1
31 test -f $tmp/$n || framework_fail=1
33 if test $framework_fail = 1; then
34 echo 'failure in testing framework'
35 exit 1
38 fail=0
39 $RM -rf $tmp || fail=1
40 test -d $tmp && fail=1
42 exit $fail