xfs/029: filter out "extended-header: cycle: 1" from output
[xfstests-dev.git] / tests / xfs / 511
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2019 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 511
6 #
7 # Test statfs when project quota is set.
8 # Uncover de7243057 fs/xfs: fix f_ffree value for statfs when project quota is set
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         _scratch_unmount
23         rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29 . ./common/quota
30
31 # remove previous $seqres.full before test
32 rm -f $seqres.full
33
34 # real QA test starts here
35 _supported_fs xfs
36 _supported_os Linux
37 _require_scratch
38 _require_xfs_quota
39
40 _scratch_mkfs >/dev/null 2>&1
41 _scratch_enable_pquota
42 _qmount_option "prjquota"
43 _qmount
44 _require_prjquota $SCRATCH_DEV
45
46 # Create a directory to be project object, and create a file to take 64k space
47 mkdir $SCRATCH_MNT/t
48 $XFS_IO_PROG -f -c "pwrite 0 65536" -c sync $SCRATCH_MNT/t/file >>$seqres.full
49
50 quota_cmd="$XFS_QUOTA_PROG -x"
51 $quota_cmd -c "project -s -p $SCRATCH_MNT/t 42" $SCRATCH_MNT >/dev/null 2>&1
52 $quota_cmd -c 'limit -p isoft=53 bsoft=100m 42' $SCRATCH_MNT
53
54 # The itotal and size should be 53 and 102400(k), as above project quota limit.
55 # The isued and used should be 2 and 64(k), as this case takes.
56 df -k --output=file,itotal,iused,size,used $SCRATCH_MNT/t | \
57         _filter_scratch | _filter_spaces
58
59 # success, all done
60 status=0
61 exit