4 # test to verify that proper project quota id is correctly set
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2010 Arkadiusz MiĆkiewicz. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 seqres=$RESULT_DIR/$seq
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
44 umount $SCRATCH_MNT 2>/dev/null
48 # real QA test starts here
54 export MOUNT_OPTIONS="-opquota"
56 # make fs with no projid32bit
57 _scratch_mkfs_xfs -i projid32bit=0 >> $seqres.full || _fail "mkfs failed"
59 # make sure project quota is supported
60 _require_prjquota ${SCRATCH_DEV}
62 dir=$SCRATCH_MNT/project
66 echo "Silence is golden"
68 # Do testing on filesystem with projid32bit feature disabled
73 $XFS_QUOTA_PROG -x -c "project -s -p $dir/below16bit 3422" $SCRATCH_DEV \
75 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/below16bit)
76 if [ "projid = 3422" != "$projid" ]; then
77 echo "FAIL: projid32bit disabled: returned projid value ($projid)"
78 echo " doesn't match set one (projid = 3422)"
82 # 32bit value, should fail
84 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over16bit 108545" $SCRATCH_DEV \
85 >> $seqres.full 2>&1; then
86 echo "FAIL: projid32bit disabled: setting 32bit projid succeeded"
87 echo " while it should fail"
91 # over 32bit value, should fail
93 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over32bit 5344967296" $SCRATCH_DEV >> $seqres.full 2>&1; then
94 echo "FAIL: projid32bit disabled: setting over 32bit projid succeeded"
95 echo " while it should fail"
99 # Do testing on filesystem with projid32bit feature enabled
100 umount $SCRATCH_DEV 2>/dev/null
101 _scratch_mkfs_xfs -i projid32bit=1 >> $seqres.full || _fail "mkfs failed"
105 touch $dir/below16bit
106 # below 16bit value, should succeed
107 $XFS_QUOTA_PROG -x -c "project -s -p $dir/below16bit 3422" $SCRATCH_DEV \
109 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/below16bit)
110 if [ "projid = 3422" != "$projid" ]; then
111 echo "FAIL: projid32bit enabled: returned projid value ($projid)"
112 echo " doesn't match set one (projid = 3422)"
116 # 32bit value, should succeed
118 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over16bit 108545" $SCRATCH_DEV \
119 >> $seqres.full 2>&1; then
120 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/over16bit)
121 if [ "projid = 108545" != "$projid" ]; then
122 echo "FAIL: projid32bit enabled: returned projid value ($projid)"
123 echo " doesn't match set one (projid = 108545)"
127 echo "FAIL: projid32bit enabled: setting 32bit projid failed"
128 echo " while it should succeed"
132 # over 32bit value, should fail
134 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over32bit 5344967296" $SCRATCH_DEV \
135 >> $seqres.full 2>&1; then
136 echo "FAIL: projid32bit enabled: setting over 32bit projid succeeded"
137 echo " while it should fail"