paranoid testing that mkfs of scratch works without ipaths option
[xfstests-dev.git] / 075
1 #! /bin/sh
2 # FS QA Test No. 075
3 #
4 # fsx (non-AIO variant)
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/fsx.* $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/fsx
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 numops/' \
76         -e 's/-l [0-9][0-9]*/-l filelen/'`
77
78     echo ""
79     echo "-----------------------------------------------"
80     echo "fsx.$_n : $_filter_param"
81     echo "-----------------------------------------------"
82
83     if [ "$FSTYP" = "nfs" ]
84     then
85         if [ "$_n" = "1" -o "$_n" = "3" ]
86         then
87             # HACK: nfs don't handle preallocation (-x) so just skip this test
88             return
89         fi
90     fi
91
92     # This cd and use of -P gets full debug on $here (not TEST_DEV)
93     cd $out
94     if ! $here/ltp/fsx $_param -P $here $seq.$_n >/dev/null
95     then
96         echo "    fsx ($_param) returned $? - see $seq.$_n.full"
97         mv $seq.$_n.fsxlog $here/$seq.$_n.full
98         status=1
99         exit
100     fi
101
102     cd $here
103     _check_test_fs
104 }
105
106 _usage()
107 {
108     echo "$0: [-l filelen] [-n numops1] [-N numops2]"
109 }
110
111 _process_args()
112 {
113     while getopts "l:n:N:?" c $@
114     do
115         case $c
116         in
117             l)
118                 filelen=$OPTARG
119                 param_type="$param_type, overidde -l"
120                 ;;
121             N)
122                 numops2=$OPTARG
123                 param_type="$param_type, overidde -N"
124                 ;;
125             n)
126                 numops1=$OPTARG
127                 param_type="$param_type, overidde -n"
128                 ;;
129             ?)
130                 _usage
131                 exit    
132                 ;;
133         esac
134     done
135 }
136
137
138 # real QA test starts here
139 _supported_fs xfs udf nfs
140 _supported_os IRIX Linux
141
142 size10=`expr 10 \* 1024 \* 1024`        # 10 megabytes
143 filelen=$size10
144 numops1=1000
145 numops2=10000
146
147 # can override the params here
148 _process_args "$@"
149
150 echo "Params are for $param_type" >>$seq.full
151 echo "Params: n = $numops1 N = $numops2 l = $filelen" >>$seq.full
152
153 _setup_testdir
154
155 rm -f $here/$seq.full
156 echo "brevity is wit..."
157
158 _check_test_fs
159
160 # Options:
161 # -d: debug output for all operations
162 # -l flen: the upper bound on file size (default 262144)
163 # -o oplen: the upper bound on operation size
164 # -N numops: total # operations to do (default infinity)
165 # -P: save .fsxlog and .fsxgood files in dirpath (default ./)
166 # -S seed: for random # generator (default 1) 0 gets timestamp
167 # -x: pre-allocate file space, exercising unwritten extents
168
169 _do_test 0 "-d -N $numops1 -S 0"
170 _do_test 1 "-d -N $numops1 -S 0 -x"
171 _do_test 2 "-d -N $numops2 -l $filelen -S 0"
172 _do_test 3 "-d -N $numops2 -l $filelen -S 0 -x"
173
174 rm -f $seq.*.fsx{good,log}
175 exit 0