xfs/029: filter out "extended-header: cycle: 1" from output
[xfstests-dev.git] / tests / xfs / 424
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test 424
6 #
7 # This case checks if setting type causes error.
8 #
9 # On crc filesystems, xfs_db doesn't take sector size into account
10 # when setting type, and this can result in an errant crc.
11 # This issue has been fixed in xfsprogs-dev:
12 # '55f224b ("xfs_db: update buffer size when new type is set")'
13 #
14 # On crc filesystems, when setting the type to "inode" the verifier
15 # validates multiple inodes in the current fs block, so setting the
16 # buffer size to that of just one inode is not sufficient and it'll
17 # emit spurious verifier errors for all but the first.
18 # This issue has been fixed in xfsprogs-dev:
19 # '533d1d2 ("xfs_db: properly set inode type")'
20 seq=`basename $0`
21 seqres=$RESULT_DIR/$seq
22 echo "QA output created by $seq"
23
24 here=`pwd`
25 tmp=/tmp/$$
26 status=1        # failure is the default!
27 trap "_cleanup; exit \$status" 0 1 2 3 15
28
29 _cleanup()
30 {
31         cd /
32         rm -f $tmp.*
33 }
34
35 filter_dbval()
36 {
37         awk '{ print $4 }'
38 }
39
40 # get standard environment, filters and checks
41 . ./common/rc
42 . ./common/filter
43
44 # remove previous $seqres.full before test
45 rm -f $seqres.full
46
47 # Modify as appropriate
48 _supported_os Linux
49 _supported_fs xfs
50 _require_scratch
51
52 echo "Silence is golden."
53
54 # real QA test starts here
55
56 # for different sector sizes, ensure no CRC errors are falsely reported.
57
58 # Supported types include: agf, agfl, agi, attr3, bmapbta,
59 # bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata,
60 # inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt.
61 # For various sector sizes, test some types that involve type size.
62 #
63 # NOTE: skip attr3, bmapbta, bmapbtd, dir3, dqblk, inodata, symlink
64 # rtbitmap, rtsummary, log
65 #
66 sec_sz=`_min_dio_alignment $SCRATCH_DEV`
67 while [ $sec_sz -le 4096 ]; do
68         sector_sizes="$sector_sizes $sec_sz"
69         sec_sz=$((sec_sz * 2))
70 done
71
72 for SECTOR_SIZE in $sector_sizes; do
73         finobt_enabled=0
74         $MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV | \
75                 grep -q 'finobt=1' && finobt_enabled=1
76
77         for TYPE in agf agi agfl sb; do
78                 DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | filter_dbval`
79                 _scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE"
80         done
81
82         DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" |
83                 filter_dbval`
84         _scratch_xfs_db -c "daddr $DADDR" -c "type inode"
85         DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" |
86                 filter_dbval`
87         _scratch_xfs_db -c "daddr $DADDR" -c "type bnobt"
88         DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" |
89                 filter_dbval`
90         _scratch_xfs_db -c "daddr $DADDR" -c "type cntbt"
91         DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" |
92                 filter_dbval`
93         _scratch_xfs_db -c "daddr $DADDR" -c "type inobt"
94         if [ $finobt_enabled -eq 1 ]; then
95                 DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" |
96                         filter_dbval`
97                 _scratch_xfs_db -c "daddr $DADDR" -c "type finobt"
98         fi
99
100         _scratch_xfs_db -c "daddr $DADDR" -c "type text"
101         _scratch_xfs_db -c "daddr $DADDR" -c "type data"
102 done
103
104 # success, all done
105 status=0
106 exit