From 1749c5e937fc5ccf66f6782769f87836d5a00181 Mon Sep 17 00:00:00 2001 From: Elena Gryaznova Date: Fri, 19 Nov 2010 21:02:00 +0300 Subject: [PATCH] b=23535 sgpdd-survey.sh should check for sg_map i=Brian.Murrell check that iokit sgpdd-survey and sg_map are installed --- lustre/tests/sgpdd-survey.sh | 8 ++++++-- lustre/tests/test-framework.sh | 44 ++++++++++++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/lustre/tests/sgpdd-survey.sh b/lustre/tests/sgpdd-survey.sh index de84b44d..7268cd8 100644 --- a/lustre/tests/sgpdd-survey.sh +++ b/lustre/tests/sgpdd-survey.sh @@ -24,8 +24,6 @@ fi # Skip these tests ALWAYS_EXCEPT="$SGPDD_SURVEY_EXCEPT" -SGPDDSURVEY=${SGPDDSURVEY:-$(which sgpdd-survey)} - build_test_filter init_facets_vars @@ -64,6 +62,9 @@ run_sgpdd_facets () { test_1 () { local mdss=$(get_facets MDS) + check_progs_installed $(facets_hosts $mdss) $SGPDDSURVEY sg_map || \ + { skip_env "SGPDDSURVEY=$SGPDDSURVEY or sg_map not found" && return 0; } + run_sgpdd_facets $mdss } run_test 1 "sgpdd-survey, mds, scsidevs" @@ -71,6 +72,9 @@ run_test 1 "sgpdd-survey, mds, scsidevs" test_2 () { local osts=$(get_facets OST) + check_progs_installed $(facets_hosts $osts) $SGPDDSURVEY sg_map || \ + { skip_env "SGPDDSURVEY=$SGPDDSURVEY or sg_map not found" && return 0; } + run_sgpdd_facets $osts } run_test 2 "sgpdd-survey, osts, scsidevs" diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index bd45247..6788dbb 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -143,9 +143,13 @@ init_test_env() { if ! echo $PATH | grep -q $LUSTRE/tests; then export PATH=$LUSTRE/tests:$PATH fi + if ! echo $PATH | grep -q $LUSTRE/../lustre-iokit/sgpdd-survey; then + export PATH=$PATH:$LUSTRE/../lustre-iokit/sgpdd-survey + fi export LST=${LST:-"$LUSTRE/../lnet/utils/lst"} [ ! -f "$LST" ] && export LST=$(which lst) - export SGPDDSURVEY=${SGPDDSURVEY:-$(which sgpdd-survey)} + export SGPDDSURVEY=${SGPDDSURVEY:-"$LUSTRE/../lustre-iokit/sgpdd-survey/sgpdd-survey")} + [ ! -f "$SGPDDSURVEY" ] && export SGPDDSURVEY=$(which sgpdd-survey) # Ubuntu, at least, has a truncate command in /usr/bin # so fully path our truncate command. export TRUNCATE=${TRUNCATE:-$LUSTRE/tests/truncate} @@ -988,22 +992,38 @@ boot_node() { fi } -# recovery-scale functions +facets_hosts () { + local facets=$1 + local hosts + + for facet in ${facets//,/ }; do + hosts=$(expand_list $hosts $(facet_host $facet) ) + done + + echo $hosts +} + +_check_progs_installed () { + local progs=$@ + local rc=0 + + for prog in $progs; do + if ! [ "$(which $prog)" -o "${!prog}" ]; then + echo $prog missing on $(hostname) + rc=1 + fi + done + return $rc +} + check_progs_installed () { - local clients=$1 + local nodes=$1 shift - local progs=$@ - do_nodes $clients "PATH=:$PATH; status=true; -for prog in $progs; do - if ! [ \\\"\\\$(which \\\$prog)\\\" -o \\\"\\\${!prog}\\\" ]; then - echo \\\$prog missing on \\\$(hostname); - status=false; - fi -done; -eval \\\$status" + do_rpc_nodes $nodes _check_progs_installed $@ } +# recovery-scale functions client_var_name() { echo __$(echo $1 | tr '-' 'X') } -- 1.8.3.1