Whamcloud - gitweb
b=23535 sgpdd-survey.sh should check for sg_map
authorElena Gryaznova <elena.gryaznova@oracle.com>
Fri, 19 Nov 2010 18:02:00 +0000 (21:02 +0300)
committerVitaly Fertman <vitaly.fertman@oracle.com>
Tue, 23 Nov 2010 21:18:37 +0000 (00:18 +0300)
i=Brian.Murrell

check that iokit sgpdd-survey and sg_map are installed

lustre/tests/sgpdd-survey.sh
lustre/tests/test-framework.sh

index de84b44..7268cd8 100644 (file)
@@ -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"
index bd45247..6788dbb 100644 (file)
@@ -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')
 }