bed23aa743bb07cbcad0678659189ae3403935b1
[xfstests-dev.git] / tests / generic / 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
25 seq=`basename $0`
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
28
29 out=""
30 here=`pwd`
31 tmp=/tmp/$$
32 status=0        # success is the default!
33 trap "_cleanup; exit \$status" 0 1 2 3 15
34
35 _cleanup()
36 {
37     cd /
38     rm -f $tmp.*
39     [ -n "$out" ] && rm -rf $out
40 }
41
42 # get standard environment, filters and checks
43 . ./common/rc
44 . ./common/filter
45
46 # real QA test starts here
47 _supported_fs generic
48 _supported_os IRIX Linux
49
50 out=$TEST_DIR/dirstress.$$
51
52 rm -f $seqres.full
53
54 _test()
55 {
56     test="$1"
57     args="$2"
58     count="$3"
59     
60     echo "*** TEST $test $args -f <count>"
61     if ! $here/src/dirstress -d $out -f $count $args >$tmp.out 2>&1
62     then
63         echo "    dirstress failed"
64         echo "*** TEST $test -d $out -f $count $args" >>$seqres.full
65         cat $tmp.out >>$seqres.full
66         status=1
67     fi
68 }
69
70 # dirstress doesn't check returns - this is a crash & burn test.
71 if ! mkdir $out
72 then
73     echo "!! couldn't mkdir $out"
74     status=1
75     exit
76 fi
77
78 count=1000
79 _test 1 "-p 1 -n 1" $count
80 _test 2 "-p 5 -n 1" $count
81 _test 3 "-p 5 -n 5" $count
82
83 # if error
84 exit