2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
7 # test xfs_quota state command
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
29 # remove previous $seqres.full before test
32 # real QA test starts here
34 # Modify as appropriate.
40 # We could test older, non-project capable kernels but keep it simpler;
41 # Only test crc and beyond (but we will test with and without the feature)
47 function option_string()
50 # Treat 3 options as a bit field, prjquota|grpquota|usrquota
52 if [ "$((VAL & 4))" -ne "0" ]; then OPT=prjquota,${OPT}; fi;
53 if [ "$((VAL & 2))" -ne "0" ]; then OPT=grpquota,${OPT}; fi;
54 if [ "$((VAL & 1))" -ne "0" ]; then OPT=usrquota,${OPT}; fi;
58 filter_quota_state() {
59 sed -e 's/Inode: #[0-9]\+/Inode #XXX/g' \
60 -e '/max warnings:/d' \
61 -e '/Blocks grace time:/d' \
62 -e '/Inodes grace time:/d' \
66 filter_quota_state2() {
67 sed -e '/User quota state on/d' \
68 -e '/ Accounting: /d' \
69 -e '/ Enforcement: /d' \
71 -e '/Blocks max warnings: /d' \
72 -e '/Inodes max warnings: /d' \
76 function test_all_state()
78 for I in `seq 0 7`; do
79 OPTIONS=`option_string $I`
80 echo "== Options: $OPTIONS =="
81 # Some combinations won't mount on V4 supers (grp + prj)
82 _qmount_option "$OPTIONS"
83 _try_scratch_mount &>> $seqres.full || continue
84 $XFS_QUOTA_PROG -x -c "state -u" $SCRATCH_MNT | filter_quota_state
85 $XFS_QUOTA_PROG -x -c "state -g" $SCRATCH_MNT | filter_quota_state
86 $XFS_QUOTA_PROG -x -c "state -p" $SCRATCH_MNT | filter_quota_state
87 $XFS_QUOTA_PROG -x -c "state -u" $SCRATCH_MNT | filter_quota_state2
92 echo "==== NO CRC ===="
93 # Control size to control inode numbers
94 _scratch_mkfs_xfs "-m crc=0 -n ftype=0 -d size=512m" >> $seqres.full
98 _scratch_mkfs_xfs "-m crc=1 -d size=512m" >>$seqres.full