xfstests: RESULTS_DIR needs to be an absolute path
[xfstests-dev.git] / tests / generic / 074
1 #! /bin/bash
2 # FS QA Test No. 074
3 #
4 # fstest
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2003 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     rm -rf $testdir/fstest.$$.* $tmp.*
40     _cleanup_testdir
41 }
42
43 # get standard environment, filters and checks
44 . ./common/rc
45 . ./common/filter
46
47 _do_test()
48 {
49     _n="$1"
50     _param="$2"
51
52     out=$testdir/fstest.$$.$_n
53     rm -rf $out
54     if ! mkdir $out
55     then
56         echo "    failed to mkdir $out"
57         status=1
58         exit
59     fi
60
61     _filter_param=`echo "$_param" | sed\
62         -e 's/-n [0-9][0-9]*/-n children/' \
63         -e 's/-l [0-9][0-9]*/-l loops/' \
64         -e 's/-f [0-9][0-9]*/-f files/'`
65     
66     echo ""
67     echo "-----------------------------------------------"
68     echo "fstest.$_n : $_filter_param"
69     echo "-----------------------------------------------"
70     if ! $here/src/fstest $_param -p $out >>$seqres.full
71     then
72         echo "    fstest ($_param) returned $? - see $seqres.full"
73         status=1
74         exit
75     fi
76
77     _check_test_fs
78 }
79
80 _usage()
81 {
82     echo "$0: [-f files] [-l loops] [-n children]"
83 }
84
85 _process_args()
86 {
87     while getopts "f:l:n:?" c $@
88     do
89         case $c
90         in
91             f)
92                 numfiles=$OPTARG
93                 param_type="$param_type, overidde -f"
94                 ;;
95             l)
96                 numloops=$OPTARG
97                 param_type="$param_type, overidde -l"
98                 ;;
99             n)
100                 numchildren=$OPTARG
101                 param_type="$param_type, overidde -n"
102                 ;;
103             ?)
104                 _usage
105                 exit    
106                 ;;
107         esac
108     done
109 }
110
111
112 # real QA test starts here
113 rm -f $seqres.full
114
115 _supported_fs generic
116 _supported_os IRIX Linux
117
118 #
119 # set params
120 # These params can take a while on different CPUs/OSs
121 # so we set them differently for different machines
122 #
123 if [ $HOSTOS == "IRIX" ]; then 
124     if uname -R | grep -iq debug; then 
125         # e.g. getting around 37secs for 1,1,1 on IP30 debug
126         numchildren=2
127         numloops=1
128         numfiles=2
129         param_type="IRIX debug"
130     else
131         # getting around 1 sec 1,1,1 - 10secs 1,10,1 on IP30 nondebug
132         numloops=2
133         numfiles=3
134         numchildren=3
135         param_type="IRIX nondebug"
136     fi
137 elif [ $HOSTOS == "Linux" ]; then
138     if uname -a | grep -q SMP; then
139         numloops=10
140         numfiles=5
141         numchildren=3
142         param_type="Linux SMP"
143     else
144         numloops=2
145         numfiles=3
146         numchildren=3
147         param_type="Linux UP"
148     fi
149 else
150     numloops=1
151     numfiles=1
152     numchildren=1
153     param_type="Default"
154 fi
155
156 # can override the params here
157 _process_args "$@"
158
159 echo "Params are for $param_type" >>$seqres.full
160 echo "Params: n = $numchildren l = $numloops f = $numfiles" >>$seqres.full
161
162 _setup_testdir
163
164 _check_test_fs
165
166 # Options:
167 # -F                    generate files with holes  (default=no)
168 # -n num_children       set number of child processes (default=1)
169 # -f num_files          set number of files (default=1)
170 # -s file_size          set file sizes (default=1MiB)
171 # -b block_size         set block (IO) size (default=1024)
172 # -l loops              set loop count (default=100)
173 # -m                    use mmap (default=no)
174 # -S                    use synchronous IO (default=no)
175 # -P                    preallocate space (default=no)
176
177 size10=`expr 10 \* 1024 \* 1024`        # 10 megabytes
178 size30=`expr 30 \* 1024 \* 1024`        # 30 megabytes
179
180 _do_test 0 "-l $numloops"
181
182 _do_test 1 "-l $numloops -s $size10 -b 8192 -m"
183
184 _do_test 2 "-n $numchildren -F -l $numloops -f $numfiles -s $size30 -b 512"
185
186 _do_test 3 "-n $numchildren -F -l $numloops -f $numfiles -s $size30 -b 512 -m"
187
188 _do_test 4 "-n $numchildren -F -l $numloops -f $numfiles -s $size10 -b 512 -mS"