xfs: change return value check to golden image check
authorZorro Lang <zlang@redhat.com>
Thu, 18 Feb 2016 23:41:49 +0000 (10:41 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 18 Feb 2016 23:41:49 +0000 (10:41 +1100)
xfs/133 and xfs/138 use too much code to do "return value" check,
it's not necessary. For the code can be more readable and clear,
I change "return value" check to golden image check.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
tests/xfs/133
tests/xfs/133.out
tests/xfs/138
tests/xfs/138.out

index 330221f0a90420bb85c489158c6bdb1a98f66226..82c38b1730da252e726acbb94203ed48153a362f 100755 (executable)
@@ -46,8 +46,6 @@ _cleanup()
 rm -f $seqres.full
 
 # real QA test starts here
-
-# Modify as appropriate.
 _supported_fs xfs
 _supported_os Linux
 _require_scratch
@@ -72,22 +70,18 @@ $qa_project:10
 EOF
 
        $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-               -c "project -s $qa_project" $SCRATCH_MNT >>$seqres.full 2>&1
-       [ $? -ne 0 ] && _fail "Initalize project=$qa_project Failed"
+               -c "project -s $qa_project" $SCRATCH_MNT > /dev/null
 
        $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-               -c "limit -p bsoft=100m bhard=200m $qa_project" $SCRATCH_MNT >>$seqres.full 2>&1
-       [ $? -ne 0 ] && _fail "Create limit for project=$qa_project Failed"
+               -c "limit -p bsoft=100m bhard=200m $qa_project" $SCRATCH_MNT
 
-       $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-               -c "quota -p -v $qa_project" $SCRATCH_MNT 2>>$seqres.full | grep -qw $qa_project
-       [ $? -ne 0 ] && _fail "Query project=$qa_project Failed"
+       echo "=== quota command output ==="
+       $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid \
+               -c "quota -p -v -b $qa_project" $SCRATCH_MNT | _filter_quota
 
+       echo "=== report command output ==="
        $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-               -c "report -p" $SCRATCH_MNT 2>>$seqres.full | grep -qw $qa_project
-       [ $? -ne 0 ] && _fail "Report project=$qa_project Failed"
-
-       return 0
+               -c "report -p -N -b" $SCRATCH_MNT | _filter_quota
 }
 
 # Test project
index 189cb693a1321f4c8a044cc039507249403f91a0..21cfd0db68128244dd54f0cd8ae0ccfe9816ecfe 100644 (file)
@@ -1 +1,8 @@
 QA output created by 133
+=== quota command output ===
+Disk quotas for Project 123456-project (10)
+Filesystem Blocks Quota Limit Warn/Time Mounted on
+SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
+=== report command output ===
+123456-project 0 102400 204800 00 [--------]
+
index 6b17608d6ae2a72c66abe5b63ecadefe6b6b536b..c6a6f50354c554c4af80a33518a271b5f85c6b8d 100755 (executable)
@@ -47,8 +47,6 @@ _cleanup()
 rm -f $seqres.full
 
 # real QA test starts here
-
-# Modify as appropriate.
 _supported_fs xfs
 _supported_os Linux
 _require_scratch
@@ -63,20 +61,20 @@ _qmount_option "uquota,gquota"
 _qmount
 
 # user test
-xfs_quota -x -c "limit -u bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT >>$seqres.full 2>&1
-[ $? -ne 0 ] && _fail "Create limit for user 123456-fsgqa Failed"
-xfs_quota -x -c "quota -u -v 123456-fsgqa" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa
-[ $? -ne 0 ] && _fail "Query user 123456-fsgqa Failed"
-xfs_quota -x -c "report -u" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa
-[ $? -ne 0 ] && _fail "Report user 123456-fsgqa Failed"
+echo "== user test =="
+$XFS_QUOTA_PROG -x -c "limit -u bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT
+echo "=== quota command output ==="
+$XFS_QUOTA_PROG -c "quota -u -b -N -v 123456-fsgqa" $SCRATCH_MNT | _filter_quota
+echo "=== report command output ==="
+$XFS_QUOTA_PROG -x -c "report -u -b -N" $SCRATCH_MNT | grep -v "^root " | _filter_quota
 
 # group test
-xfs_quota -x -c "limit -g bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT >>$seqres.full 2>&1
-[ $? -ne 0 ] && _fail "Create limit for group 123456-fsgqa Failed"
-xfs_quota -x -c "quota -g -v 123456-fsgqa" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa
-[ $? -ne 0 ] && _fail "Query group 123456-fsgqa Failed"
-xfs_quota -x -c "report -u" $SCRATCH_MNT 2>>$seqres.full | grep -qw 123456-fsgqa
-[ $? -ne 0 ] && _fail "Report group 123456-fsgqa Failed"
+echo "== group test =="
+$XFS_QUOTA_PROG -x -c "limit -g bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT
+echo "=== quota command output ==="
+$XFS_QUOTA_PROG -c "quota -g -b -N -v 123456-fsgqa" $SCRATCH_MNT | _filter_quota
+echo "=== report command output ==="
+$XFS_QUOTA_PROG -x -c "report -u -b -N" $SCRATCH_MNT | grep -v "^root " | _filter_quota
 
 # success, all done
 status=0
index f3eb4116271623a48c51887ce2a9789f1aa7107d..71929c4487a8526c49516361c4898f3f1eac2215 100644 (file)
@@ -1 +1,13 @@
 QA output created by 138
+== user test ==
+=== quota command output ===
+SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
+=== report command output ===
+123456-fsgqa 0 102400 204800 00 [--------]
+
+== group test ==
+=== quota command output ===
+SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
+=== report command output ===
+123456-fsgqa 0 102400 204800 00 [--------]
+