overlay: run unionmount testsuite test cases
[xfstests-dev.git] / tests / xfs / 450
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc.  All rights reserved.
4 #
5 # FS QA Test No. 450
6 #
7 # Make sure that the statfs b_avail counter doesn't change across remount
8 # after the rmapbt has grown in size.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # remove previous \$seqres.full before test
30 rm -f $seqres.full
31
32 # real QA test starts here
33 _supported_os Linux
34 _supported_fs xfs
35 _require_xfs_io_command "falloc"
36 _require_test_program "punch-alternating"
37 _require_xfs_scratch_rmapbt
38
39 _scratch_mkfs >> $seqres.full
40 _scratch_mount
41
42 # Make sure we allocate a big enough file such that punching out every other
43 # block will cause the rmapbt to expand by at least one block.
44 blksz=$(_get_file_block_size $SCRATCH_MNT)
45 nr_rmap_per_rmapbt=$(( (blksz - 56) / 24))
46 blks=$(( (nr_rmap_per_rmapbt + 2) * 2))
47 $XFS_IO_PROG -f -c "falloc 0 $((blks * blksz))" $SCRATCH_MNT/a >> $seqres.full
48 $here/src/punch-alternating $SCRATCH_MNT/a
49
50 # Do the stat counters change across the remount?
51 before=$(stat -f -c '%b %f' $SCRATCH_MNT)
52 _scratch_cycle_mount
53 after=$(stat -f -c '%b %f' $SCRATCH_MNT)
54
55 if [ "${before}" != "${after}" ]; then
56         echo "counters changed: ${before} ${after}"
57         echo "before: ${before}" >> $seqres.full
58         echo "after: ${after}" >> $seqres.full
59 fi
60
61 echo "Silence is golden."
62
63 # success, all done
64 status=0
65 exit