Add GPL license plate to SGI's test files.
[xfstests-dev.git] / 082
1 #! /bin/sh
2 #
3 #-----------------------------------------------------------------------
4 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation.
9 #
10 # This program is distributed in the hope that it would be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write the Free Software Foundation,
17 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 #
19 #-----------------------------------------------------------------------
20 #
21 # FS QA Test No. 082
22 #
23 # Test out the v2 stripe logs with logprint
24 #
25 # creator
26 owner=tes@melbourne.sgi.com
27
28 seq=`basename $0`
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=1        # failure is the default!
34
35 # get standard environment, filters and checks
36 . ./common.rc
37 . ./common.filter
38 . ./common.log
39
40 _cleanup()
41 {
42     cd /
43     _cleanup_logfiles
44     rm -f $tmp.*
45     umount $SCRATCH_MNT 2>/dev/null
46 }
47 trap "_cleanup; exit \$status" 0 1 2 3 15
48
49 # real QA test starts here
50 _supported_fs xfs
51 _supported_os IRIX Linux
52
53 # prelim
54 rm -f $seq.full $tmp.*
55 _require_scratch
56 _require_v2log 
57
58 # link correct .out file
59 _link_out_file $seq.op
60
61 echo "*** init FS"
62 umount $SCRATCH_DEV >/dev/null 2>&1
63
64 cat >$tmp.seq.params <<EOF
65 # mkfs-opt             mount-opt            start-blk
66   version=2            logbsize=32k       2
67   version=2,su=4096    logbsize=32k       8
68   version=2,su=32768   logbsize=32k       64
69 #
70 # expect following line to fail
71 #
72   version=2,su=36864   logbsize=32k       72
73 #
74 # following is not a power of 2 BBs 
75 #
76   version=2,su=5120    logbsize=32k       10
77 EOF
78
79 # Do the work for various log params which
80 # should not effect the data content of the log
81 # Try with and without sync'ing - sync'ing will mean that
82 # the log will be written out unfilled and thus the log 
83 # stripe can have an effect.
84 #
85 for s in sync nosync ; do
86     cat $tmp.seq.params \
87     | while read mkfs mnt start restofline
88     do
89         if [ "$mkfs" = "#" ]; then 
90             continue
91         fi
92         if [ "$HOSTOS" = "IRIX" ]; then 
93             # don't have umount rec at start on IRIX
94             # so we won't have to skip over it and get to 
95             # another stripe boundary
96             start=0
97         fi
98         echo "--- mkfs=$mkfs, mnt=$mnt, sync=$s ---"
99         export MOUNT_OPTIONS="-o $mnt"
100         if ! _mkfs_log "-l $mkfs"; then
101             continue
102         fi      
103         if [ $s = "sync" ]; then
104             _create_log_sync
105         else
106             _create_log
107         fi
108         if [ $? -ne 0 ]; then
109             continue
110         fi
111         _check_log
112
113         sync_suffix=".$s"
114
115         if [ $s = "sync" ]; then
116             # if sync then we have chance of DATA FORK EXTENTS items
117             # not hanging around very long due to inode syncing to disk
118             # (see comment in xfs_iflush_int())
119             # and this is to hard to reconcile in the op output
120             :
121         else
122             _print_operation
123             _cmp_op_output $seq.op $filtered
124         fi
125
126         _print_transaction_inode $start
127         _cmp_output $seq.trans_inode $filtered
128
129         _print_transaction_buf $start
130         _cmp_output $seq.trans_buf $filtered
131     done
132 done
133
134 status=0
135 exit