On Tue, Mar 29, 2022 at 12:40:13AM +0200, Andrey Albershteyn wrote: > These parameters define ID range of users/groups/projects to show. > This patch adds more test for wider coverage (e.g. empty range, full > range, open range). > > Signed-off-by: Andrey Albershteyn <aalbersh@xxxxxxxxxx> > --- > > The patch has trailing whitespaces. This is due to the modification of 152.out. > The output of 'xfs_quota' is not fully cleared from trailing whitespaces. > > This is mainly regression test in relation to the patch [1]. > > [1]: https://lore.kernel.org/all/20220328222503.146496-1-aalbersh@xxxxxxxxxx/ I'd be better to add a new test for targeted regression test, otherwise a test passed previously starts to fail and might be treated as a regression. Thanks, Eryu > > --- > tests/xfs/152 | 65 +++++++--- > tests/xfs/152.out | 300 +++++++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 346 insertions(+), 19 deletions(-) > > diff --git a/tests/xfs/152 b/tests/xfs/152 > index 129d9c06..936cc3fa 100755 > --- a/tests/xfs/152 > +++ b/tests/xfs/152 > @@ -50,6 +50,9 @@ gqid=`id -g fsgqa` > uqid2=`id -u fsgqa2` > gqid2=`id -g fsgqa2` > > +[ $uqid -ge $uqid2 ] && > + _notrun "ID of fsgqa ($uqid) expected to be lower than fsgqa3 ($uqid2)" > + > pqid=10 > cat >$tmp.projects <<EOF > $pqid:$SCRATCH_MNT > @@ -102,6 +105,11 @@ filter_quot() > | sed -e '/#[0-9]*/s/#[0-9]*/#ID/g' > } > > +filter_dump() > +{ > + _filter_scratch | sed -E '/^[0-9]+/s/^[0-9]+/#ID/g' > +} > + > filter_report() > { > _filter_quota | grep -v "^root \|^\#0 " \ > @@ -122,6 +130,20 @@ filter_state() > -e '/max warnings:/d' > } > > +set_quota_limit() > +{ > + local bs=$1 > + local bh=$2 > + local is=$3 > + local ih=$4 > + local user=$5 > + > + $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \ > + -c "limit -$type bsoft=$bs bhard=$bh $user" \ > + -c "limit -$type isoft=$is ihard=$ih $user" \ > + $SCRATCH_MNT > +} > + > test_quot() > { > local opt="$*" > @@ -153,16 +175,9 @@ test_quota() > > test_limit() > { > - local bs=$1 > - local bh=$2 > - local is=$3 > - local ih=$4 > - > - echo "checking limit command (type=$type, bsoft=$bs, bhard=$bh, isoft=$is, ihard=$ih)" > - $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \ > - -c "limit -$type bsoft=$bs bhard=$bh fsgqa" \ > - -c "limit -$type isoft=$is ihard=$ih fsgqa" \ > - $SCRATCH_MNT > + echo "checking limit command (type=$type, bsoft=$1, bhard=$2,"\ > + "isoft=$3, ihard=$4)" > + set_quota_limit $@ > > # let the timer day transition happen > sleep 2 > @@ -217,11 +232,14 @@ test_state() > > test_dump() > { > + local opt="$*" > + > echo "checking dump command (type=$type)" > rm -f $tmp.backup 2>>/dev/null > $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \ > - -c "dump -$type -f $tmp.backup" \ > + -c "dump -$type $opt -f $tmp.backup" \ > $SCRATCH_MNT | _filter_scratch > + cat $tmp.backup | filter_dump > } > > test_restore() > @@ -270,14 +288,31 @@ test_xfs_quota() > echo "quota remount"; qmount_idmapped > echo ; test_quot > echo ; test_timer > - echo ; test_limit 512k 2048k 10 20 > + echo ; test_limit 512k 2048k 10 20 $id > + > + # we need two users with quota to test -L/-U options > + set_quota_limit 1024k 4096k 10 20 $id2 > + > + echo "dump options test" > echo ; test_dump > + echo "-L option"; test_dump -L $id > + echo "-U option"; test_dump -U $id > + echo "-L/-U options (one element range)"; test_dump -L $id -U $id > + echo "-L/-U options (multiple elements range)"; test_dump -L $id -U $id2 > + echo "-L/-U options (empty range)"; test_dump -L $id2 -U $id > + echo "-L/-U options (full range)"; test_dump -L 0 -U 0 > > - # report options test > echo "report options test" > echo ; test_report > echo "-N option"; test_report -N > - echo "-L -U options"; test_report -L $id -U $id > + echo "-L options"; test_report -L $id > + echo "-U options"; test_report -U $id > + echo "-L/-U options (one element range)"; test_report -L $id -U $id > + echo "-L/-U options (multiple elements range)"; test_report -L $id -U $id2 > + echo "-L/-U options (empty range)"; test_report -L $id2 -U $id > + echo "-L/-U options (full range)"; test_report -L 0 -U 0 > + # reset quotas for second user as we don't need them anymore > + set_quota_limit 0 0 0 0 $id2 > echo "-t option"; test_report -t > echo "-n option"; test_report -n > echo "-h option"; test_report -h > @@ -307,7 +342,7 @@ test_xfs_quota() > > # off and remove test > echo "off and remove test" > - echo ; test_limit 100m 100m 100 100 > + echo ; test_limit 100m 100m 100 100 $id > echo ; test_quota -N > echo ; test_off > echo ; test_state > diff --git a/tests/xfs/152.out b/tests/xfs/152.out > index b663b096..5aeed7d7 100644 > --- a/tests/xfs/152.out > +++ b/tests/xfs/152.out > @@ -11,8 +11,41 @@ SCRATCH_DEV (SCRATCH_MNT) User: > checking timer command (type=u) > > checking limit command (type=u, bsoft=512k, bhard=2048k, isoft=10, ihard=20) > +dump options test > > checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-L option > +checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-U option > +checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +-L/-U options (one element range) > +checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +-L/-U options (multiple element range) > +checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-L/-U options (empty range) > +checking dump command (type=u) > +-L/-U options (full range) > +checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > report options test > > checking report command (type=u) > @@ -21,18 +54,57 @@ User quota on SCRATCH_MNT (SCRATCH_DEV) > User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > ---------- -------------------------------------------------- -------------------------------------------------- > fsgqa 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > -N option > checking report command (type=u) > fsgqa 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > + > +-L options > +checking report command (type=u) > +User quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > --L -U options > +-U options > +checking report command (type=u) > +User quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > + > +-L/-U options (one element range) > +checking report command (type=u) > +User quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > + > +-L/-U options (multiple element range) > +checking report command (type=u) > +User quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > + > +-L/-U options (empty range) > +checking report command (type=u) > +-L/-U options (full range) > checking report command (type=u) > User quota on SCRATCH_MNT (SCRATCH_DEV) > Blocks Inodes > User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > ---------- -------------------------------------------------- -------------------------------------------------- > #ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > -t option > checking report command (type=u) > @@ -151,6 +223,7 @@ checking restore command (type=u) > > checking report command (type=u) > fsgqa 1024 512 2048 00 [7 days] 15 10 20 00 [7 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > > checking state command (type=u) > @@ -174,8 +247,41 @@ SCRATCH_DEV (SCRATCH_MNT) User: > checking timer command (type=u) > > checking limit command (type=u, bsoft=512k, bhard=2048k, isoft=10, ihard=20) > +dump options test > > checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-L option > +checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-U option > +checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +-L/-U options (one element range) > +checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +-L/-U options (multiple element range) > +checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-L/-U options (empty range) > +checking dump command (type=u) > +-L/-U options (full range) > +checking dump command (type=u) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > report options test > > checking report command (type=u) > @@ -184,18 +290,57 @@ User quota on SCRATCH_MNT (SCRATCH_DEV) > User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > ---------- -------------------------------------------------- -------------------------------------------------- > fsgqa 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > -N option > checking report command (type=u) > fsgqa 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > + > +-L options > +checking report command (type=u) > +User quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > --L -U options > +-U options > +checking report command (type=u) > +User quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > + > +-L/-U options (one element range) > +checking report command (type=u) > +User quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > + > +-L/-U options (multiple element range) > +checking report command (type=u) > +User quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > + > +-L/-U options (empty range) > +checking report command (type=u) > +-L/-U options (full range) > checking report command (type=u) > User quota on SCRATCH_MNT (SCRATCH_DEV) > Blocks Inodes > User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > ---------- -------------------------------------------------- -------------------------------------------------- > #ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > -t option > checking report command (type=u) > @@ -314,6 +459,7 @@ checking restore command (type=u) > > checking report command (type=u) > fsgqa 1024 512 2048 00 [7 days] 15 10 20 00 [7 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > > checking state command (type=u) > @@ -337,8 +483,41 @@ SCRATCH_DEV (SCRATCH_MNT) Group: > checking timer command (type=g) > > checking limit command (type=g, bsoft=512k, bhard=2048k, isoft=10, ihard=20) > +dump options test > > checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-L option > +checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-U option > +checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +-L/-U options (one element range) > +checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +-L/-U options (multiple element range) > +checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-L/-U options (empty range) > +checking dump command (type=g) > +-L/-U options (full range) > +checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > report options test > > checking report command (type=g) > @@ -347,18 +526,57 @@ Group quota on SCRATCH_MNT (SCRATCH_DEV) > Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > ---------- -------------------------------------------------- -------------------------------------------------- > fsgqa 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > -N option > checking report command (type=g) > fsgqa 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > + > +-L options > +checking report command (type=g) > +Group quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > --L -U options > +-U options > +checking report command (type=g) > +Group quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > + > +-L/-U options (one element range) > +checking report command (type=g) > +Group quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > + > +-L/-U options (multiple element range) > +checking report command (type=g) > +Group quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > + > +-L/-U options (empty range) > +checking report command (type=g) > +-L/-U options (full range) > checking report command (type=g) > Group quota on SCRATCH_MNT (SCRATCH_DEV) > Blocks Inodes > Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > ---------- -------------------------------------------------- -------------------------------------------------- > #ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > -t option > checking report command (type=g) > @@ -477,6 +695,7 @@ checking restore command (type=g) > > checking report command (type=g) > fsgqa 1024 512 2048 00 [7 days] 15 10 20 00 [7 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > > checking state command (type=g) > @@ -500,8 +719,41 @@ SCRATCH_DEV (SCRATCH_MNT) Group: > checking timer command (type=g) > > checking limit command (type=g, bsoft=512k, bhard=2048k, isoft=10, ihard=20) > +dump options test > > checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-L option > +checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-U option > +checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +-L/-U options (one element range) > +checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +-L/-U options (multiple element range) > +checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > +-L/-U options (empty range) > +checking dump command (type=g) > +-L/-U options (full range) > +checking dump command (type=g) > +fs = SCRATCH_DEV > +#ID 1024 4096 10 20 > +fs = SCRATCH_DEV > +#ID 2048 8192 10 20 > report options test > > checking report command (type=g) > @@ -510,18 +762,57 @@ Group quota on SCRATCH_MNT (SCRATCH_DEV) > Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > ---------- -------------------------------------------------- -------------------------------------------------- > fsgqa 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > -N option > checking report command (type=g) > fsgqa 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > + > +-L options > +checking report command (type=g) > +Group quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > --L -U options > +-U options > +checking report command (type=g) > +Group quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > + > +-L/-U options (one element range) > +checking report command (type=g) > +Group quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > + > +-L/-U options (multiple element range) > +checking report command (type=g) > +Group quota on SCRATCH_MNT (SCRATCH_DEV) > + Blocks Inodes > +Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > +---------- -------------------------------------------------- -------------------------------------------------- > +#ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > + > +-L/-U options (empty range) > +checking report command (type=g) > +-L/-U options (full range) > checking report command (type=g) > Group quota on SCRATCH_MNT (SCRATCH_DEV) > Blocks Inodes > Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace > ---------- -------------------------------------------------- -------------------------------------------------- > #ID 1024 512 2048 00 [3 days] 15 10 20 00 [3 days] > +#ID 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > -t option > checking report command (type=g) > @@ -640,6 +931,7 @@ checking restore command (type=g) > > checking report command (type=g) > fsgqa 1024 512 2048 00 [7 days] 15 10 20 00 [7 days] > +fsgqa2 0 1024 4096 00 [--------] 0 10 20 00 [--------] > > > checking state command (type=g) > -- > 2.27.0