fstests: move now-generic quota tests to generic
[xfstests-dev.git] / tests / generic / 381
1 #! /bin/bash
2 # FS QA Test 138
3 #
4 # Test xfs_quota when user or names beginning with digits.
5 # For example, create a 'limit' for a user or group named
6 # '12345678-abcd', then query this user and group.
7 #
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
10 #
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
14 #
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23 #-----------------------------------------------------------------------
24 #
25
26 seq=`basename $0`
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
29
30 here=`pwd`
31 tmp=/tmp/$$
32 status=1        # failure is the default!
33 trap "_cleanup; exit \$status" 0 1 2 3 15
34
35 _cleanup()
36 {
37         cd /
38         rm -f $tmp.*
39 }
40
41 # get standard environment, filters and checks
42 . ./common/rc
43 . ./common/filter
44 . ./common/quota
45
46 # remove previous $seqres.full before test
47 rm -f $seqres.full
48
49 # real QA test starts here
50 _supported_fs generic
51 _supported_os Linux
52 _require_scratch
53 _require_quota
54 _require_xfs_quota_foreign
55
56 # need user and group named 123456-fsgqa
57 _require_user 123456-fsgqa
58 _require_group 123456-fsgqa
59
60 _scratch_mkfs >/dev/null 2>&1
61 _qmount_option "usrquota,grpquota"
62 _qmount
63
64 # user test
65 echo "== user test =="
66 $XFS_QUOTA_PROG -x -c "limit -u bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT
67 echo "=== quota command output ==="
68 $XFS_QUOTA_PROG -c "quota -u -b -N -v 123456-fsgqa" $SCRATCH_MNT | _filter_quota
69 echo "=== report command output ==="
70 $XFS_QUOTA_PROG -x -c "report -u -b -N" $SCRATCH_MNT | grep -v "^root " | _filter_quota
71
72 # group test
73 echo "== group test =="
74 $XFS_QUOTA_PROG -x -c "limit -g bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT
75 echo "=== quota command output ==="
76 $XFS_QUOTA_PROG -c "quota -g -b -N -v 123456-fsgqa" $SCRATCH_MNT | _filter_quota
77 echo "=== report command output ==="
78 $XFS_QUOTA_PROG -x -c "report -u -b -N" $SCRATCH_MNT | grep -v "^root " | _filter_quota
79
80 # success, all done
81 status=0
82 exit