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