fstests: convert remaining tests to SPDX license tags
[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 seq=`basename "$0"`
10 seqres="$RESULT_DIR/$seq"
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         cd /
21         rm -f "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_os Linux
30 _supported_fs ext4
31 _require_scratch
32 _require_xfs_io_command "fsmap"
33
34 rm -f "$seqres.full"
35
36 echo "Format and mount"
37 _scratch_mkfs > "$seqres.full" 2>&1
38 _scratch_mount
39
40 echo "Get fsmap" | tee -a $seqres.full
41 $XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT > $TEST_DIR/fsmap
42 cat $TEST_DIR/fsmap >> $seqres.full
43
44 echo "Check fs metadata" | tee -a $seqres.full
45 x=$(grep -c 'static fs metadata' $TEST_DIR/fsmap)
46 test $x -gt 0 || echo "No fs metadata?"
47
48 echo "Check block bitmap" | tee -a $seqres.full
49 x=$(grep -c 'special 102:1' $TEST_DIR/fsmap)
50 test $x -gt 0 || echo "No block bitmaps?"
51
52 echo "Check inode bitmap" | tee -a $seqres.full
53 x=$(grep -c 'special 102:2' $TEST_DIR/fsmap)
54 test $x -gt 0 || echo "No inode bitmaps?"
55
56 echo "Check inodes" | tee -a $seqres.full
57 x=$(grep -c 'inodes' $TEST_DIR/fsmap)
58 test $x -gt 0 || echo "No inodes?"
59
60 # success, all done
61 status=0
62 exit