xfstests: randholes: Fix two bugs
[xfstests-dev.git] / 011
1 #! /bin/bash
2 # FS QA Test No. 011
3 #
4 # dirstress
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24 # creator
25 owner=dxm@sgi.com
26
27 seq=`basename $0`
28 echo "QA output created by $seq"
29
30 out=""
31 here=`pwd`
32 tmp=/tmp/$$
33 status=0        # success is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
35
36 _cleanup()
37 {
38     cd /
39     rm -f $tmp.*
40     [ -n "$out" ] && rm -rf $out
41     _cleanup_testdir
42 }
43
44 # get standard environment, filters and checks
45 . ./common.rc
46 . ./common.filter
47
48 # real QA test starts here
49 _supported_fs generic
50 _supported_os IRIX Linux
51
52 _setup_testdir
53
54 out=$testdir/dirstress.$$
55
56 rm -f $seq.full
57
58 _test()
59 {
60     test="$1"
61     args="$2"
62     count="$3"
63     
64     echo "*** TEST $test $args -f <count>"
65     if ! $here/src/dirstress -d $out -f $count $args >$tmp.out 2>&1
66     then
67         echo "    dirstress failed"
68         echo "*** TEST $test -d $out -f $count $args" >>$seq.full
69         cat $tmp.out >>$seq.full
70         status=1
71     fi
72 }
73
74 # dirstress doesn't check returns - this is a crash & burn test.
75 if ! mkdir $out
76 then
77     echo "!! couldn't mkdir $out"
78     status=1
79     exit
80 fi
81
82 count=1000
83 _test 1 "-p 1 -n 1" $count
84 _test 2 "-p 5 -n 1" $count
85 _test 3 "-p 5 -n 5" $count
86
87 # if error
88 exit