From: Dave Chinner <dchinner@xxxxxxxxxx> Tests that treat them as exclusively owned end up tripping over other tests that do the same. Fix this by using append and filter techniques to update the files, then using different project quota ids for each test. Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> --- common/quota | 35 +++++++---------------------------- tests/generic/603 | 8 +++++--- tests/generic/691 | 6 ++++-- 3 files changed, 16 insertions(+), 33 deletions(-) diff --git a/common/quota b/common/quota index e87489192..8135b7c04 100644 --- a/common/quota +++ b/common/quota @@ -274,7 +274,7 @@ _choose_prid() _qmount() { - _scratch_unmount >/dev/null 2>&1 + _scratch_unmount _try_scratch_mount || _fail "qmount failed" # xfs doesn't need these setups and quotacheck even fails on xfs # redirect the output to $seqres.full for debug purpose and ignore results @@ -432,39 +432,18 @@ _create_project_quota() mkdir $prjdir chmod ugo+rwx $prjdir - if [ -f /etc/projects -a ! -f $tmp.projects.bk ];then - cat /etc/projects > $tmp.projects.bk - echo >/etc/projects - fi - if [ -f /etc/projid -a ! -f $tmp.projid.bk ];then - cat /etc/projid > $tmp.projid.bk - echo >/etc/projid - fi - - cat >>/etc/projects <<EOF -$id:$prjdir -EOF - cat >>/etc/projid <<EOF -$name:$id -EOF + echo "$id:$prjdir" >> /etc/project + echo "$name:$id" >> /etc/projid $XFS_IO_PROG -r -c "chproj $id" -c "chattr +P" $prjdir } # If you've called _create_project_quota, then use this function in _cleanup _restore_project_quota() { - if [ -f $tmp.projects.bk ];then - cat $tmp.projects.bk > /etc/projects && \ - rm -f $tmp.projects.bk - else - rm -f /etc/projects - fi - if [ -f $tmp.projid.bk ];then - cat $tmp.projid.bk > /etc/projid && \ - rm -f $tmp.projid.bk - else - rm -f /etc/projid - fi + local id=$1 + + sed -i "/^$id:/d" /etc/project + sed -i "/:$id$/d" /etc/projid } # make sure this script returns success diff --git a/tests/generic/603 b/tests/generic/603 index 32dcaeb94..a84695831 100755 --- a/tests/generic/603 +++ b/tests/generic/603 @@ -10,10 +10,12 @@ . ./common/preamble _begin_fstest auto quick quota +projid=$seq + # Override the default cleanup function. _cleanup() { - _restore_project_quota + _restore_project_quota $projid cd / rm -f $tmp.* } @@ -122,8 +124,8 @@ _require_prjquota $SCRATCH_DEV BLOCK_SIZE=$(_get_file_block_size $SCRATCH_MNT) rm -rf $SCRATCH_MNT/t mkdir $SCRATCH_MNT/t -$XFS_IO_PROG -r -c "chproj 100" -c "chattr +P" $SCRATCH_MNT/t -_create_project_quota $SCRATCH_MNT/t 100 $qa_user +$XFS_IO_PROG -r -c "chproj $projid" -c "chattr +P" $SCRATCH_MNT/t +_create_project_quota $SCRATCH_MNT/t $projid $qa_user echo "### Set up different grace timers to each type of quota" UBGRACE=12 diff --git a/tests/generic/691 b/tests/generic/691 index 25ce92bc4..f33d6edf1 100755 --- a/tests/generic/691 +++ b/tests/generic/691 @@ -16,10 +16,12 @@ . ./common/preamble _begin_fstest auto quota +projid=$seq + # Override the default cleanup function. _cleanup() { - _restore_project_quota + _restore_project_quota $projid cd / rm -r -f $tmp.* } @@ -65,7 +67,7 @@ exercise() fi _qmount if [ "$type" = "P" ];then - _create_project_quota $SCRATCH_MNT/t 100 $qa_user + _create_project_quota $SCRATCH_MNT/t $projid $qa_user file=$SCRATCH_MNT/t/testfile fi -- 2.45.2