Whamcloud - gitweb
LU-3782 test: Fix for faliure when no file are created. 39/16939/9
authorKirtankumar Krishna Shetty <kirtan.shetty@seagate.com>
Mon, 26 Oct 2015 12:01:27 +0000 (17:31 +0530)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 14 Mar 2016 02:40:09 +0000 (02:40 +0000)
The test_18 of ost-pools.sh failed when the createmany
function returns zero and test showed a divide by zero
error. Fixed the issue by adding a check for the return
value and also fixed incorrect average calculation.

Seagate-bug-id: MRP-1117
Signed-off-by: Kirtankumar Krishna Shetty <kirtan.shetty@seagate.com>
Change-Id: I13ea0c1aeb974b5e74dfc7d92fe4e3b744a1fba6
Reviewed-on: http://review.whamcloud.com/16939
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/ost-pools.sh

index eb2ec58..cb1327c 100644 (file)
@@ -1064,53 +1064,58 @@ create_perf() {
 }
 
 test_18() {
-    set_cleanup_trap
-    local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
-    local numsec=15
-    local iter=3
-    local plaindir=$POOL_ROOT/plaindir
-    local pooldir=$POOL_ROOT/pooldir
-    local f1=0
-    local f2=0
-    local f3=0
-    local diff
-
-    for i in $(seq 1 $iter); do
-        echo "Create performance, iteration $i, $numsec seconds x 3"
-
-        files1=$(create_perf $plaindir $numsec)
-        echo "iter $i: $files1 creates without pool"
-        f1=$(($f1 + $files1))
-
-        create_pool_nofail $POOL > /dev/null
-        add_pool $POOL $TGT_ALL "$TGT_UUID" > /dev/null
-        create_dir $pooldir $POOL
-        files2=$(create_perf $pooldir $numsec)
-        echo "iter $i: $files2 creates with pool"
-        f2=$(($f2 + $files2))
-
-        destroy_pool $POOL > /dev/null
-        files3=$(create_perf $pooldir $numsec)
-        echo "iter $i: $files3 creates with missing pool"
-        f3=$(($f3 + $files3))
-
-        echo
-    done
+       set_cleanup_trap
+       local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
+       local numsec=15
+       local iter=3
+       local plaindir=$POOL_ROOT/plaindir
+       local pooldir=$POOL_ROOT/pooldir
+       local f1=0
+       local f2=0
+       local f3=0
+       local diff
+
+       for i in $(seq 1 $iter); do
+               echo "Create performance, iteration $i, $numsec seconds x 3"
+
+               local files1=$(create_perf $plaindir $numsec)
+               [[ $files1 -eq 0 ]] && error "Zero files created without pool"
+               f1=$((f1 + files1))
+               echo "iter $i: $files1 creates without pool"
+
+               create_pool_nofail $POOL > /dev/null
+               add_pool $POOL $TGT_ALL "$TGT_UUID" > /dev/null
+               create_dir $pooldir $POOL
+               local files2=$(create_perf $pooldir $numsec)
+               [[ $files2 -eq 0 ]] && error "Zero files created with pool"
+               f2=$((f2 + files2))
+               echo "iter $i: $files2 creates with pool"
+
+               destroy_pool $POOL > /dev/null
+               local files3=$(create_perf $pooldir $numsec)
+               [[ $files3 -eq 0 ]] &&
+                       error "Zero files created with missing pool"
+               f3=$((f3 + files3))
+               echo "iter $i: $files3 creates with missing pool"
+
+               echo
+       done
+
+       echo Avg files created in $numsec seconds without pool: $((f1 / iter))
+       echo Avg files created in $numsec seconds with pool: $((f2 / iter))
+       echo Avg files created in $numsec seconds missing pool: $((f3 / iter))
 
-    echo Avg files created in $numsec seconds without pool: $((files1 / iter))
-    echo Avg files created in $numsec seconds with pool: $((files2 / iter))
-    echo Avg files created in $numsec seconds missing pool: $((files3 / iter))
+       # Set this high until we establish a baseline for what the degradation
+       # is / should be
+       max=30
 
-    # Set this high until we establish a baseline for what the degradation
-    # is / should be
-    max=30
-    diff=$((($files1 - $files2) * 100 / $files1))
+       diff=$((($f1 - $f2) * 100 / $f1))
        echo  "No pool / wide pool: $diff %."
        [ $diff -gt $max ] &&
                error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
 
        max=30
-       diff=$((($files1 - $files3) * 100 / $files1))
+       diff=$((($f1 - $f3) * 100 / $f1))
        echo  "No pool / missing pool: $diff %."
        [ $diff -gt $max ] &&
                error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"