Reduce runtime of test 083, unilaterally, it can still do its thing at shortened...
[xfstests-dev.git] / 096
1 #! /bin/sh
2 # FS QA Test No. 096
3 #
4 # test out mkfs_xfs output on IRIX/Linux and some of its error handling
5 # ensure pv#920679 is addressed
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
9
10 # This program is free software; you can redistribute it and/or modify it
11 # under the terms of version 2 of the GNU General Public License as
12 # published by the Free Software Foundation.
13
14 # This program is distributed in the hope that it would be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18 # Further, this software is distributed without any warranty that it is
19 # free of the rightful claim of any third person regarding infringement
20 # or the like.  Any license provided herein, whether implied or
21 # otherwise, applies only to this software file.  Patent licenses, if
22 # any, provided herein do not apply to combinations of this program with
23 # other software, or any other product whatsoever.
24
25 # You should have received a copy of the GNU General Public License along
26 # with this program; if not, write the Free Software Foundation, Inc., 59
27 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
28
29 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
30 # Mountain View, CA  94043, or:
31
32 # http://www.sgi.com 
33
34 # For further information regarding this notice, see: 
35
36 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
37 #-----------------------------------------------------------------------
38 #
39 # creator
40 owner=tes@sgi.com
41
42 seq=`basename $0`
43 echo "QA output created by $seq"
44
45 here=`pwd`
46 tmp=/tmp/$$
47 status=1        # failure is the default!
48 trap "_cleanup; exit \$status" 0 1 2 3 15
49
50 _cleanup()
51 {
52     cd /
53     rm -f $tmp.*
54 }
55
56 # get standard environment, filters and checks
57 . ./common.rc
58 . ./common.filter
59 . ./common.log
60
61
62 # filter out counts which will vary
63 #   - blocks, agsize, agcount, device name
64 # filter out differences between linux and irix:
65 #   - sectsz on Linux
66 #   - mmr, mixed-case on IRIX
67 #   - trailing spaces on Linux but not on IRIX
68 #
69 _mkfs_filter()
70 {
71    tee -a $seq.full | \
72    sed \
73         -e 's/blocks=[0-9][0-9]*/blocks=N/' \
74         -e 's/agsize=[0-9][0-9]*/agsize=N/' \
75         -e 's/agcount=[0-9][0-9]*/agcount=N/' \
76         -e 's/meta-data=[^ ]*/meta-data=DEV/' \
77         -e 's/ *isize/ isize/' \
78         -e '/ *= *sectsz=[0-9][0-9]* *$/d' \
79         -e '/ *= *mmr=[0-9][0-9]* *$/d' \
80         -e 's/ *mixed-case=[YN]//' \
81         -e 's/sectsz=[0-9][0-9]* *//' \
82         -e 's/ *$//'
83 }
84
85 # real QA test starts here
86 rm -f $seq.full
87
88 # Modify as appropriate.
89 _supported_fs xfs
90 _supported_os IRIX Linux
91 _require_scratch
92 _require_v2log
93
94 # maximum log record size
95 max_lr_size=`expr 256 \* 1024`
96
97 big_su=`expr $max_lr_size + 4096`
98
99 #
100 # Test out various mkfs param combinations
101 #
102 cat >$tmp.seq.params <<EOF
103 # su too big but must be a multiple of fs block size too
104   -l version=2,su=`expr $max_lr_size + 512`
105 # test log stripe greater than LR size
106   -l version=2,su=$big_su
107 # same test but get log stripe from data stripe
108   -l version=2 -d su=$big_su,sw=1
109 # test out data stripe
110   -d su=$big_su,sw=1
111 # test out data stripe the same but using sunit & swidth
112   -d sunit=`expr $big_su / 512`,swidth=`expr $big_su / 512`
113 EOF
114
115
116 #
117 # call mkfs in a loop for various params
118 #
119 echo ""
120 cat $tmp.seq.params \
121 | while read mkfs
122 do
123     if echo $mkfs | grep -q '^#'; then
124         # print out header & ignore comment
125         echo $mkfs
126         continue
127     fi
128     echo "--- mkfs=$mkfs ---"
129     export MKFS_OPTIONS="$mkfs"
130     _scratch_mkfs_xfs | _mkfs_filter
131     echo ""
132     echo ""
133 done
134
135 # success, all done
136 status=0
137 exit