overlay: run unionmount testsuite test cases
[xfstests-dev.git] / tests / xfs / 271
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 271
6 #
7 # Check that getfsmap reports the AG 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 -rf "$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 xfs
31 _require_xfs_scratch_rmapbt
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 agcount=$(_xfs_mount_agcount $SCRATCH_MNT)
41
42 echo "Get fsmap" | tee -a $seqres.full
43 $XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT > $TEST_DIR/fsmap
44 cat $TEST_DIR/fsmap >> $seqres.full
45
46 echo "Check AG header" | tee -a $seqres.full
47 grep 'static fs metadata[[:space:]]*[0-9]*[[:space:]]*(0\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
48 _within_tolerance "AG header count" $(wc -l < $TEST_DIR/testout) $agcount 0 -v
49
50 echo "Check freesp/rmap btrees" | tee -a $seqres.full
51 grep 'per-AG metadata[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
52 _within_tolerance "freesp extent count" $(wc -l < $TEST_DIR/testout) $((agcount * 3)) 0 999999 -v
53
54 echo "Check inode btrees" | tee -a $seqres.full
55 grep 'inode btree[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
56 _within_tolerance "inode btree extent count" $(wc -l < $TEST_DIR/testout) $agcount 0 -v
57
58 echo "Check inodes" | tee -a $seqres.full
59 grep 'inodes[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
60 _within_tolerance "inode extent count" $(wc -l < $TEST_DIR/testout) 1 0 999999 -v
61
62 echo "Check journal" | tee -a $seqres.full
63 grep 'journalling log' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
64 _within_tolerance "journal extent count" $(wc -l < $TEST_DIR/testout) 1 0 -v
65
66 # success, all done
67 status=0
68 exit