xfstests: RESULTS_DIR needs to be an absolute path
[xfstests-dev.git] / tests / generic / 013
1 #! /bin/bash
2 # FS QA Test No. 013
3 #
4 # fsstress
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 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 seqres=$RESULT_DIR/$seq
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
30
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     # we might get here with a RO FS
40     mount -o remount,rw $TEST_DEV >/dev/null 2>&1
41     # now remove fsstress directory.
42     # N.B. rm(1) on IRIX can find problems when building up a long pathname
43     # such that what it has is greater the 1024 chars and will
44     # stop and complain - so get rid of complaint
45     # Ref. pv#935754
46     rm -rf $testdir/fsstress.$$.* 2>&1 | grep -v 'Path too long'
47     _cleanup_testdir
48 }
49
50 _filesize()
51 {
52     ls -l $1 | $AWK_PROG '{print "    filesize = " $5}'
53 }
54
55 # get standard environment, filters and checks
56 . ./common/rc
57 . ./common/filter
58
59 _do_test()
60 {
61     _n="$1"
62     _param="$2"
63     _count="$3"
64
65     out=$testdir/fsstress.$$.$_n
66     rm -rf $out
67     if ! mkdir $out
68     then
69         echo "    failed to mkdir $out"
70         status=1
71         exit
72     fi
73
74     echo ""
75     echo "-----------------------------------------------"
76     echo "fsstress.$_n : $_param"
77     echo "-----------------------------------------------"
78     # -m limits number of users/groups so check doesn't fail (malloc) later
79     dbgoutfile=$seqres.full
80     if ! $FSSTRESS_PROG $_param $FSSTRESS_AVOID -v -m 8 -n $_count -d $out >>$dbgoutfile 2>&1
81     then
82         echo "    fsstress (count=$_count) returned $? - see $seqres.full"
83         echo "--------------------------------------"       >>$seqres.full
84         echo "$_n - output from fsstress:"                  >>$seqres.full
85         echo "--------------------------------------"       >>$seqres.full
86         echo "<NOT LOGGED>"                                 >>$seqres.full
87         #cat $tmp.out                                       >>$seqres.full
88         status=1
89     fi
90
91     _check_test_fs
92 }
93
94
95 # real QA test starts here
96 _supported_fs generic
97 _supported_os IRIX Linux
98
99 _setup_testdir
100
101 rm -f $seqres.full
102 echo "brevity is wit..."
103
104 count=1000
105 procs=20
106
107 _check_test_fs
108
109 # the default
110
111 _do_test 1 "-r" $count
112
113 # and the default with multiprocess
114
115 _do_test 2 "-p $procs -r" $count
116
117 # from Glen's notes
118
119 _do_test 3 "-p 4 -z -f rmdir=10 -f link=10 -f creat=10 -f mkdir=10 -f rename=30 -f stat=30 -f unlink=30 -f truncate=20" $count
120
121 # if all ok by here then probably don't need $seqres.full
122 rm -f $seqres.full
123
124 exit
125
126 # Test with error injection:
127 #
128 # (error injection)
129 # fsstress -n 1000 -d $scratch -p 4 -z -f rmdir=10 -f link=10 -f creat=10 \
130 #          -f mkdir=10 -f rename=30 -f stat=30 -f unlink=30 -f truncate=20 \
131 #          -e 1
132 #
133 # Error values 1 - 6 test IFLUSH
134 #         1 - corrupt buffer being flushed to di_core.di_magic
135 #         2 - corrupt inode being flushed i_d.di_magic
136 #         3 - corrupt S_IFREG format check
137 #         4 - corrupt S_IFDIR format check
138 #         5 - corrupt i_d.di_nextents
139 #         6 - corrupt i_d.di_forkoff > sb_inodesize