Get things working for unusual filesystem types once again.
[xfstests-dev.git] / 074
1 #! /bin/sh
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 modify it
10 # under the terms of version 2 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, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17 # Further, this software is distributed without any warranty that it is
18 # free of the rightful claim of any third person regarding infringement
19 # or the like.  Any license provided herein, whether implied or
20 # otherwise, applies only to this software file.  Patent licenses, if
21 # any, provided herein do not apply to combinations of this program with
22 # other software, or any other product whatsoever.
23
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write the Free Software Foundation, Inc., 59
26 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
27
28 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
29 # Mountain View, CA  94043, or:
30
31 # http://www.sgi.com 
32
33 # For further information regarding this notice, see: 
34
35 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
36 #-----------------------------------------------------------------------
37 #
38 # creator
39 owner=nathans@sgi.com
40
41 seq=`basename $0`
42 echo "QA output created by $seq"
43
44 here=`pwd`
45 tmp=/tmp/$$
46 status=0        # success is the default!
47 trap "_cleanup; exit \$status" 0 1 2 3 15
48
49 _cleanup()
50 {
51     cd /
52     rm -rf $testdir/fstest.$$.* $tmp.*
53     _cleanup_testdir
54 }
55
56 # get standard environment, filters and checks
57 . ./common.rc
58 . ./common.filter
59
60 _do_test()
61 {
62     _n="$1"
63     _param="$2"
64
65     out=$testdir/fstest.$$.$_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     _filter_param=`echo "$_param" | sed\
75         -e 's/-n [0-9][0-9]*/-n children/' \
76         -e 's/-l [0-9][0-9]*/-l loops/' \
77         -e 's/-f [0-9][0-9]*/-f files/'`
78     
79     echo ""
80     echo "-----------------------------------------------"
81     echo "fstest.$_n : $_filter_param"
82     echo "-----------------------------------------------"
83     if ! $here/src/fstest $_param -p $out >>$seq.full
84     then
85         echo "    fstest ($_param) returned $? - see $seq.full"
86         status=1
87         exit
88     fi
89
90     _check_test_fs
91 }
92
93 _usage()
94 {
95     echo "$0: [-f files] [-l loops] [-n children]"
96 }
97
98 _process_args()
99 {
100     while getopts "f:l:n:?" c $@
101     do
102         case $c
103         in
104             f)
105                 numfiles=$OPTARG
106                 param_type="$param_type, overidde -f"
107                 ;;
108             l)
109                 numloops=$OPTARG
110                 param_type="$param_type, overidde -l"
111                 ;;
112             n)
113                 numchildren=$OPTARG
114                 param_type="$param_type, overidde -n"
115                 ;;
116             ?)
117                 _usage
118                 exit    
119                 ;;
120         esac
121     done
122 }
123
124
125 # real QA test starts here
126 rm -f $here/$seq.full
127
128 _supported_fs xfs udf nfs
129 _supported_os IRIX Linux
130
131 #
132 # set params
133 # These params can take a while on different CPUs/OSs
134 # so we set them differently for different machines
135 #
136 if [ $HOSTOS == "IRIX" ]; then 
137     if uname -R | grep -iq debug; then 
138         # e.g. getting around 37secs for 1,1,1 on IP30 debug
139         numchildren=2
140         numloops=1
141         numfiles=2
142         param_type="IRIX debug"
143     else
144         # getting around 1 sec 1,1,1 - 10secs 1,10,1 on IP30 nondebug
145         numloops=2
146         numfiles=3
147         numchildren=3
148         param_type="IRIX nondebug"
149     fi
150 elif [ $HOSTOS == "Linux" ]; then
151     numloops=10
152     numfiles=5
153     numchildren=3
154     param_type="Linux"
155 else
156     numloops=1
157     numfiles=1
158     numchildren=1
159     param_type="Default"
160 fi
161
162 # can override the params here
163 _process_args "$@"
164
165 echo "Params are for $param_type" >>$seq.full
166 echo "Params: n = $numchildren l = $numloops f = $numfiles" >>$seq.full
167
168 _setup_testdir
169
170 _check_test_fs
171
172 # Options:
173 # -F                    generate files with holes  (default=no)
174 # -n num_children       set number of child processes (default=1)
175 # -f num_files          set number of files (default=1)
176 # -s file_size          set file sizes (default=1MiB)
177 # -b block_size         set block (IO) size (default=1024)
178 # -l loops              set loop count (default=100)
179 # -m                    use mmap (default=no)
180 # -S                    use synchronous IO (default=no)
181 # -P                    preallocate space (default=no)
182
183 size10=`expr 10 \* 1024 \* 1024`        # 10 megabytes
184 size30=`expr 30 \* 1024 \* 1024`        # 30 megabytes
185
186 _do_test 0 "-l $numloops"
187
188 _do_test 1 "-l $numloops -s $size10 -b 8192 -m"
189
190 _do_test 2 "-n $numchildren -F -l $numloops -f $numfiles -s $size30 -b 512"
191
192 _do_test 3 "-n $numchildren -F -l $numloops -f $numfiles -s $size30 -b 512 -m"
193
194 _do_test 4 "-n $numchildren -F -l $numloops -f $numfiles -s $size10 -b 512 -mS"