ext4/027: Correct the right code of block and inode bitmap
[xfstests-dev.git] / tests / ext4 / 027
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 027
6 #
7 # Check that getfsmap reports the BG metadata we're expecting.
8 #
9 . ./common/preamble
10 _begin_fstest auto quick fsmap
11
12 # Override the default cleanup function.
13 _cleanup()
14 {
15         cd /
16         rm -f "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
17 }
18
19 # Import common functions.
20 . ./common/filter
21
22 # real QA test starts here
23 _supported_fs ext4
24 _require_scratch
25 _require_xfs_io_command "fsmap"
26
27 rm -f "$seqres.full"
28
29 echo "Format and mount"
30 _scratch_mkfs > "$seqres.full" 2>&1
31 _scratch_mount
32
33 echo "Get fsmap" | tee -a $seqres.full
34 $XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT > $TEST_DIR/fsmap
35 cat $TEST_DIR/fsmap >> $seqres.full
36
37 echo "Check fs metadata" | tee -a $seqres.full
38 x=$(grep -c 'static fs metadata' $TEST_DIR/fsmap)
39 test $x -gt 0 || echo "No fs metadata?"
40
41 echo "Check block bitmap" | tee -a $seqres.full
42 x=$(grep -c 'special 102:3' $TEST_DIR/fsmap)
43 test $x -gt 0 || echo "No block bitmaps?"
44
45 echo "Check inode bitmap" | tee -a $seqres.full
46 x=$(grep -c 'special 102:4' $TEST_DIR/fsmap)
47 test $x -gt 0 || echo "No inode bitmaps?"
48
49 echo "Check inodes" | tee -a $seqres.full
50 x=$(grep -c 'inodes' $TEST_DIR/fsmap)
51 test $x -gt 0 || echo "No inodes?"
52
53 # success, all done
54 status=0
55 exit