]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs/133-4: filter redundant projid 0 quota report info out
authorZorro Lang <zlang@redhat.com>
Thu, 12 May 2016 02:55:19 +0000 (10:55 +0800)
committerEryu Guan <eguan@redhat.com>
Wed, 15 Jun 2016 07:06:57 +0000 (15:06 +0800)
After GETNEXTQUOTA ioctl being supported, xfs_quota -c "report"
always outputs one more quota line about default quota (as project
ID 0). In order to fix this problem, xfsprogs has merged commit
3d607a1.

Now xfstests face this same problem from this issue. xfs/133 and
xfs/134 can't match their golden output, due to this one more line
quota report output. So this patch filters this redundant quota info
out.

There're 3 kinds of xfsprogs:
1. not support GETNEXTQUOTA
2. support GETNEXTQUOTA but not merged commit 3d607a1
3. the latest version supports all

The 1st one won't report Project ID 0, the 2nd will report projid 0
info as "(null) 0 0 0 ...", the 3rd will report projid 0 info as
"#0 0 0 0 ...". To deal with all of these situations, we will use

  _filter_quota | grep -v "^#0 \|^(null) "

But if someone specifies a name for projid 0, e.g.
  # cat $projid_file
  # root:0

I think that means someone wants to deal with it by himself, the
common filter won't filter it out.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
common/filter
tests/xfs/133
tests/xfs/134

index 1be377c06392ac3941b59ddbdf0c2f673f3e4bd3..244621a039610900c9fc8140a020988ce06f60c1 100644 (file)
@@ -302,6 +302,15 @@ _filter_quota()
        sed -e 'N;s/TEST_DEV\n/TEST_DEV/g'
 }
 
+_filter_project_quota()
+{
+       # Project ID 0 is always present on disk but was not reported
+       # until the GETNEXTQUOTA ioctl came into use.  Filter it out.
+       # But if you specify a name for ID 0, that means you want to
+       # deal with it by yourself, this function won't filter it out.
+       _filter_quota | grep -v "^\#0 \|^(null) "
+}
+
 # Account for different "ln" failure messages
 _filter_ln()
 {
index 82c38b1730da252e726acbb94203ed48153a362f..f77bc794cac33cb39ea88ea7d7979c7dd93b4a3d 100755 (executable)
@@ -81,7 +81,7 @@ EOF
 
        echo "=== report command output ==="
        $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-               -c "report -p -N -b" $SCRATCH_MNT | _filter_quota
+               -c "report -p -N -b" $SCRATCH_MNT | _filter_project_quota
 }
 
 # Test project
index be18ee844f84195d316457ed8af1a2fa5e0d77d1..cd470691c307d8185b4ba68528e52dd8b5adeeab 100755 (executable)
@@ -87,17 +87,24 @@ fi
 src/feature -p $SCRATCH_DEV
 [ $? -ne 0 ] && _notrun "Installed kernel does not support project quotas"
 
+report_quota()
+{
+    $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
+                   -c "repquota -inN -p" $SCRATCH_DEV | \
+                   tr -s '[:space:]' | _filter_project_quota
+}
+
 mkdir $dir
 $XFS_IO_PROG -r -c "chproj -R 1" -c "chattr -R +P" $dir
 
-xfs_quota -D $tmp.projects -P $tmp.projid -x \
+$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
     -c "limit -p bsoft=100m bhard=100m 1" $SCRATCH_DEV
-xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
+report_quota
+
 touch $dir/1
 touch $dir/2
 cp $dir/2 $dir/3
-
-xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
+report_quota
 
 if [ "$HOSTOS" == "IRIX" ] ; then
     mkfile 1M $TEST_DIR/6
@@ -107,12 +114,11 @@ fi
 
 #try cp to dir
 cp $TEST_DIR/6 $dir/6
-xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
+report_quota
 
 #try mv to dir
 mv $TEST_DIR/6 $dir/7
-
-xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
+report_quota
 
 # success, all done
 status=0