xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / generic / 382
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test 382
6 #
7 # When default quota is set, all different quota types inherits the
8 # same default value, include group quota. So if a user quota limit
9 # larger than the default user quota value, it will still be limited
10 # by the group default quota value.
11 #
12 # There's a patch from Upstream can fix this bug:
13 #
14 #    [PATCH] xfs: Split default quota limits by quota type V4
15 #
16 seq=`basename $0`
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
19
20 here=`pwd`
21 tmp=/tmp/$$
22 status=1        # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
24
25 _cleanup()
26 {
27         cd /
28         rm -f $tmp.*
29 }
30
31 # get standard environment, filters and checks
32 . ./common/rc
33 . ./common/filter
34 . ./common/quota
35
36 # remove previous $seqres.full before test
37 rm -f $seqres.full
38
39 # real QA test starts here
40 _supported_fs generic
41 _supported_os Linux
42 _require_scratch
43 _require_quota
44 _require_xfs_quota_foreign
45 _require_user
46 _require_group
47
48 do_test()
49 {
50         local qname=$1
51         local type
52
53         if [ "$qname" = "user" ];then
54                 type="-u"
55                 echo "=== user quota test ==="
56         elif [ "$qname" = "group" ];then
57                 type="-g"
58                 echo "=== group quota test ==="
59         else
60                 echo "wrong quota type name - $qname"
61                 return 1
62         fi
63
64         $XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
65         $XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
66         echo "$qname blocks and inode limit"
67         $XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
68
69         ## blocks default quota test ##
70         _user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
71
72         rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
73
74         ## inode default quota test ##
75         for ((i=0; i<30; i++));do
76                 _user_do "echo -n > ${SCRATCH_MNT}/file${i}"
77         done
78         sync
79
80         rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
81 }
82
83 ### user default quota test ###
84 _scratch_mkfs >/dev/null 2>&1
85 _qmount_option "usrquota,grpquota"
86 _qmount
87
88 do_test user
89
90 ### group default quota test ###
91 _scratch_unmount
92 _scratch_mkfs >/dev/null 2>&1
93 _qmount_option "grpquota,usrquota"
94 _qmount
95
96 do_test group
97
98 # success, all done
99 status=0
100 exit