Whamcloud - gitweb
LU-4770 tests: tests scripts simplification 68/9668/4
authorDmitry Eremin <dmitry.eremin@intel.com>
Mon, 17 Mar 2014 20:33:19 +0000 (00:33 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 20 Mar 2014 15:24:43 +0000 (15:24 +0000)
1. Xeon Phi don't support "mount -t lustre", we can use only
   "mount.lustre" utility.
2. A "head" utility don't support shortcut "-1" option.
   It should be specified as "-n 1".
3. A "sed" utility don't support expression "s/[-.]/ /3"

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ib5ba22451819772ebacb38706447403ae6668cc4
Reviewed-on: http://review.whamcloud.com/9668
Tested-by: Jenkins
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/conf-sanity.sh
lustre/tests/lustre-rsync-test.sh
lustre/tests/obdfilter-survey.sh
lustre/tests/ost-pools.sh
lustre/tests/recovery-small.sh
lustre/tests/replay-ost-single.sh
lustre/tests/sanity-hsm.sh
lustre/tests/sanity.sh
lustre/tests/sanityn.sh
lustre/tests/test-framework.sh
lustre/tests/yaml.sh

index ed3f275..2652c5d 100644 (file)
@@ -932,7 +932,7 @@ test_24a() {
        start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
        start fs2ost $fs2ostdev $OST_MOUNT_OPTS
        mkdir -p $MOUNT2
-       mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
+       $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || return 1
        # 1 still works
        check_mount || return 2
        # files written on 1 should not show up on 2
@@ -1270,8 +1270,8 @@ test_30b() {
 run_test 30b "Remove failover nids"
 
 test_31() { # bug 10734
-        # ipaddr must not exist
-        mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
+       # ipaddr must not exist
+       $MOUNT_CMD 4.3.2.1@tcp:/lustre $MOUNT || true
        cleanup
 }
 run_test 31 "Connect to non-existent node (shouldn't crash)"
@@ -1660,7 +1660,7 @@ t32_test() {
                        if [ $fstype == "ldiskfs" ]; then
                                mopts="loop,$mopts"
                        fi
-                       $r mount -t lustre -o $mopts $mdt_dev $tmp/mnt/mdt
+                       $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt
                        $r lctl replace_nids $fsname-OST0000 $ostnid
                        $r lctl replace_nids $fsname-MDT0000 $nid
                        $r umount -d $tmp/mnt/mdt
@@ -1674,7 +1674,7 @@ t32_test() {
 
        t32_wait_til_devices_gone $node
 
-       $r mount -t lustre -o $mopts $mdt_dev $tmp/mnt/mdt || {
+       $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
                $r losetup -a
                error_noexit "Mounting the MDT"
                return 1
@@ -1703,7 +1703,7 @@ t32_test() {
 
                echo "mount new MDT....$fs2mdsdev"
                $r mkdir -p $tmp/mnt/mdt1
-               $r mount -t lustre -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
+               $r $MOUNT_CMD -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
                        error_noexit "mount mdt1 failed"
                        return 1
                }
@@ -1739,7 +1739,7 @@ t32_test() {
                        mopts="loop,$mopts"
                fi
        fi
-       $r mount -t lustre -o $mopts $ost_dev $tmp/mnt/ost || {
+       $r $MOUNT_CMD -o $mopts $ost_dev $tmp/mnt/ost || {
                error_noexit "Mounting the OST"
                return 1
        }
@@ -1821,7 +1821,7 @@ t32_test() {
        fi
 
        if [ "$writeconf" ]; then
-               mount -t lustre $nid:/$fsname $tmp/mnt/lustre || {
+               $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
                        error_noexit "Mounting the client"
                        return 1
                }
@@ -1989,7 +1989,7 @@ t32_test() {
                if [ $fstype == "ldiskfs" ]; then
                        mopts="loop,$mopts"
                fi
-               $r mount -t lustre -o $mopts $mdt_dev $tmp/mnt/mdt || {
+               $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
                        error_noexit "Remounting the MDT"
                        return 1
                }
@@ -2084,7 +2084,7 @@ test_33a() { # bug 12333, was test_33
         start fs2ost $fs2ostdev $OST_MOUNT_OPTS
         do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
         mkdir -p $MOUNT2
-        mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
+       $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
         echo "ok."
 
         cp /etc/hosts $MOUNT2/ || rc=3
@@ -2327,7 +2327,7 @@ test_36() { # 12743
         start fs2ost $fs2ostdev $OST_MOUNT_OPTS
         start fs3ost $fs3ostdev $OST_MOUNT_OPTS
         mkdir -p $MOUNT2
-        mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
+       $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || return 1
 
         sleep 5 # until 11778 fixed
 
@@ -4496,7 +4496,7 @@ test_77() { # LU-3445
        start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
 
        mkdir -p $MOUNT2
-       mount -t lustre $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
+       $MOUNT_CMD $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
        DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
        cleanup_fs2
 }
index 84050d5..8717a8d 100644 (file)
@@ -49,8 +49,8 @@ export LRSYNC="$LRSYNC -v -c no -d 2"
 DBENCH_TIME=${DBENCH_TIME:-60}  # No of seconds to run dbench
 TGT=$TMP/target
 TGT2=$TMP/target2
-MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid | \
-    awk '{gsub(/_UUID/,""); print $1}' | head -1)
+MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
+       awk '{ gsub(/_UUID/,""); print $1 }' | head -n1)
 
 init_changelog() {
     CL_USER=$(do_facet $SINGLEMDS lctl --device $MDT0 changelog_register -n)
index 5058fa7..e93fe2c 100644 (file)
@@ -94,7 +94,7 @@ print_jbd () {
        local varsvc=${facet}_svc
        local dev=$(ldiskfs_canon "*.${!varsvc}.mntdev" $facet)
 
-       # ext4: /proc/fs/jbd2/sda1:8/history 
+       # ext4: /proc/fs/jbd2/sda1:8/history
        # ext3: /proc/fs/jbd/sdb1/history
 
        do_facet $facet cat /proc/fs/jbd*/${dev}*/$file
@@ -110,7 +110,7 @@ check_jbd_values () {
        # $8: hndls >= thrhi * 2
        # display history of rtime/4 before, in case obd cleanup consumes time
        local tlines=$((rtime / 5 / 4 + 1))
-       local hist=("$(print_jbd history $facet | tail -$tlines | head -1)")
+       local hist=("$(print_jbd history $facet | tail -$tlines | head -n1)")
        echo "$hist"
        local run=($(echo "${hist[*]}" | awk '{print $4}'))
        local hndls=($(echo "${hist[*]}" | awk '{print $8}'))
index dd13c6b..ad56980 100644 (file)
@@ -155,15 +155,15 @@ check_file_not_in_pool() {
 }
 
 check_dir_not_in_pool() {
-    local dir=$1
-    local pool=$2
-    local res=$($GETSTRIPE -v $dir | grep "^stripe_count" | head -1 |
-                cut -f 8 -d ' ')
-    if [[ "$res" == "$pool" ]]; then
-        error "File $dir is in pool: $res"
-        return 1
-    fi
-    return 0
+       local dir=$1
+       local pool=$2
+       local res=$($GETSTRIPE -v $dir | grep "^stripe_count" | head -n1 |
+               cut -f 8 -d ' ')
+       if [[ "$res" == "$pool" ]]; then
+               error "File $dir is in pool: $res"
+               return 1
+       fi
+       return 0
 }
 
 drain_pool() {
index 33c7459..1d420f9 100755 (executable)
@@ -1198,8 +1198,8 @@ err17935 () {
 }
 
 test_60() {
-        MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid | \
-           awk '{gsub(/_UUID/,""); print $1}' | head -1)
+       MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
+               awk '{ gsub(/_UUID/,""); print $1 }' | head -n1)
 
        NUM_FILES=15000
        mkdir -p $DIR/$tdir
@@ -1385,8 +1385,8 @@ target_instance_match()
 
         local target=${srv}_svc
         local si=$(do_facet $srv lctl get_param -n $obdname.${!target}.instance)
-        local ci=$(lctl get_param -n $cliname.${!target}-${cliname}-*.import | \
-                  awk '/instance/{ print $2 }' |head -1)
+       local ci=$(lctl get_param -n $cliname.${!target}-${cliname}-*.import |
+               awk '/instance/{ print $2 }' | head -n1)
 
         return $([ $si -eq $ci ])
 }
index 6cefe8b..42c39fd 100755 (executable)
@@ -143,33 +143,37 @@ iozone_bg () {
 }
 
 test_5() {
-    [ -z "`which iozone 2> /dev/null`" ] && skip_env "iozone missing" && return 0
+       if [ -z "`which iozone 2> /dev/null`" ]; then
+               skip_env "iozone missing"
+               return 0
+       fi
 
-    # striping is -c 1, get min of available
-    local minavail=$(lctl get_param -n osc.*[oO][sS][cC][-_]*.kbytesavail | sort -n | head -1)
-    local size=$(( minavail * 3/4 ))
-    local GB=1048576  # 1048576KB == 1GB
+       # striping is -c 1, get min of available
+       local minavail=$(lctl get_param -n osc.*[oO][sS][cC][-_]*.kbytesavail |
+               sort -n | head -n1)
+       local size=$(( minavail * 3/4 ))
+       local GB=1048576  # 1048576KB == 1GB
 
-    if (( size > GB )); then
-        size=$GB
-    fi
-    local iozone_opts="-i 0 -i 1 -i 2 -+d -r 4 -s $size -f $TDIR/$tfile"
+       if (( size > GB )); then
+               size=$GB
+       fi
+       local iozone_opts="-i 0 -i 1 -i 2 -+d -r 4 -s $size -f $TDIR/$tfile"
 
-    iozone_bg $iozone_opts &
-    local pid=$!
+       iozone_bg $iozone_opts &
+       local pid=$!
 
-    echo iozone bg pid=$pid
+       echo iozone bg pid=$pid
 
-    sleep 8
-    fail ost1
-    local rc=0
-    wait $pid
-    rc=$?
-    log "iozone rc=$rc"
-    rm -f $TDIR/$tfile
-    wait_delete_completed_mds
-    [ $rc -eq 0 ] || error "iozone failed"
-    return $rc
+       sleep 8
+       fail ost1
+       local rc=0
+       wait $pid
+       rc=$?
+       log "iozone rc=$rc"
+       rm -f $TDIR/$tfile
+       wait_delete_completed_mds
+       [ $rc -eq 0 ] || error "iozone failed"
+       return $rc
 }
 run_test 5 "Fail OST during iozone"
 
index a2d9011..2ec6148 100755 (executable)
@@ -128,7 +128,7 @@ get_mdt_devices() {
                local idx=$(($mdtno - 1))
                MDT[$idx]=$($LCTL get_param -n \
                        mdc.$FSNAME-MDT000${idx}-mdc-*.mds_server_uuid |
-                       awk '{gsub(/_UUID/,""); print $1}' | head -1)
+                       awk '{gsub(/_UUID/,""); print $1}' | head -n1)
        done
 }
 
@@ -569,7 +569,7 @@ cleanup_large_files() {
 
 make_large_for_striping() {
        local file2=${1/$DIR/$DIR2}
-       local sz=$($LCTL get_param -n lov.*-clilov-*.stripesize | head -1)
+       local sz=$($LCTL get_param -n lov.*-clilov-*.stripesize | head -n1)
 
        cleanup_large_files
 
index 94dd3cd..c90d621 100644 (file)
@@ -106,8 +106,8 @@ check_and_setup_lustre
 DIR=${DIR:-$MOUNT}
 assert_DIR
 
-MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid | \
-    awk '{gsub(/_UUID/,""); print $1}' | head -1)
+MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
+       awk '{ gsub(/_UUID/,""); print $1 }' | head -n1)
 LOVNAME=$($LCTL get_param -n llite.*.lov.common_name | tail -n 1)
 OSTCOUNT=$($LCTL get_param -n lov.$LOVNAME.numobd)
 STRIPECOUNT=$($LCTL get_param -n lov.$LOVNAME.stripecount)
@@ -515,9 +515,9 @@ test_17i() { #bug 20018
 run_test 17i "don't panic on short symlink"
 
 test_17k() { #bug 22301
-        rsync --help | grep -q xattr ||
-                skip_env "$(rsync --version| head -1) does not support xattrs"
-       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       rsync --help | grep -q xattr ||
+               skip_env "$(rsync --version | head -n1) does not support xattrs"
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return 0
        test_mkdir -p $DIR/$tdir
        test_mkdir -p $DIR/$tdir.new
        touch $DIR/$tdir/$tfile
@@ -1031,7 +1031,7 @@ simple_cleanup_common() {
 }
 
 max_pages_per_rpc() {
-       $LCTL get_param -n mdc.*.max_pages_per_rpc | head -1
+       $LCTL get_param -n mdc.*.max_pages_per_rpc | head -n1
 }
 
 test_24v() {
@@ -5625,7 +5625,8 @@ test_78() { # bug 10901
        [ $F78SIZE -gt $MEMTOTAL ] && F78SIZE=$MEMTOTAL
        [ $F78SIZE -gt 512 ] && F78SIZE=512
        [ $F78SIZE -gt $((MAXFREE / 1024)) ] && F78SIZE=$((MAXFREE / 1024))
-       SMALLESTOST=`lfs df $DIR |grep OST | awk '{print $4}' |sort -n |head -1`
+       SMALLESTOST=$(lfs df $DIR | grep OST | awk '{ print $4 }' | sort -n |
+               head -n1)
        echo "Smallest OST: $SMALLESTOST"
        [ $SMALLESTOST -lt 10240 ] && \
                skip "too small OSTSIZE, useless to run large O_DIRECT test" && return 0
@@ -5636,12 +5637,12 @@ test_78() { # bug 10901
        [ "$SLOW" = "no" ] && NSEQ=1 && [ $F78SIZE -gt 32 ] && F78SIZE=32
        echo "File size: $F78SIZE"
        $SETSTRIPE -c $OSTCOUNT $DIR/$tfile || error "setstripe failed"
-       for i in `seq 1 $NSEQ`
-       do
-               FSIZE=$(($F78SIZE / ($NSEQ - $i + 1)))
-               echo directIO rdwr round $i of $NSEQ
-               $DIRECTIO rdwr $DIR/$tfile 0 $FSIZE 1048576||error "rdwr failed"
-       done
+       for i in `seq 1 $NSEQ`
+       do
+               FSIZE=$(($F78SIZE / ($NSEQ - $i + 1)))
+               echo directIO rdwr round $i of $NSEQ
+               $DIRECTIO rdwr $DIR/$tfile 0 $FSIZE 1048576||error "rdwr failed"
+       done
 
        rm -f $DIR/$tfile
 }
@@ -6830,7 +6831,7 @@ test_116a() { # was previously test_116()
 
        echo -n "Free space priority "
        do_facet $SINGLEMDS lctl get_param -n lo*.*-mdtlov.qos_prio_free |
-               head -1
+               head -n1
        declare -a AVAIL
        free_min_max
 
@@ -6844,7 +6845,7 @@ test_116a() { # was previously test_116()
        local DIFF2=$(($DIFF * 100 / $MINV))
 
        local threshold=$(do_facet $SINGLEMDS \
-               lctl get_param -n *.*MDT0000-mdtlov.qos_threshold_rr | head -1)
+               lctl get_param -n *.*MDT0000-mdtlov.qos_threshold_rr | head -n1)
        threshold=${threshold%%%}
        echo -n "Check for uneven OSTs: "
        echo -n "diff=${DIFF}KB (${DIFF2}%) must be > ${threshold}% ..."
@@ -6975,7 +6976,7 @@ NO_SLOW_RESENDCOUNT=4
 export OLD_RESENDCOUNT=""
 set_resend_count () {
        local PROC_RESENDCOUNT="osc.${FSNAME}-OST*-osc-*.resend_count"
-       OLD_RESENDCOUNT=$(lctl get_param -n $PROC_RESENDCOUNT | head -1)
+       OLD_RESENDCOUNT=$(lctl get_param -n $PROC_RESENDCOUNT | head -n1)
        lctl set_param -n $PROC_RESENDCOUNT $1
        echo resend_count is set to $(lctl get_param -n $PROC_RESENDCOUNT)
 }
@@ -9682,18 +9683,18 @@ test_160a() {
 
        MIN_REC=$($GET_CL_USERS |
                awk 'min == "" || $2 < min {min = $2}; END {print min}')
-       FIRST_REC=$($LFS changelog $MDT0 | head -1 | awk '{print $1}')
+       FIRST_REC=$($LFS changelog $MDT0 | head -n1 | awk '{print $1}')
        echo "verifying min purge: $(( $MIN_REC + 1 )) == $FIRST_REC"
        [ $FIRST_REC == $(($MIN_REC + 1)) ] ||
                err17935 "first index should be $(($MIN_REC + 1)) is $FIRST_REC"
 
        # LU-3446 changelog index reset on MDT restart
        local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
-       CUR_REC1=$($GET_CL_USERS | head -1 | cut -f3 -d' ')
+       CUR_REC1=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
        $LFS changelog_clear $MDT0 $USER 0
        stop $SINGLEMDS || error "Fail to stop MDT."
        start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "Fail to start MDT."
-       CUR_REC2=$($GET_CL_USERS | head -1 | cut -f3 -d' ')
+       CUR_REC2=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
        echo "verifying index survives MDT restart: $CUR_REC1 == $CUR_REC2"
        [ $CUR_REC1 == $CUR_REC2 ] ||
                err17935 "current index should be $CUR_REC1 is $CUR_REC2"
@@ -9705,9 +9706,9 @@ test_160a() {
 
        USERS=$(( $($GET_CL_USERS | wc -l) - 2 ))
        if [ $USERS -eq 0 ]; then
-               LAST_REC1=$($GET_CL_USERS | head -1 | cut -f3 -d' ')
+               LAST_REC1=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
                touch $DIR/$tdir/chloe
-               LAST_REC2=$($GET_CL_USERS | head -1 | cut -f3 -d' ')
+               LAST_REC2=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
                echo "verify changelogs are off: $LAST_REC1 == $LAST_REC2"
                [ $LAST_REC1 == $LAST_REC2 ] || error "changelogs not off"
        else
@@ -10195,7 +10196,8 @@ test_180c() { # LU-2598
        do_rpc_nodes $(facet_active_host ost1) load_module obdecho/obdecho &&
                rmmod_remote=true || error "failed to load module obdecho"
 
-       target=$(do_facet ost1 $LCTL dl | awk '/obdfilter/ {print $4}'|head -1)
+       target=$(do_facet ost1 $LCTL dl | awk '/obdfilter/ { print $4 }' |
+               head -n1)
        if [[ -n $target ]]; then
                obdecho_test "$target" ost1 "$pages" ||
                        rc=${PIPESTATUS[0]}
@@ -10658,7 +10660,7 @@ pool_remove_first_target() {
        local pool=$1
 
        local pname="lov.$FSNAME-*.pools.$pool"
-       local t=$($LCTL get_param -n $pname | head -1)
+       local t=$($LCTL get_param -n $pname | head -n1)
        do_facet mgs $LCTL pool_remove $FSNAME.$pool $t
        wait_update $HOSTNAME "lctl get_param -n $pname | grep $t" "" || {
                error_noexit "$t not removed from $FSNAME.$pool"
@@ -10679,7 +10681,7 @@ pool_remove_all_targets() {
                error_noexit "Pool $FSNAME.$pool cannot be drained"
                return 1
        }
-       # striping on an empty/nonexistant pool should fall back 
+       # striping on an empty/nonexistant pool should fall back
        # to "pool of everything"
        touch $file || {
                error_noexit "failed to use fallback striping for empty pool"
@@ -12049,7 +12051,7 @@ test_231a()
 {
        # For simplicity this test assumes that max_pages_per_rpc
        # is the same across all OSCs
-       local max_pages=$($LCTL get_param -n osc.*.max_pages_per_rpc | head -1)
+       local max_pages=$($LCTL get_param -n osc.*.max_pages_per_rpc | head -n1)
        local bulk_size=$((max_pages * 4096))
 
        mkdir -p $DIR/$tdir
index e37c56a..ddfd6ee 100644 (file)
@@ -493,7 +493,7 @@ run_test 21 " Try to remove mountpoint on another dir ===="
 
 test_23() { # Bug 5972
        local at_diff=$(do_facet $SINGLEMDS \
-               $LCTL get_param -n mdd.*MDT0000*.atime_diff | head -1)
+               $LCTL get_param -n mdd.*MDT0000*.atime_diff | head -n1)
        echo "atime should be updated while another read" > $DIR1/$tfile
 
        # clear the lock(mode: LCK_PW) gotten from creating operation
@@ -627,11 +627,11 @@ test_27() {
        DD2_PID=$!
        usleep 50
        log "dd 1 started"
-       
+
        dd if=/dev/zero of=$DIR1/$tfile bs=$((16384-1024))k conv=notrunc count=1 seek=4 &
        DD1_PID=$!
        log "dd 2 started"
-       
+
        sleep 1
        dd if=/dev/zero of=$DIR1/$tfile bs=8k conv=notrunc count=1 seek=0
        log "dd 3 finished"
@@ -643,7 +643,7 @@ run_test 27 "align non-overlapping extent locks from request ==="
 
 test_28() { # bug 9977
        ECHO_UUID="ECHO_osc1_UUID"
-       tOST=`$LCTL dl | | awk '/-osc-|OSC.*MNT/ { print $4 }' | head -1`
+       tOST=$($LCTL dl | awk '/-osc-|OSC.*MNT/ { print $4 }' | head -n1)
 
        $LFS setstripe $DIR1/$tfile -S 1048576 -i 0 -c 2
        tOBJID=`$LFS getstripe $DIR1/$tfile | awk '$1 == 1 {print $2}'`
@@ -838,8 +838,8 @@ print_jbd_stat () {
         varsvc=${mds}_svc
         dev=$(basename $(do_facet $mds "lctl get_param -n osd*.${!varsvc}.mntdev|\
                xargs readlink -f" ))
-        val=$(do_facet $mds "cat /proc/fs/jbd*/${dev}{,:*,-*}/info 2>/dev/null|\
-               head -1")
+       val=$(do_facet $mds "cat /proc/fs/jbd*/${dev}{,:*,-*}/info 2>/dev/null |
+               head -n1")
         val=${val%% *};
         stat=$(( stat + val))
     done
index 5aae14f..8089b1e 100755 (executable)
@@ -24,6 +24,7 @@ export JOBID_VAR=${JOBID_VAR:-"procname_uid"}  # or "existing" or "disable"
 export LOAD_LLOOP=${LOAD_LLOOP:-false}
 
 #export PDSH="pdsh -S -Rssh -w"
+export MOUNT_CMD=${MOUNT_CMD:-"mount -t lustre"}
 
 # function used by scripts run on remote nodes
 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
@@ -90,16 +91,21 @@ print_summary () {
         local total=
         local status=Unfinished
         if [ -f $log ]; then
-            skipped=$(grep excluded $log | awk '{ printf " %s", $3 }' | sed 's/test_//g')
-            slow=$(egrep "^PASS|^FAIL" $log | tr -d "("| sed s/s\)$//g | sort -nr -k 3  | head -5 |  awk '{ print $2":"$3"s" }')
-            total=$(grep duration $log | awk '{ print $2}')
-            if [ "${!O}" = "done" ]; then
-                status=Done
-            fi
-            if $DDETAILS; then
-                local durations=$(egrep "^PASS|^FAIL" $log |  tr -d "("| sed s/s\)$//g | awk '{ print $2":"$3"|" }')
-                details=$(printf "%s\n%s %s %s\n" "$details" "DDETAILS" "$O" "$(echo $durations)")
-            fi
+               skipped=$(grep excluded $log | awk '{ printf " %s", $3 }' |
+                       sed 's/test_//g')
+               slow=$(egrep "^PASS|^FAIL" $log | tr -d "("| sed s/s\)$//g |
+                       sort -nr -k 3  | head -n5 |  awk '{ print $2":"$3"s" }')
+               total=$(grep duration $log | awk '{ print $2 }')
+               if [ "${!O}" = "done" ]; then
+                       status=Done
+               fi
+               if $DDETAILS; then
+                       local durations=$(egrep "^PASS|^FAIL" $log |
+                               tr -d "("| sed s/s\)$//g |
+                               awk '{ print $2":"$3"|" }')
+                       details=$(printf "%s\n%s %s %s\n" "$details" \
+                               "DDETAILS" "$O" "$(echo $durations)")
+               fi
         fi
         printf "$form" $status "$O" "${total}" "E=$skipped"
         printf "$form" "-" "-" "-" "S=$(echo $slow)"
@@ -355,7 +361,7 @@ version_code() {
     echo -n "$((($1 << 16) | ($2 << 8) | $3))"
 }
 
-export LINUX_VERSION=$(uname -r | sed -e "s/[-.]/ /3" -e "s/ .*//")
+export LINUX_VERSION=$(uname -r | sed -e "s/\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/")
 export LINUX_VERSION_CODE=$(version_code ${LINUX_VERSION//\./ })
 
 module_loaded () {
@@ -1139,7 +1145,7 @@ mount_facet() {
        if [ -f $TMP/test-lu482-trigger ]; then
                RC=2
        else
-               do_facet ${facet} "mkdir -p $mntpt; mount -t lustre $opts \
+               do_facet ${facet} "mkdir -p $mntpt; $MOUNT_CMD $opts \
                                   ${!dev} $mntpt"
                RC=${PIPESTATUS[0]}
        fi
@@ -1430,7 +1436,7 @@ zconf_mount() {
 
     echo "Starting client: $client: $OPTIONS $device $mnt"
     do_node $client mkdir -p $mnt
-    do_node $client mount -t lustre $OPTIONS $device $mnt || return 1
+    do_node $client $MOUNT_CMD $OPTIONS $device $mnt || return 1
 
     set_default_debug_nodes $client
 
@@ -1541,7 +1547,7 @@ running=\\\$(mount | grep -c $mnt' ');
 rc=0;
 if [ \\\$running -eq 0 ] ; then
     mkdir -p $mnt;
-    mount -t lustre $OPTIONS $device $mnt;
+    $MOUNT_CMD $OPTIONS $device $mnt;
     rc=\\\$?;
 fi;
 exit \\\$rc" || return ${PIPESTATUS[0]}
@@ -5191,14 +5197,14 @@ get_stripe () {
 }
 
 setstripe_nfsserver () {
-    local dir=$1
+       local dir=$1
 
-    local nfsserver=$(awk '"'$dir'" ~ $2 && $3 ~ "nfs" && $2 != "/" \
-                { print $1 }' /proc/mounts | cut -f 1 -d : | head -1)
+       local nfsserver=$(awk '"'$dir'" ~ $2 && $3 ~ "nfs" && $2 != "/" \
+               { print $1 }' /proc/mounts | cut -f 1 -d : | head -n1)
 
-    [ -z $nfsserver ] && echo "$dir is not nfs mounted" && return 1
+       [ -z $nfsserver ] && echo "$dir is not nfs mounted" && return 1
 
-    do_nodev $nfsserver lfs setstripe "$@"
+       do_nodev $nfsserver lfs setstripe "$@"
 }
 
 # Check and add a test group.
@@ -5354,7 +5360,7 @@ do_and_time () {
 
     SECONDS=0
     eval '$cmd'
-    
+
     [ ${PIPESTATUS[0]} -eq 0 ] || rc=1
 
     echo $SECONDS
@@ -5362,8 +5368,9 @@ do_and_time () {
 }
 
 inodes_available () {
-    local IFree=$($LFS df -i $MOUNT | grep ^$FSNAME | awk '{print $4}' | sort -un | head -1) || return 1
-    echo $IFree
+       local IFree=$($LFS df -i $MOUNT | grep ^$FSNAME | awk '{ print $4 }' |
+               sort -un | head -n1) || return 1
+       echo $IFree
 }
 
 mdsrate_inodes_available () {
index a883085..7269cb8 100644 (file)
@@ -73,18 +73,19 @@ yml_code_review() {
 }
 
 release() {
-   if [ -r /etc/lsb-release ]; then
-      dist=$(grep 'DISTRIB_ID' /etc/lsb-release | sed 's/DISTRIB_ID=//' | head -1)
-   elif [ -r /etc/redhat-release ]; then
-       dist=$(awk '/release/ { printf("%s %s %s", $1, $2, $3)}' /etc/redhat-release)
-   elif [ -r /etc/*-release ]; then
-       dist=$(find /etc/ -maxdepth 1 -name '*release' 2> /dev/null | \
-           sed -e 's/\/etc\///' -e 's/-release//' | head -1)
-   else
-       dist="UNKNOWN"
-   fi
-
-   echo $dist
+       if [ -r /etc/lsb-release ]; then
+               dist=$(sed -ne '/^DISTRIB_ID/s/DISTRIB_ID=//p' /etc/lsb-release)
+       elif [ -r /etc/redhat-release ]; then
+               dist=$(awk '/release/ { printf("%s %s %s", $1, $2, $3) }' \
+                       /etc/redhat-release)
+       elif [ -r /etc/*-release ]; then
+               dist=$(find /etc/ -maxdepth 1 -name '*release' 2> /dev/null |
+                       sed -e 's/\/etc\///' -e 's/-release//' | head -n1)
+       else
+               dist="UNKNOWN"
+       fi
+
+       echo $dist
 }
 
 yml_build_info() {