3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
10 # bug number for skipped test:
11 ALWAYS_EXCEPT="$SANITY_LNET_EXCEPT "
12 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
13 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
15 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
17 . $LUSTRE/tests/test-framework.sh
21 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
26 export LNETCTL=${LNETCTL:-"$LUSTRE/../lnet/utils/lnetctl"}
27 [ ! -f "$LNETCTL" ] &&
28 export LNETCTL=$(which lnetctl 2> /dev/null)
29 [[ -z $LNETCTL ]] && skip "Need lnetctl"
33 if is_mounted $MOUNT || is_mounted $MOUNT2; then
34 cleanupall || error "Failed cleanup prior to test execution"
39 echo "Cleaning up LNet"
40 $LNETCTL lnet unconfigure 2>/dev/null
45 if module_loaded lnet ; then
46 cleanup_lnet || error "Failed to unload modules before test execution"
51 rm -f $TMP/sanity-dlc*
54 if $restore_mounts; then
55 setupall || error "Failed to setup Lustre after test execution"
56 elif $restore_modules; then
58 error "Couldn't load modules after test execution"
64 load_module ../libcfs/libcfs/libcfs
65 # Prevent local MODOPTS_LIBCFS being passed as part of environment
66 # variable to remote nodes
70 load_module ../lnet/lnet/lnet "$@"
72 LNDPATH=${LNDPATH:-"../lnet/klnds"}
73 if [ -z "$LNETLND" ]; then
75 o2ib*) LNETLND="o2iblnd/ko2iblnd" ;;
76 tcp*) LNETLND="socklnd/ksocklnd" ;;
77 *) local lnd="${NETTYPE%%[0-9]}lnd"
78 [ -f "$LNDPATH/$lnd/k$lnd.ko" ] &&
79 LNETLND="$lnd/k$lnd" ||
80 LNETLND="socklnd/ksocklnd"
83 load_module ../lnet/klnds/$LNETLND
95 echo "ip netns exec $TESTNS $@"
96 ip netns exec $TESTNS "$@"
103 ip link add 'test1pl' type veth peer name $FAKE_IF netns $TESTNS
104 ip link set 'test1pl' up
105 do_ns ip addr add "${FAKE_IP}/31" dev $FAKE_IF
106 do_ns ip link set $FAKE_IF up
110 (ip netns list | grep -q $TESTNS) && ip netns del $TESTNS
111 if ip link show test1pl >/dev/null 2>&1; then
122 do_lnetctl lnet configure
124 run_test 1 "configure lnet with lnetctl"
127 ### load lnet in default namespace, configure in target namespace
130 cleanup_lnet || exit 1
131 load_lnet "networks=\"\""
132 do_ns $LNETCTL lnet configure --all || exit 1
133 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
135 run_test 2 "load lnet w/o module option, configure in a non-default namespace"
138 cleanup_lnet || exit 1
139 load_lnet "networks=tcp($FAKE_IF)"
140 do_ns $LNETCTL lnet configure --all || exit 1
141 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
143 run_test 3 "load lnet using networks module options in a non-default namespace"
146 cleanup_lnet || exit 1
147 load_lnet "networks=\"\" ip2nets=\"tcp0($FAKE_IF) ${FAKE_IP}\""
148 do_ns $LNETCTL lnet configure --all || exit 1
149 $LNETCTL net show | grep -q "nid: ${FAKE_IP}@tcp$"
151 run_test 4 "load lnet using ip2nets in a non-default namespace"
154 ### Add the interfaces in the target namespace
157 cleanup_lnet || exit 1
159 do_lnetctl lnet configure || exit 1
160 do_ns $LNETCTL net add --net tcp0 --if $FAKE_IF
162 run_test 5 "add a network using an interface in the non-default namespace"