xfs
[Top] [All Lists]

[PATCH v2] xfstests: fix failed 022 case with qgroup limit test

To: xfs@xxxxxxxxxxx
Subject: [PATCH v2] xfstests: fix failed 022 case with qgroup limit test
From: Wang Shilong <wangsl.fnst@xxxxxxxxxxxxxx>
Date: Mon, 6 Jan 2014 17:17:50 +0800
Cc: linux-btrfs@xxxxxxxxxxxxxxx, jbacik@xxxxxx, t-itoh@xxxxxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
To have noexceed test, we should clear data before and then retry.
However, when we are near to quota limit, we may fail to truncate/remove
data before, so we restart everthing here.

Signed-off-by: Wang Shilong <wangsl.fnst@xxxxxxxxxxxxxx>
---
changelog v1->v2:
        on the right way to fix failed case(Thanks to Tsutomu Itoh)
---
 tests/btrfs/022 | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/tests/btrfs/022 b/tests/btrfs/022
index 5b18643..41d8588 100644
--- a/tests/btrfs/022
+++ b/tests/btrfs/022
@@ -94,8 +94,8 @@ _rescan_test()
                _fail "exclusive values don't match after rescan"
 }
 
-#basic limit testing
-_limit_test()
+#basic exceed limit testing
+_limit_test_exceed()
 {
        run_check $BTRFS_UTIL_PROG subvol create $SCRATCH_MNT/a
        run_check $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT
@@ -104,6 +104,15 @@ _limit_test()
        dd if=/dev/urandom of=$SCRATCH_MNT/a/file bs=10M count=1 >> \
                $seqres.full 2>&1
        [ $? -ne 0 ] || _fail "quota should have limited us"
+}
+
+#basic noexceed limit testing
+_limit_test_noexceed()
+{
+       run_check $BTRFS_UTIL_PROG subvol create $SCRATCH_MNT/a
+       run_check $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT
+       subvolid=$(_btrfs_get_subvolid $SCRATCH_MNT a)
+       run_check $BTRFS_UTIL_PROG qgroup limit 5M 0/$subvolid $SCRATCH_MNT
        dd if=/dev/urandom of=$SCRATCH_MNT/a/file bs=4M count=1 >> \
                $seqres.full 2>&1
        [ $? -eq 0 ] || _fail "should have been allowed to write"
@@ -121,7 +130,12 @@ _scratch_unmount
 
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
-_limit_test
+_limit_test_exceed
+_scratch_unmount
+
+_scratch_mkfs > /dev/null 2>&1
+_scratch_mount
+_limit_test_noexceed
 
 # success, all done
 echo "Silence is golden"
-- 
1.8.3.1

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH v2] xfstests: fix failed 022 case with qgroup limit test, Wang Shilong <=