Whamcloud - gitweb
LU-3508 test: small fix for sanity.sh test_101c 54/6854/3
authorEmoly Liu <emoly.liu@intel.com>
Sun, 19 May 2013 08:45:38 +0000 (16:45 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 3 Sep 2013 05:21:00 +0000 (05:21 +0000)
Filter out those "found no match" proc entries in sanity.sh test_101c
and do some code cleanup.

Signed-off-by: Liu Ying <emoly.liu@intel.com>
Change-Id: Ie56c058318c52c8809a21ed242e9bb797b7d421a
Reviewed-on: http://review.whamcloud.com/6854
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity.sh

index f046122..75e3bc1 100644 (file)
@@ -5865,40 +5865,31 @@ test_101c() {
        local STRIPE_SIZE=1048576
        local FILE_LENGTH=$((STRIPE_SIZE*100))
        local nreads=10000
        local STRIPE_SIZE=1048576
        local FILE_LENGTH=$((STRIPE_SIZE*100))
        local nreads=10000
-       local osc
+       local osc_rpc_stats
 
 
-    setup_test101bc
-
-    cancel_lru_locks osc
-    $LCTL set_param osc.*.rpc_stats 0
-    $READS -f $DIR/$tfile -s$FILE_LENGTH -b65536 -n$nreads -t 180
-    for osc in $($LCTL get_param -N osc.*); do
-        if [ "$osc" == "osc.num_refs" ]; then
-            continue
-        fi
-
-        local lines=$($LCTL get_param -n ${osc}.rpc_stats | wc | awk '{print $1}')
-        if [ $lines -le 20 ]; then
-            continue
-        fi
+       setup_test101bc
 
 
-        local rpc4k=$($LCTL get_param -n ${osc}.rpc_stats |
-                                     awk '$1 == "1:" { print $2; exit; }')
-        local rpc8k=$($LCTL get_param -n ${osc}.rpc_stats |
-                                     awk '$1 == "2:" { print $2; exit; }')
-        local rpc16k=$($LCTL get_param -n ${osc}.rpc_stats |
-                                     awk '$1 == "4:" { print $2; exit; }')
-        local rpc32k=$($LCTL get_param -n ${osc}.rpc_stats |
-                                     awk '$1 == "8:" { print $2; exit; }')
-
-        [ $rpc4k != 0 ]  && error "Small 4k read IO ${rpc4k}!"
-        [ $rpc8k != 0 ]  && error "Small 8k read IO ${rpc8k}!"
-        [ $rpc16k != 0 ] && error "Small 16k read IO ${rpc16k}!"
-        [ $rpc32k != 0 ] && error "Small 32k read IO ${rpc32k}!"
-        echo "${osc} rpc check passed!"
-    done
-    cleanup_test101bc
-    true
+       cancel_lru_locks osc
+       $LCTL set_param osc.*.rpc_stats 0
+       $READS -f $DIR/$tfile -s$FILE_LENGTH -b65536 -n$nreads -t 180
+       for osc_rpc_stats in $($LCTL get_param -N osc.*.rpc_stats); do
+               local stats=$($LCTL get_param -n $osc_rpc_stats)
+               local lines=$(echo "$stats" | awk 'END {print NR;}')
+               local size
+
+               if [ $lines -le 20 ]; then
+                       continue
+               fi
+               for size in 1 2 4 8; do
+                       local rpc=$(echo "$stats" |
+                                   awk '($1 == "'$size':") {print $2; exit; }')
+                       [ $rpc != 0 ] &&
+                               error "Small $((size*4))k read IO $rpc !"
+               done
+               echo "$osc_rpc_stats check passed!"
+       done
+       cleanup_test101bc
+       true
 }
 run_test 101c "check stripe_size aligned read-ahead ================="
 
 }
 run_test 101c "check stripe_size aligned read-ahead ================="