xfs: fix more xfs_db open-coding instances
[xfstests-dev.git] / tests / xfs / 135
1 #! /bin/bash
2 # FS QA Test No. 135
3 #
4 # This test verifies that the xfsprogs log formatting infrastructure works
5 # correctly for various log stripe unit values. The log is formatted with xfs_db
6 # and verified with xfs_logprint.
7 #
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2015 Red Hat, Inc. All Rights Reserved.
10 #
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
14 #
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23 #-----------------------------------------------------------------------
24 #
25
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 trap "_cleanup; exit \$status" 0 1 2 3 15
34
35 _cleanup()
36 {
37         cd /
38         rm -f $tmp.*
39 }
40
41 rm -f $seqres.full
42
43 # get standard environment, filters and checks
44 . ./common/rc
45 . ./common/log
46
47 # real QA test starts here
48
49 # Modify as appropriate.
50 _supported_fs xfs
51 _supported_os Linux
52 _require_scratch
53 _require_v2log
54 _require_xfs_db_command "logformat"
55
56 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
57
58 # Reformat the log with various log stripe unit sizes and see if logprint dumps
59 # any errors. Use a cycle value larger than 1 so the log is actually written
60 # (the log is zeroed when cycle == 1).
61 for i in 16 32 64 128 256; do
62         lsunit=$((i * 1024))
63         _scratch_xfs_db -x -c "logformat -c 3 -s $lsunit" | \
64                 tee -a $seqres.full
65         # don't redirect error output so it causes test failure
66         $XFS_LOGPRINT_PROG $SCRATCH_DEV >> $seqres.full
67 done
68
69 # success, all done
70 status=0
71 exit