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