xfstests: fix _link_out_file callers
[xfstests-dev.git] / tests / xfs / 096
1 #! /bin/bash
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
11 # modify it under the terms 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,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22 #
23 #-----------------------------------------------------------------------
24 #
25
26 seqfull=$0
27 seq=`basename $0`
28 seqres=$RESULT_DIR/$seq
29 seqres=$RESULT_DIR/$seq
30 seqres=$RESULT_DIR/$seq
31 echo "QA output created by $seq"
32
33 here=`pwd`
34 tmp=/tmp/$$
35 status=1        # failure is the default!
36 trap "_cleanup; exit \$status" 0 1 2 3 15
37
38 _cleanup()
39 {
40     cd /
41     rm -f $tmp.*
42 }
43
44 # get standard environment, filters and checks
45 . ./common.rc
46 . ./common.filter
47 . ./common.log
48
49 #
50 # filter out counts which will vary
51 #   - extsz, blocks, agsize, agcount, device name, rtextents
52 # filter out differences between linux and irix:
53 #   - sectsz on Linux
54 #   - mmr, mixed-case on IRIX
55 #   - lazy-count on IRIX
56 #   - inode-paths on IRIX
57 #   - trailing spaces on Linux but not on IRIX
58 #
59 # Example output:
60 #  meta-data=DEV isize=256    agcount=N, agsize=N blks
61 #  data     =                       bsize=4096   blocks=N, imaxpct=25
62 #           =                       sunit=65     swidth=65 blks, unwritten=1
63 #  naming   =version 2              bsize=4096
64 #  log      =internal log           bsize=4096   blocks=N, version=1
65 #           =                       sunit=0 blks
66 #  realtime =none                   extsz=65536  blocks=N, rtextents=N
67 #
68 _mkfs_filter()
69 {
70    tee -a $seqres.full | \
71    sed \
72         -e 's/extsz=[0-9][0-9]*[ ]*/extsz=N, /' \
73         -e 's/blocks=[0-9][0-9]*/blocks=N/' \
74         -e 's/imaxpct=[0-9][0-9]*/imaxpct=N/' \
75         -e 's/agsize=[0-9][0-9]*/agsize=N/' \
76         -e 's/agcount=[0-9][0-9]*/agcount=N/' \
77         -e 's/swidth=[0-9][0-9]* blks$/&, unwritten=1/' \
78         -e 's/rtextents=[0-9][0-9]*/rtextents=N/' \
79         -e 's/meta-data=[^ ]*/meta-data=DEV/' \
80         -e 's/ *isize/ isize/' \
81         -e '/ *= *sectsz=[0-9][0-9]* *attr=[0-9][0-9]*.*$/d' \
82         -e '/ *= *mmr=[0-9][0-9]* *$/d' \
83         -e 's/ *mixed-case=[YN]//' \
84         -e 's/ *ascii-ci=[01]//' \
85         -e 's/sectsz=[0-9][0-9]* *//' \
86         -e 's/, lazy-count.*//' \
87         -e '/inode-paths/d' \
88         -e 's/\(log[    ]*=\).*bsize/\1LOG                    bsize/' \
89         -e 's/\(realtime[       ]*=\).*extsz/\1REALTIME               extsz/' \
90         -e '/.*crc=/d' \
91         -e 's/ *$//' \
92    | grep -v parent
93 }
94
95 # real QA test starts here
96 rm -f $seqres.full
97
98 # Modify as appropriate.
99 _supported_fs xfs
100 _supported_os IRIX Linux
101 _require_scratch
102 _require_v2log
103
104 # choose .out file based on internal/external log
105 rm -f $seqfull.out
106 if [ "$USE_EXTERNAL" = yes ]; then
107         ln -s $seq.external $seqfull.out
108 else
109         ln -s $seq.internal $seqfull.out
110 fi
111
112 # maximum log record size
113 max_lr_size=`expr 256 \* 1024`
114
115 big_su=`expr $max_lr_size + 4096`
116
117 #
118 # Test out various mkfs param combinations
119 #
120 cat >$tmp.seq.params <<EOF
121 # su too big but must be a multiple of fs block size too
122   -l version=2,su=`expr $max_lr_size + 512`
123 # test log stripe greater than LR size
124   -l version=2,su=$big_su
125 # same test but get log stripe from data stripe
126   -l version=2 -d su=$big_su,sw=1
127 # test out data stripe
128   -l version=1 -d su=$big_su,sw=1
129 # test out data stripe the same but using sunit & swidth
130   -l version=1 -d sunit=`expr $big_su / 512`,swidth=`expr $big_su / 512`
131 EOF
132
133
134 #
135 # call mkfs in a loop for various params
136 #
137 echo ""
138 cat $tmp.seq.params \
139 | while read mkfs
140 do
141     if echo $mkfs | grep -q '^#'; then
142         # print out header & ignore comment
143         echo $mkfs
144         continue
145     fi
146     echo "--- mkfs=$mkfs ---"
147     export MKFS_OPTIONS="$mkfs"
148     _scratch_mkfs_xfs | _mkfs_filter
149     echo ""
150     echo ""
151 done
152
153 # success, all done
154 status=0
155 exit