2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2010 Arkadiusz MiĆkiewicz. All Rights Reserved.
7 # test to verify that proper project quota id is correctly set
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
18 # get standard environment, filters and checks
26 _scratch_unmount 2>/dev/null
30 # real QA test starts here
37 export MOUNT_OPTIONS="-opquota"
40 # make fs with no projid32bit
41 _scratch_mkfs_xfs -i projid32bit=0 >> $seqres.full || _fail "mkfs failed"
43 # make sure project quota is supported
44 _require_prjquota ${SCRATCH_DEV}
46 dir=$SCRATCH_MNT/project
50 echo "Silence is golden"
52 # Do testing on filesystem with projid32bit feature disabled
57 $XFS_QUOTA_PROG -x -c "project -s -p $dir/below16bit 3422" $SCRATCH_DEV \
59 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/below16bit)
60 if [ "projid = 3422" != "$projid" ]; then
61 echo "FAIL: projid32bit disabled: returned projid value ($projid)"
62 echo " doesn't match set one (projid = 3422)"
66 # 32bit value, should fail
68 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over16bit 108545" $SCRATCH_DEV \
69 >> $seqres.full 2>&1; then
70 echo "FAIL: projid32bit disabled: setting 32bit projid succeeded"
71 echo " while it should fail"
75 # over 32bit value, should fail
77 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over32bit 5344967296" $SCRATCH_DEV >> $seqres.full 2>&1; then
78 echo "FAIL: projid32bit disabled: setting over 32bit projid succeeded"
79 echo " while it should fail"
83 # Do testing on filesystem with projid32bit feature enabled
84 _scratch_unmount 2>/dev/null
85 _scratch_mkfs_xfs -i projid32bit=1 >> $seqres.full || _fail "mkfs failed"
90 # below 16bit value, should succeed
91 $XFS_QUOTA_PROG -x -c "project -s -p $dir/below16bit 3422" $SCRATCH_DEV \
93 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/below16bit)
94 if [ "projid = 3422" != "$projid" ]; then
95 echo "FAIL: projid32bit enabled: returned projid value ($projid)"
96 echo " doesn't match set one (projid = 3422)"
100 # 32bit value, should succeed
102 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over16bit 108545" $SCRATCH_DEV \
103 >> $seqres.full 2>&1; then
104 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/over16bit)
105 if [ "projid = 108545" != "$projid" ]; then
106 echo "FAIL: projid32bit enabled: returned projid value ($projid)"
107 echo " doesn't match set one (projid = 108545)"
111 echo "FAIL: projid32bit enabled: setting 32bit projid failed"
112 echo " while it should succeed"
116 # over 32bit value, should fail
118 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over32bit 5344967296" $SCRATCH_DEV \
119 >> $seqres.full 2>&1; then
120 echo "FAIL: projid32bit enabled: setting over 32bit projid succeeded"
121 echo " while it should fail"