xfs: fix more xfs_db open-coding instances
[xfstests-dev.git] / tests / xfs / 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
25 seqfull=$0
26 seq=`basename $0`
27 seqres=$RESULT_DIR/$seq
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     _scratch_unmount 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 $seqres.full $tmp.*
53 _require_scratch
54 _require_v2log
55
56 # link correct .out file
57 _link_out_file_named $seqfull.op $(_get_os_name)
58
59 echo "*** init FS"
60 _scratch_unmount >/dev/null 2>&1
61
62 cat >$tmp.seq.params <<EOF
63 # mkfs-opt        mount-opt
64   version=1     logbsize=32k
65   version=2     logbsize=32k
66   version=2     logbsize=64k
67   version=2     logbsize=128k
68   version=2     logbsize=256k
69 EOF
70
71 if [ "$HOSTOS" = "IRIX" ]; then
72     start_blk=0
73 else
74     start_blk=2
75 fi
76
77 # do the work for various log params which
78 # should not effect the data content of the log
79 cat $tmp.seq.params \
80 | while read mkfs mnt
81 do
82     if [ "$mkfs" = "#" ]; then
83         continue
84     fi
85     export MOUNT_OPTIONS="-o noalign,$mnt"
86     _mkfs_log "-l $mkfs"
87     _create_log
88     _check_log
89
90     _print_operation
91     _cmp_op_output $seqfull.op $filtered
92
93     _print_transaction_inode $start_blk
94     _cmp_output $seqfull.trans_inode $filtered
95
96     _print_transaction_buf $start_blk
97     _cmp_output $seqfull.trans_buf $filtered
98 done
99
100 # got thru it all so we may have success
101 status=0
102
103 exit