|
| 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 | + |
| 51 | +# Modify as appropriate. |
| 52 | +_supported_fs xfs |
| 53 | +_supported_os Linux |
| 54 | +_require_scratch |
| 55 | +_require_quota |
| 56 | + |
| 57 | +# need user and group named 123456-fsgqa |
| 58 | +_require_user 123456-fsgqa |
| 59 | +_require_group 123456-fsgqa |
| 60 | + |
| 61 | +_scratch_mkfs_xfs >/dev/null 2>&1 |
| 62 | +_qmount_option "uquota,gquota" |
| 63 | +_qmount |
| 64 | + |
| 65 | +# user test |
| 66 | +xfs_quota -x -c "limit -u bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT >>$seqres.full 2>&1 |
| 67 | +[ $? -ne 0 ] && _fail "Create limit for user 123456-fsgqa Failed" |
| 68 | +xfs_quota -x -c "quota -u -v 123456-fsgqa" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa |
| 69 | +[ $? -ne 0 ] && _fail "Query user 123456-fsgqa Failed" |
| 70 | +xfs_quota -x -c "report -u" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa |
| 71 | +[ $? -ne 0 ] && _fail "Report user 123456-fsgqa Failed" |
| 72 | + |
| 73 | +# group test |
| 74 | +xfs_quota -x -c "limit -g bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT >>$seqres.full 2>&1 |
| 75 | +[ $? -ne 0 ] && _fail "Create limit for group 123456-fsgqa Failed" |
| 76 | +xfs_quota -x -c "quota -g -v 123456-fsgqa" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa |
| 77 | +[ $? -ne 0 ] && _fail "Query group 123456-fsgqa Failed" |
| 78 | +xfs_quota -x -c "report -u" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa |
| 79 | +[ $? -ne 0 ] && _fail "Report group 123456-fsgqa Failed" |
| 80 | + |
| 81 | +# success, all done |
| 82 | +status=0 |
| 83 | +exit |
0 commit comments