Whamcloud - gitweb
LU-797 tests: improve test_23b of ost-pools.sh
authorEmoly Liu <emoly.liu@intel.com>
Mon, 17 Dec 2012 03:15:08 +0000 (11:15 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 19 Dec 2012 16:30:00 +0000 (11:30 -0500)
- fail the test once the written space is greater than the
  available space.
- use it's own maxfree limit, and increase the limit a lot.
- terminate the test when the write speed is too slow.

Test-Parameters: envdefinitions=SLOW=yes testlist=ost-pools
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Signed-off-by: Liu Ying <emoly.liu@intel.com>
Change-Id: Id9aef77ef07358a03133ed6d34c299609540ef42
Reviewed-on: http://review.whamcloud.com/4831
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/ost-pools.sh

index a53774d..3d068e1 100644 (file)
@@ -1230,8 +1230,6 @@ test_23b() {
 
     local i=0
     local TGT
-    local BUNIT_SZ=1024  # min block quota unit(kB)
-    local LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1)))
     local dir=$POOL_ROOT/dir
     local file="$dir/$tfile-quota"
 
@@ -1242,28 +1240,47 @@ test_23b() {
     add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
     create_dir $dir $POOL
 
+    local maxfree=$((1024 * 1024 * 30)) # 30G
     local AVAIL=$(lfs_df -p $POOL $dir | awk '/summary/ { print $4 }')
-    [ $AVAIL -gt $MAXFREE ] &&
-        skip_env "Filesystem space $AVAIL is larger than $MAXFREE limit" &&
-                       return 0
+    [ $AVAIL -gt $maxfree ] &&
+        skip_env "Filesystem space $AVAIL is larger than $maxfree limit" &&
+            return 0
 
     $LFS quotaoff -ug $MOUNT
     chown $RUNAS_ID.$RUNAS_ID $dir
     i=0
-    RC=0
+    local RC=0
+    local TOTAL=0 # KB
+    local stime=$(date +%s)
+    local stat
+    local etime
+    local elapsed
+    local maxtime=300 # minimum speed: 5GB / 300sec ~= 17MB/s
     while [ $RC -eq 0 ]; do
         i=$((i + 1))
         stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file}$i bs=1M \
-               count=$((LIMIT * 4)) 2>&1)
+            count=$((5 * 1024)) 2>&1)
         RC=$?
-               echo "$i: $stat"
+        TOTAL=$((TOTAL + 1024 * 1024 * 5))
+        echo "[$i iteration] $stat"
+        echo "total written: $TOTAL"
+
+        etime=$(date +%s)
+        elapsed=$((etime - stime))
+        echo "stime=$stime, etime=$etime, elapsed=$elapsed"
+
         if [ $RC -eq 1 ]; then
             echo $stat | grep "Disk quota exceeded"
             [[ $? -eq 0 ]] && error "dd failed with EDQUOT with quota off"
 
             echo $stat | grep "No space left on device"
-            [[ $? -ne 0 ]] &&
-                error "dd did not fail with ENOSPC"
+            [[ $? -ne 0 ]] && error "dd did not fail with ENOSPC"
+        elif [ $TOTAL -gt $AVAIL ]; then
+            error "dd didn't fail with ENOSPC ($TOTAL > $AVAIL)"
+        elif [ $i -eq 1 -a $elapsed -gt $maxtime ]; then
+            log "The first 5G write used $elapsed (> $maxtime) " \
+                "seconds, terminated"
+            RC=1
         fi
     done