xfstests: randholes: encapsulate argument parsing
[xfstests-dev.git] / 082
1 #! /bin/bash
2 # FS QA Test No. 082
3 #
4 # Test out the v2 stripe logs with logprint
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 # creator
25 owner=tes@melbourne.sgi.com
26
27 seq=`basename $0`
28 echo "QA output created by $seq"
29
30 here=`pwd`
31 tmp=/tmp/$$
32 status=1        # failure is the default!
33
34 # get standard environment, filters and checks
35 . ./common.rc
36 . ./common.filter
37 . ./common.log
38
39 _cleanup()
40 {
41     cd /
42     _cleanup_logfiles
43     rm -f $tmp.*
44     umount $SCRATCH_MNT 2>/dev/null
45 }
46 trap "_cleanup; exit \$status" 0 1 2 3 15
47
48 # real QA test starts here
49 _supported_fs xfs
50 _supported_os IRIX Linux
51
52 # prelim
53 rm -f $seq.full $tmp.*
54 _require_scratch
55 _require_v2log 
56
57 # link correct .out file
58 _link_out_file $seq.op
59
60 echo "*** init FS"
61 umount $SCRATCH_DEV >/dev/null 2>&1
62
63 cat >$tmp.seq.params <<EOF
64 # mkfs-opt             mount-opt            start-blk
65   version=2            logbsize=32k       2
66   version=2,su=4096    logbsize=32k       8
67   version=2,su=32768   logbsize=32k       64
68 #
69 # expect following line to fail
70 #
71   version=2,su=36864   logbsize=32k       72
72 #
73 # following is not a power of 2 BBs 
74 #
75   version=2,su=5120    logbsize=32k       10
76 EOF
77
78 # Do the work for various log params which
79 # should not effect the data content of the log
80 # Try with and without sync'ing - sync'ing will mean that
81 # the log will be written out unfilled and thus the log 
82 # stripe can have an effect.
83 #
84 for s in sync nosync ; do
85     cat $tmp.seq.params \
86     | while read mkfs mnt start restofline
87     do
88         if [ "$mkfs" = "#" ]; then 
89             continue
90         fi
91         if [ "$HOSTOS" = "IRIX" ]; then 
92             # don't have umount rec at start on IRIX
93             # so we won't have to skip over it and get to 
94             # another stripe boundary
95             start=0
96         fi
97         echo "--- mkfs=$mkfs, mnt=$mnt, sync=$s ---"
98         export MOUNT_OPTIONS="-o $mnt"
99         if ! _mkfs_log "-l $mkfs"; then
100             continue
101         fi      
102         if [ $s = "sync" ]; then
103             _create_log_sync
104         else
105             _create_log
106         fi
107         if [ $? -ne 0 ]; then
108             continue
109         fi
110         _check_log
111
112         sync_suffix=".$s"
113
114         if [ $s = "sync" ]; then
115             # if sync then we have chance of DATA FORK EXTENTS items
116             # not hanging around very long due to inode syncing to disk
117             # (see comment in xfs_iflush_int())
118             # and this is to hard to reconcile in the op output
119             :
120         else
121             _print_operation
122             _cmp_op_output $seq.op $filtered
123         fi
124
125         _print_transaction_inode $start
126         _cmp_output $seq.trans_inode $filtered
127
128         _print_transaction_buf $start
129         _cmp_output $seq.trans_buf $filtered
130     done
131 done
132
133 status=0
134 exit