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