Whamcloud - gitweb
LU-13274 uapi: make lustre UAPI headers C99 compliant
[fs/lustre-release.git] / lustre / tests / lnet-selftest.sh
index 0c70ae4..4d655f6 100755 (executable)
@@ -1,15 +1,22 @@
 #!/bin/bash
-# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
-# vim:shiftwidth=4:softtabstop=4:tabstop=4:
 
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
-#
-ALWAYS_EXCEPT="$ALWAYS_EXCEPT $LNET_SELFTEST_EXCEPT"
+ALWAYS_EXCEPT="$LNET_SELFTEST_EXCEPT"
+if (( $LINUX_VERSION_CODE >= $(version_code 4.4.0) )); then
+       # bug number for skipped test: LU-10073
+       ALWAYS_EXCEPT+="               smoke "
+fi
+
+if [[ $(uname -m) = ppc64 ]]; then
+       # bug number for skipped test: LU-10073
+       ALWAYS_EXCEPT+="               smoke "
+fi
+
+build_test_filter
 
 [ x$LST = x ] && skip_env "lst not found LST=$LST"
 
@@ -28,6 +35,20 @@ if [ "$SLOW" = no ]; then
     [ $smoke_DURATION -le 300 ] || smoke_DURATION=300
 fi
 
+lst_TESTS=${lst_TESTS:-"write read ping"}
+
+# "none" -> LST_BRW_CHECK_NONE
+# "full" -> LST_BRW_CHECK_FULL
+# "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
 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)")}
@@ -51,12 +72,6 @@ _restore_mount () {
        fi
 }
 
-is_mounted () {
-    local mntpt=$1
-    local mounted=$(mounted_lustre_filesystems)
-    echo $mounted' ' | grep -w -q $mntpt' '
-}
-
 if local_mode; then
    lst_SERVERS=`hostname`
    lst_CLIENTS=`hostname`
@@ -79,8 +94,6 @@ if is_mounted $MOUNT2; then
        interim_umount1=true
 fi
 
-build_test_filter
-
 lst_prepare () {
     # Workaround for bug 15619
     lst_cleanup_all
@@ -92,7 +105,6 @@ test_smoke_sub () {
     local servers=$1
     local clients=$2
 
-
     local nc=$(echo ${clients//,/ } | wc -w)
     local ns=$(echo ${servers//,/ } | wc -w)
     echo '#!/bin/bash'
@@ -105,24 +117,36 @@ test_smoke_sub () {
     echo "$LST add_group s $(nids_list $servers)"
     echo "$LST add_batch b"
 
-    pre="$LST add_test --batch b --loop $lst_LOOP "
-    for t in "brw read" "brw write" ; 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
-                    echo -n "$pre"
-                    echo " --concurrency $c --distribute $d $t check=full size=$s"
-                 done
-            done
-        done
-    done
-
-    for c in $lst_CONCR; do
-        for d in "${nc}:${ns} --from c --to s" "${ns}:${nc} --from s --to c"; do
-            echo -n "$pre"
-            echo " --concurrency $c --distribute $d ping "
-        done
-    done
+       declare -a tests
+
+       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 ((i=0; i<${#tests[@]}; i++)); do
+                                       echo -n "$pre --concurrency $c"\
+                                               " --distribute ${tests[i]} "
+                                       case $t in
+                                               read|write)
+                                                       echo -n "brw $t" \
+                                                       " $check size=$s";;
+                                               ping)
+                                                       echo -n $t;;
+                                               *) error Unknonwn LST test;;
+                                       esac
+                                       echo
+                               done
+                       done
+               done
+       done
 
     echo $LST run b
     echo sleep 1