xfstests: Convert all tests to use /bin/bash
[xfstests-dev.git] / 018
1 #! /bin/bash
2 # FS QA Test No. 018
3 #
4 # xfs_logprint test - test v2 logs of different LR sizes
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 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@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 # prelim
52 rm -f $seq.full $tmp.*
53 _require_scratch
54 _require_v2log
55
56 # link correct .out file
57 _link_out_file $seq.op
58
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
65   version=1     logbsize=32k
66   version=2     logbsize=32k
67   version=2     logbsize=64k
68   version=2     logbsize=128k
69   version=2     logbsize=256k
70 EOF
71
72 if [ "$HOSTOS" = "IRIX" ]; then
73     start_blk=0
74 else
75     start_blk=2
76 fi
77
78 # do the work for various log params which
79 # should not effect the data content of the log
80 cat $tmp.seq.params \
81 | while read mkfs mnt
82 do
83     if [ "$mkfs" = "#" ]; then
84         continue
85     fi
86     export MOUNT_OPTIONS="-o noalign,$mnt"
87     _mkfs_log "-l $mkfs"
88     _create_log
89     _check_log
90
91     _print_operation
92     _cmp_op_output $seq.op $filtered
93
94     _print_transaction_inode $start_blk
95     _cmp_output $seq.trans_inode $filtered
96
97     _print_transaction_buf $start_blk
98     _cmp_output $seq.trans_buf $filtered
99 done
100
101 # got thru it all so we may have success
102 status=0
103
104 exit