xfstests: cleanup duplicates in all tests
[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     _cleanup_testdir
41 }
42
43 # get standard environment, filters and checks
44 . ./common/rc
45 . ./common/filter
46
47 # real QA test starts here
48 _supported_fs generic
49 _supported_os IRIX Linux
50
51 _setup_testdir
52
53 out=$testdir/dirstress.$$
54
55 rm -f $seqres.full
56
57 _test()
58 {
59     test="$1"
60     args="$2"
61     count="$3"
62     
63     echo "*** TEST $test $args -f <count>"
64     if ! $here/src/dirstress -d $out -f $count $args >$tmp.out 2>&1
65     then
66         echo "    dirstress failed"
67         echo "*** TEST $test -d $out -f $count $args" >>$seqres.full
68         cat $tmp.out >>$seqres.full
69         status=1
70     fi
71 }
72
73 # dirstress doesn't check returns - this is a crash & burn test.
74 if ! mkdir $out
75 then
76     echo "!! couldn't mkdir $out"
77     status=1
78     exit
79 fi
80
81 count=1000
82 _test 1 "-p 1 -n 1" $count
83 _test 2 "-p 5 -n 1" $count
84 _test 3 "-p 5 -n 5" $count
85
86 # if error
87 exit