generic: test adding filesystem-level fscrypt key via key_id
[xfstests-dev.git] / tests / generic / 381
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
4 #
5 # FS QA Test 381
6 #
7 # Test xfs_quota when user or names beginning with digits.
8 # For example, create a 'limit' for a user or group named
9 # '12345678-abcd', then query this user and group.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22         cd /
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 generic
36 _supported_os Linux
37 _require_scratch
38 _require_quota
39 _require_xfs_quota_foreign
40
41 # need user and group named 123456-fsgqa
42 _require_user 123456-fsgqa
43 _require_group 123456-fsgqa
44
45 _scratch_mkfs >/dev/null 2>&1
46 _qmount_option "usrquota,grpquota"
47 _qmount
48
49 # user test
50 echo "== user test =="
51 $XFS_QUOTA_PROG -x -c "limit -u bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT
52 echo "=== quota command output ==="
53 $XFS_QUOTA_PROG -c "quota -u -b -N -v 123456-fsgqa" $SCRATCH_MNT | _filter_quota
54 echo "=== report command output ==="
55 $XFS_QUOTA_PROG -x -c "report -u -b -N" $SCRATCH_MNT | grep -v "^root " | _filter_quota
56
57 # group test
58 echo "== group test =="
59 $XFS_QUOTA_PROG -x -c "limit -g bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT
60 echo "=== quota command output ==="
61 $XFS_QUOTA_PROG -c "quota -g -b -N -v 123456-fsgqa" $SCRATCH_MNT | _filter_quota
62 echo "=== report command output ==="
63 $XFS_QUOTA_PROG -x -c "report -u -b -N" $SCRATCH_MNT | grep -v "^root " | _filter_quota
64
65 # success, all done
66 status=0
67 exit