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