Whamcloud - gitweb
LU-3720 test: use actual stripe count in sanity.sh 130d
[fs/lustre-release.git] / lustre / tests / sanity.sh
index f046122..5ac4621 100644 (file)
@@ -5865,40 +5865,31 @@ test_101c() {
        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 ================="
 
@@ -8035,10 +8026,14 @@ test_130d() {
        $SETSTRIPE -S 65536 -c $OSTCOUNT $fm_file||error "setstripe on $fm_file"
        [ "$(facet_fstype ost$(($($GETSTRIPE -i $fm_file) + 1)))" = "zfs" ] &&
                skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return
-       dd if=/dev/zero of=$fm_file bs=1M count=$OSTCOUNT || error "dd failed on $fm_file"
+
+       local actual_stripecnt=$($GETSTRIPE -c $fm_file)
+       dd if=/dev/zero of=$fm_file bs=1M count=$actual_stripecnt ||
+               error "dd failed on $fm_file"
 
        filefrag -ves $fm_file || error "filefrag $fm_file failed"
-       filefrag_op=`filefrag -ve $fm_file | grep -A 100 "ext:" | grep -v "ext:" | grep -v "found"`
+       filefrag_op=`filefrag -ve $fm_file | grep -A 100 "ext:" |
+               grep -v "ext:" | grep -v "found"`
 
        last_lun=`echo $filefrag_op | cut -d: -f5`
 
@@ -8062,7 +8057,7 @@ test_130d() {
                (( tot_len += ext_len ))
                last_lun=$frag_lun
        done
-       if (( num_luns != OSTCOUNT || tot_len != 1024 )); then
+       if (( num_luns != actual_stripecnt || tot_len != 1024 )); then
                cleanup_130
                error "FIEMAP on $fm_file failed; returned wrong number of luns or wrong len for OST $last_lun"
                return
@@ -11611,9 +11606,12 @@ test_234() {
        $LCTL set_param fail_loc=0x1405
        setfattr -n user.attr -v value $DIR/$tdir/$tfile &&
                error "setfattr should have failed with ENOMEM"
-       # attr pre-2.4.44-7 had a bug with rc
-       getfattr -n user.attr $DIR/$tdir/$tfile &&
-               error "getfattr should have failed with ENOMEM"
+       if [ ! -f /etc/SuSE-release ]; then
+               # attr pre-2.4.44-7 had a bug with rc
+               # LU-3703 - SLES clients have older attr
+               getfattr -n user.attr $DIR/$tdir/$tfile &&
+                       error "getfattr should have failed with ENOMEM"
+       fi
        $LCTL set_param fail_loc=0x0
        rm -rf $DIR/$tdir