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 #-----------------------------------------------------------------------
28 echo "QA output created by $seq"
32 status=1 # failure is the default!
33 trap "_cleanup; exit \$status" 0 1 2 3 15
35 # get standard environment, filters and checks
43 umount $SCRATCH_MNT 2>/dev/null
47 # real QA test starts here
52 export MOUNT_OPTIONS="-opquota"
54 # make fs with no projid32bit
55 _scratch_mkfs_xfs -i projid32bit=0 >> $seq.full || _fail "mkfs failed"
57 # make sure project quota is supported
58 _require_prjquota ${SCRATCH_DEV}
60 dir=$SCRATCH_MNT/project
64 echo "Silence is golden"
66 # Do testing on filesystem with projid32bit feature disabled
71 $XFS_QUOTA_PROG -x -c "project -s -p $dir/below16bit 3422" $SCRATCH_DEV \
73 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/below16bit)
74 if [ "projid = 3422" != "$projid" ]; then
75 echo "FAIL: projid32bit disabled: returned projid value ($projid)"
76 echo " doesn't match set one (projid = 3422)"
80 # 32bit value, should fail
82 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over16bit 108545" $SCRATCH_DEV \
83 >> $seq.full 2>&1; then
84 echo "FAIL: projid32bit disabled: setting 32bit projid succeeded"
85 echo " while it should fail"
89 # over 32bit value, should fail
91 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over32bit 5344967296" $SCRATCH_DEV >> $seq.full 2>&1; then
92 echo "FAIL: projid32bit disabled: setting over 32bit projid succeeded"
93 echo " while it should fail"
97 # Do testing on filesystem with projid32bit feature enabled
98 umount $SCRATCH_DEV 2>/dev/null
99 _scratch_mkfs_xfs -i projid32bit=1 >> $seq.full || _fail "mkfs failed"
103 touch $dir/below16bit
104 # below 16bit value, should succeed
105 $XFS_QUOTA_PROG -x -c "project -s -p $dir/below16bit 3422" $SCRATCH_DEV \
107 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/below16bit)
108 if [ "projid = 3422" != "$projid" ]; then
109 echo "FAIL: projid32bit enabled: returned projid value ($projid)"
110 echo " doesn't match set one (projid = 3422)"
114 # 32bit value, should succeed
116 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over16bit 108545" $SCRATCH_DEV \
117 >> $seq.full 2>&1; then
118 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/over16bit)
119 if [ "projid = 108545" != "$projid" ]; then
120 echo "FAIL: projid32bit enabled: returned projid value ($projid)"
121 echo " doesn't match set one (projid = 108545)"
125 echo "FAIL: projid32bit enabled: setting 32bit projid failed"
126 echo " while it should succeed"
130 # over 32bit value, should fail
132 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over32bit 5344967296" $SCRATCH_DEV \
133 >> $seq.full 2>&1; then
134 echo "FAIL: projid32bit enabled: setting over 32bit projid succeeded"
135 echo " while it should fail"