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 [[ -z $LNETCTL ]] && skip "Need lnetctl"
29 load_module ../libcfs/libcfs/libcfs
30 # Prevent local MODOPTS_LIBCFS being passed as part of environment
31 # variable to remote nodes
35 load_module ../lnet/lnet/lnet "$@"
37 LNDPATH=${LNDPATH:-"../lnet/klnds"}
38 if [ -z "$LNETLND" ]; then
40 o2ib*) LNETLND="o2iblnd/ko2iblnd" ;;
41 tcp*) LNETLND="socklnd/ksocklnd" ;;
42 *) local lnd="${NETTYPE%%[0-9]}lnd"
43 [ -f "$LNDPATH/$lnd/k$lnd.ko" ] &&
44 LNETLND="$lnd/k$lnd" ||
45 LNETLND="socklnd/ksocklnd"
48 load_module ../lnet/klnds/$LNETLND
52 $LNETCTL lnet unconfigure 2>/dev/null
57 RUN_NS="ip netns exec $TESTNS"
65 ip link add 'test1pl' type veth peer name $FAKE_IF netns $TESTNS
66 ip link set 'test1pl' up
67 $RUN_NS ip addr add "${FAKE_IP}/31" dev $FAKE_IF
68 $RUN_NS ip link set $FAKE_IF up
72 (ip netns list | grep -q $TESTNS) && ip netns del $TESTNS
73 if ip link show test1pl >/dev/null 2>&1; then
84 $LNETCTL lnet configure
86 run_test 1 "configure lnet with lnetctl"
89 ### load lnet in default namespace, configure in target namespace
92 cleanup_lnet || exit 1
93 load_lnet "networks=\"\""
94 $RUN_NS $LNETCTL lnet configure --all || exit 1
95 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
97 run_test 2 "load lnet w/o module option, configure in a non-default namespace"
100 cleanup_lnet || exit 1
101 load_lnet "networks=tcp($FAKE_IF)"
102 $RUN_NS $LNETCTL lnet configure --all || exit 1
103 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
105 run_test 3 "load lnet using networks module options in a non-default namespace"
108 cleanup_lnet || exit 1
109 load_lnet "networks=\"\" ip2nets=\"tcp0($FAKE_IF) ${FAKE_IP}\""
110 $RUN_NS $LNETCTL lnet configure --all || exit 1
111 $LNETCTL net show | grep -q "nid: ${FAKE_IP}@tcp$"
113 run_test 4 "load lnet using ip2nets in a non-default namespace"
116 ### Add the interfaces in the target namespace
119 cleanup_lnet || exit 1
121 $LNETCTL lnet configure || exit 1
122 $RUN_NS $LNETCTL net add --net tcp0 --if $FAKE_IF
124 run_test 5 "add a network using an interface in the non-default namespace"