From: Dmitry Eremin Date: Mon, 17 Mar 2014 20:33:19 +0000 (+0400) Subject: LU-4770 tests: tests scripts simplification X-Git-Tag: 2.5.1-crt1~23 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=66d635d0630f35e3a5d83f29aab9393cdb7dc2e4;p=fs%2Flustre-release.git LU-4770 tests: tests scripts simplification 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" Lustre-commit: 4d96e960d574387e8ac4a31249ef1d30c859480b Lustre-change: http://review.whamcloud.com/9668 Signed-off-by: Dmitry Eremin Signed-off-by: Bob Glossman Reviewed-by: Jian Yu Reviewed-by: Minh Diep Reviewed-by: Oleg Drokin Change-Id: I24804d7bde55ac3a70d99a582a1635ee9bfe62b8 Reviewed-on: http://review.whamcloud.com/9735 Tested-by: Jenkins Tested-by: Maloo --- diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index f5dc226..fc69e30 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -934,7 +934,7 @@ test_24a() { start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a 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 @@ -1274,8 +1274,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)" @@ -1664,7 +1664,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 @@ -1678,7 +1678,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 @@ -1707,7 +1707,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 } @@ -1743,7 +1743,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 } @@ -1825,7 +1825,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 } @@ -1993,7 +1993,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 } @@ -2088,7 +2088,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 @@ -2331,7 +2331,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 @@ -4468,7 +4468,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_24a } diff --git a/lustre/tests/lustre-rsync-test.sh b/lustre/tests/lustre-rsync-test.sh index 416ced3..656cd00 100644 --- a/lustre/tests/lustre-rsync-test.sh +++ b/lustre/tests/lustre-rsync-test.sh @@ -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) diff --git a/lustre/tests/obdfilter-survey.sh b/lustre/tests/obdfilter-survey.sh index 5058fa7..e93fe2c 100644 --- a/lustre/tests/obdfilter-survey.sh +++ b/lustre/tests/obdfilter-survey.sh @@ -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}')) diff --git a/lustre/tests/ost-pools.sh b/lustre/tests/ost-pools.sh index c3a5609..1d0e4be 100644 --- a/lustre/tests/ost-pools.sh +++ b/lustre/tests/ost-pools.sh @@ -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() { diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index bdee5ec..71b6417 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -1194,8 +1194,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 @@ -1381,8 +1381,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 ]) } diff --git a/lustre/tests/replay-ost-single.sh b/lustre/tests/replay-ost-single.sh index 6cefe8b..42c39fd 100755 --- a/lustre/tests/replay-ost-single.sh +++ b/lustre/tests/replay-ost-single.sh @@ -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" diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index 2a99d52..ed4bd65 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -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 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 1941ae7..e450a19 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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) @@ -514,9 +514,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 @@ -1007,7 +1007,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() { @@ -5567,7 +5567,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 @@ -5578,12 +5579,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 } @@ -6752,7 +6753,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 @@ -6766,7 +6767,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}% ..." @@ -6895,7 +6896,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) } @@ -9595,18 +9596,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" @@ -9618,9 +9619,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 @@ -10108,7 +10109,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]} @@ -10571,7 +10573,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" @@ -10592,7 +10594,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" @@ -11801,7 +11803,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 diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 142c870..6b40e8f 100644 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -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 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 9f8ceb8..531a50a 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -23,6 +23,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)} @@ -89,16 +90,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)" @@ -345,7 +351,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 () { @@ -1133,7 +1139,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 @@ -1424,7 +1430,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 @@ -1535,7 +1541,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]} @@ -5056,14 +5062,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. @@ -5219,7 +5225,7 @@ do_and_time () { SECONDS=0 eval '$cmd' - + [ ${PIPESTATUS[0]} -eq 0 ] || rc=1 echo $SECONDS @@ -5227,8 +5233,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 () { diff --git a/lustre/tests/yaml.sh b/lustre/tests/yaml.sh index a883085..7269cb8 100644 --- a/lustre/tests/yaml.sh +++ b/lustre/tests/yaml.sh @@ -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() {