xfs/530: skip test if user MKFS_OPTIONS screw up formatting
[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 . ./common/preamble
11 _begin_fstest auto quick quota
12
13 # Override the default cleanup function.
14 _cleanup()
15 {
16         cd /
17         _scratch_unmount
18         rm -f $tmp.*
19 }
20
21 # Import common functions.
22 . ./common/filter
23 . ./common/quota
24
25 # real QA test starts here
26 _supported_fs xfs
27 _require_scratch
28 _require_xfs_quota
29
30 _scratch_mkfs >/dev/null 2>&1
31 _scratch_enable_pquota
32 _qmount_option "prjquota"
33 _qmount
34 _require_prjquota $SCRATCH_DEV
35
36 # Create a directory to be project object, and create a file to take 64k space
37 mkdir $SCRATCH_MNT/t
38 $XFS_IO_PROG -f -c "pwrite 0 65536" -c sync $SCRATCH_MNT/t/file >>$seqres.full
39
40 quota_cmd="$XFS_QUOTA_PROG -x"
41 $quota_cmd -c "project -s -p $SCRATCH_MNT/t 42" $SCRATCH_MNT >/dev/null 2>&1
42 $quota_cmd -c 'limit -p isoft=53 bsoft=100m 42' $SCRATCH_MNT
43
44 # The itotal and size should be 53 and 102400(k), as above project quota limit.
45 # The isued and used should be 2 and 64(k), as this case takes.
46 df -k --output=file,itotal,iused,size,used $SCRATCH_MNT/t | \
47         _filter_scratch | _filter_spaces
48
49 # success, all done
50 status=0
51 exit