Whamcloud - gitweb
LU-6142 tests: Fix style issues for statmany.c
[fs/lustre-release.git] / lustre / tests / lnet-selftest.sh
index 6155c8b..ba5b379 100755 (executable)
@@ -42,11 +42,16 @@ lst_TESTS=${lst_TESTS:-"write read ping"}
 # "simple" -> LST_BRW_CHECK_SIMPLE
 lst_CHECK=${lst_CHECK:-"full"}
 
+lst_FROM=${lst_FROM:-"cs"}
+
 case $lst_CHECK in
        full|simple) check="check=$lst_CHECK";;
        none) check="";;
        *) error Unknown flag $lst_CHECK;;
 esac
+
+LOAD_MODULES_REMOTE=true load_modules
+
 nodes=$(comma_list "$(osts_nodes) $(mdts_nodes)")
 lst_SERVERS=${lst_SERVERS:-$(comma_list "$(host_nids_address $nodes $NETTYPE)")}
 lst_CLIENTS=${lst_CLIENTS:-$(comma_list "$(host_nids_address $CLIENTS $NETTYPE)")}
@@ -100,29 +105,38 @@ lst_prepare () {
 
 # make batch
 test_smoke_sub () {
-    local servers=$1
-    local clients=$2
+       local servers=$1
+       local clients=$2
+
+       local nc=$(echo ${clients//,/ } | wc -w)
+       local ns=$(echo ${servers//,/ } | wc -w)
+       echo '#!/bin/bash'
+       echo 'set -e'
+
+       echo 'cleanup () { trap 0; echo killing $1 ... ; kill -9 $1 || true; }'
 
-    local nc=$(echo ${clients//,/ } | wc -w)
-    local ns=$(echo ${servers//,/ } | wc -w)
-    echo '#!/bin/bash'
-    echo 'set -e'
+       echo "$LST new_session --timeo 100000 hh"
+       echo "$LST add_group c $(nids_list $clients)"
+       echo "$LST add_group s $(nids_list $servers)"
+       echo "$LST add_batch b"
 
-    echo 'cleanup () { trap 0; echo killing $1 ... ; kill -9 $1 || true; }'
+       declare -a tests
 
-    echo "$LST new_session --timeo 100000 hh"
-    echo "$LST add_group c $(nids_list $clients)"
-    echo "$LST add_group s $(nids_list $servers)"
-    echo "$LST add_batch b"
+       case $lst_FROM in
+               c) tests[0]="${nc}:${ns} --from c --to s";;
+               s) tests[0]="${ns}:${nc} --from s --to c";;
+               cs)tests[0]="${nc}:${ns} --from c --to s"
+                  tests[1]="${ns}:${nc} --from s --to c";;
+               *) error Unknown flag $lst_FROM;;
+       esac
 
        pre="$LST add_test --batch b --loop $lst_LOOP "
        for t in $lst_TESTS; do
                for s in $lst_SIZES; do
                        for c in $lst_CONCR; do
-                               for d in "${nc}:${ns} --from c --to s" \
-                                       "${ns}:${nc} --from s --to c"; do
+                               for ((i=0; i<${#tests[@]}; i++)); do
                                        echo -n "$pre --concurrency $c"\
-                                               " --distribute $d "
+                                               " --distribute ${tests[i]} "
                                        case $t in
                                                read|write)
                                                        echo -n "brw $t" \
@@ -137,23 +151,22 @@ test_smoke_sub () {
                done
        done
 
-    echo $LST run b
-    echo sleep 1
-    echo "$LST stat --delay 10 --timeout 10 c s &"
-    echo 'pid=$!'
-    echo 'trap "cleanup $pid" INT TERM'
-    echo sleep $smoke_DURATION
-    echo 'cleanup $pid'
-    
+       echo $LST run b
+       echo sleep 1
+       echo "$LST stat --delay 10 --timeout 10 c s &"
+       echo 'pid=$!'
+       echo 'trap "cleanup $pid" INT TERM'
+       echo sleep $smoke_DURATION
+       echo 'cleanup $pid'
 }
 
 run_lst () {
-   local file=$1
+       local file=$1
 
-   export LST_SESSION=$$
+       export LST_SESSION=$$
 
-   # start lst
-   sh $file
+       # start lst
+       bash $file
 }
 
 check_lst_err () {