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 _begin_fstest auto quota quick
12 # Import common functions.
16 # Override the default cleanup function.
20 _scratch_unmount 2>/dev/null
24 # real QA test starts here
31 export MOUNT_OPTIONS="-opquota"
33 # make fs with no projid32bit
34 _scratch_mkfs_xfs -i projid32bit=0 >> $seqres.full || _fail "mkfs failed"
36 # make sure project quota is supported
37 _require_prjquota ${SCRATCH_DEV}
39 dir=$SCRATCH_MNT/project
43 echo "Silence is golden"
45 # Do testing on filesystem with projid32bit feature disabled
50 $XFS_QUOTA_PROG -x -c "project -s -p $dir/below16bit 3422" $SCRATCH_DEV \
52 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/below16bit)
53 if [ "projid = 3422" != "$projid" ]; then
54 echo "FAIL: projid32bit disabled: returned projid value ($projid)"
55 echo " doesn't match set one (projid = 3422)"
59 # 32bit value, should fail
61 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over16bit 108545" $SCRATCH_DEV \
62 >> $seqres.full 2>&1; then
63 echo "FAIL: projid32bit disabled: setting 32bit projid succeeded"
64 echo " while it should fail"
68 # over 32bit value, should fail
70 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over32bit 5344967296" $SCRATCH_DEV >> $seqres.full 2>&1; then
71 echo "FAIL: projid32bit disabled: setting over 32bit projid succeeded"
72 echo " while it should fail"
76 # Do testing on filesystem with projid32bit feature enabled
77 _scratch_unmount 2>/dev/null
78 _scratch_mkfs_xfs -i projid32bit=1 >> $seqres.full || _fail "mkfs failed"
83 # below 16bit value, should succeed
84 $XFS_QUOTA_PROG -x -c "project -s -p $dir/below16bit 3422" $SCRATCH_DEV \
86 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/below16bit)
87 if [ "projid = 3422" != "$projid" ]; then
88 echo "FAIL: projid32bit enabled: returned projid value ($projid)"
89 echo " doesn't match set one (projid = 3422)"
93 # 32bit value, should succeed
95 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over16bit 108545" $SCRATCH_DEV \
96 >> $seqres.full 2>&1; then
97 projid=$($XFS_IO_PROG -r -c "lsproj" $dir/over16bit)
98 if [ "projid = 108545" != "$projid" ]; then
99 echo "FAIL: projid32bit enabled: returned projid value ($projid)"
100 echo " doesn't match set one (projid = 108545)"
104 echo "FAIL: projid32bit enabled: setting 32bit projid failed"
105 echo " while it should succeed"
109 # over 32bit value, should fail
111 if $XFS_QUOTA_PROG -x -c "project -s -p $dir/over32bit 5344967296" $SCRATCH_DEV \
112 >> $seqres.full 2>&1; then
113 echo "FAIL: projid32bit enabled: setting over 32bit projid succeeded"
114 echo " while it should fail"