2 # -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
3 # vim:shiftwidth=4:softtabstop=4:tabstop=4:
5 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
6 . $LUSTRE/tests/test-framework.sh
8 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
11 ALWAYS_EXCEPT="$LNET_SELFTEST_EXCEPT"
12 if (( $LINUX_VERSION_CODE >= $(version_code 4.4.0) )); then
13 # bug number for skipped test: LU-10073
14 ALWAYS_EXCEPT+=" smoke"
17 [ x$LST = x ] && skip_env "lst not found LST=$LST"
19 # FIXME: what is the reasonable value here?
20 lst_LOOP=${lst_LOOP:-100000}
21 lst_CONCR=${lst_CONCR:-"1 2 4 8"}
22 lst_SIZES=${lst_SIZES:-"4k 8k 256k 1M"}
23 if [ "$SLOW" = no ]; then
29 smoke_DURATION=${smoke_DURATION:-1800}
30 if [ "$SLOW" = no ]; then
31 [ $smoke_DURATION -le 300 ] || smoke_DURATION=300
34 nodes=$(comma_list "$(osts_nodes) $(mdts_nodes)")
35 lst_SERVERS=${lst_SERVERS:-$(comma_list "$(host_nids_address $nodes $NETTYPE)")}
36 lst_CLIENTS=${lst_CLIENTS:-$(comma_list "$(host_nids_address $CLIENTS $NETTYPE)")}
41 # _restore_mount(): This function calls restore_mount function for "MOUNT" and
42 # "MOUNT2" paths to mount clients if they were not mounted and were umounted
43 # in this file earlier.
45 # Returns: None. Exit with error if client mount fails.
48 if $interim_umount && ! is_mounted $MOUNT; then
49 restore_mount $MOUNT || error "Restore $MOUNT failed"
52 if $interim_umount1 && ! is_mounted $MOUNT2; then
53 restore_mount $MOUNT2 || error "Restore $MOUNT2 failed"
59 local mounted=$(mounted_lustre_filesystems)
60 echo $mounted' ' | grep -w -q $mntpt' '
64 lst_SERVERS=`hostname`
65 lst_CLIENTS=`hostname`
68 # FIXME: do we really need to unload lustre modules on all nodes?
69 # bug 19387, comment 9
70 # unloading lustre modules is not strictly necessary but unmounting
71 # /mnt/lustre before running lst would be useful:
72 # 1) because lustre messages clutter logs - we needn't them for testing LNET
73 # 2) it's theoretically possible that lst tests congest comm paths so tightly
74 # that mounted lustre wouldn't able to perform some of its background activities
75 if is_mounted $MOUNT; then
76 cleanup_mount $MOUNT || error "Fail to unmount client $MOUNT"
80 if is_mounted $MOUNT2; then
81 cleanup_mount $MOUNT2 || error "Fail to unmount client $MOUNT2"
88 # Workaround for bug 15619
99 local nc=$(echo ${clients//,/ } | wc -w)
100 local ns=$(echo ${servers//,/ } | wc -w)
104 echo 'cleanup () { trap 0; echo killing $1 ... ; kill -9 $1 || true; }'
106 echo "$LST new_session --timeo 100000 hh"
107 echo "$LST add_group c $(nids_list $clients)"
108 echo "$LST add_group s $(nids_list $servers)"
109 echo "$LST add_batch b"
111 pre="$LST add_test --batch b --loop $lst_LOOP "
112 for t in "brw read" "brw write" ; do
113 for s in $lst_SIZES; do
114 for c in $lst_CONCR; do
115 for d in "${nc}:${ns} --from c --to s" "${ns}:${nc} --from s --to c"; do
117 echo " --concurrency $c --distribute $d $t check=full size=$s"
123 for c in $lst_CONCR; do
124 for d in "${nc}:${ns} --from c --to s" "${ns}:${nc} --from s --to c"; do
126 echo " --concurrency $c --distribute $d ping "
132 echo "$LST stat --delay 10 --timeout 10 c s &"
134 echo 'trap "cleanup $pid" INT TERM'
135 echo sleep $smoke_DURATION
143 export LST_SESSION=$$
154 if awk '/^Total.*nodes/ {print $2}' $log | grep -vq '^0$'; then
156 error 'lst Error found'
163 local servers=$lst_SERVERS
164 local clients=$lst_CLIENTS
166 local runlst=$TMP/smoke.sh
168 local log=$TMP/$tfile.log
171 test_smoke_sub $servers $clients 2>&1 > $runlst
175 run_lst $runlst | tee $log
177 [ $rc = 0 ] || { _restore_mount; error "$runlst failed: $rc"; }
179 lst_end_session --verbose | tee -a $log
181 # error counters in "lst show_error" should be checked
185 run_test smoke "lst regression test"
189 check_and_cleanup_lustre