xfs: Check for extent overflow when trivally adding a new extent
[xfstests-dev.git] / tests / xfs / 277
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. 277
6 #
7 # Check that getfsmap reports internal log devices
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_fs xfs
30 _require_xfs_scratch_rmapbt
31 _require_xfs_io_command "fsmap"
32 if [ "$USE_EXTERNAL" = "yes" ] && [ -n "$SCRATCH_LOGDEV" ]; then
33         _notrun "Cannot have external log device"
34 fi
35
36 rm -f "$seqres.full"
37
38 echo "Format and mount"
39 _scratch_mkfs > "$seqres.full" 2>&1
40 _scratch_mount
41
42 echo "Get fsmap" | tee -a $seqres.full
43 $XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full
44 $XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
45
46 echo "Check device field of FS metadata and journalling log"
47 data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
48 journal_dev=$(grep 'journalling log' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
49 test "${data_dev}" = "${journal_dev}" || echo "data ${data_dev} journal ${journal_dev}?"
50
51 # success, all done
52 status=0
53 exit