Whamcloud - gitweb
b=23535 sgpdd-survey.sh should check for sg_map
authorElena Gryaznova <elena.gryaznova@oracle.com>
Tue, 30 Nov 2010 16:20:43 +0000 (19:20 +0300)
committerAndrew Perepechko <andrew.perepechko@oracle.com>
Wed, 1 Dec 2010 03:17:39 +0000 (06:17 +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 4acd537..a9720e6 100644 (file)
@@ -19,8 +19,6 @@ size=${size:-1024}
 # Skip these tests
 ALWAYS_EXCEPT="$SGPDD_SURVEY_EXCEPT"
 
-SGPDDSURVEY=${SGPDDSURVEY:-$(which sgpdd-survey)}
-
 build_test_filter
 
 init_facets_vars
@@ -35,37 +33,43 @@ run_sgpdd_host () {
     do_rpc_nodes $host run_sgpdd $devs "$params"
 }
 
-test_1 () {
-    local facet=mds
-
-    local host=$(facet_host $facet)
-    local dev=${facet}_dev
-    echo "=== $facet === $host === ${!dev} ==="
-    run_sgpdd_host $host ${!dev}
-}
-run_test 1 "sgpdd-survey, mds, scsidevs"
-
-test_2 () {
+run_sgpdd_facets () {
+    local facets=$1
     local facet
 
-    local osts=$(get_facets OST)
-    
-    local ostshosts
-    for facet in ${osts//,/ }; do
+    local facetshosts
+    for facet in ${facets//,/ }; do
         local host=$(facet_host $facet)
         local dev=${facet}_dev
         local var=${host}_devs
         eval ${var}=$(expand_list ${!var} ${!dev})
-       ostshosts=$(expand_list $ostshosts $host)
+        facetshosts=$(expand_list $facetshosts $host)
     done
 
-    for host in ${ostshosts//,/ }; do
-       var=${host}_devs
-        echo "=== osts === $host === ${!var} ==="
+    for host in ${facetshosts//,/ }; do
+        var=${host}_devs
+        echo "=== $facets === $host === ${!var} ==="
         local scsidevs=${!var}
         run_sgpdd_host $host ${scsidevs}
     done
 }
+
+test_1 () {
+    check_progs_installed $(facets_hosts mds) $SGPDDSURVEY sg_map || \
+        { skip_env "SGPDDSURVEY=$SGPDDSURVEY or sg_map not found" && return 0; }
+
+    run_sgpdd_facets mds
+}
+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"
 
 equals_msg `basename $0`: test complete, cleaning up
index 96557f3..ef79537 100644 (file)
@@ -127,9 +127,13 @@ init_test_env() {
     if ! echo $PATH | grep -q $LUSTRE/test; then
        export PATH=$PATH:$LUSTRE/tests
     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)
     export MDSRATE=${MDSRATE:-"$LUSTRE/tests/mpi/mdsrate"}
     [ ! -f "$MDSRATE" ] && export MDSRATE=$(which mdsrate 2> /dev/null)
     if ! echo $PATH | grep -q $LUSTRE/tests/racer; then
@@ -831,22 +835,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')
 }