3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
11 # bug number for skipped test:
12 ALWAYS_EXCEPT="$SANITY_LNET_EXCEPT "
13 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
15 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
17 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
19 . $LUSTRE/tests/test-framework.sh
23 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
28 export LNETCTL=${LNETCTL:-"$LUSTRE/../lnet/utils/lnetctl"}
29 [ ! -f "$LNETCTL" ] &&
30 export LNETCTL=$(which lnetctl 2> /dev/null)
31 [[ -z $LNETCTL ]] && skip "Need lnetctl"
35 if is_mounted $MOUNT || is_mounted $MOUNT2; then
36 cleanupall || error "Failed cleanup prior to test execution"
41 echo "Cleaning up LNet"
42 lsmod | grep -q lnet &&
43 $LNETCTL lnet unconfigure 2>/dev/null
48 if module_loaded lnet ; then
49 cleanup_lnet || error "Failed to unload modules before test execution"
55 rm -f $TMP/sanity-dlc*
58 if $restore_mounts; then
59 setupall || error "Failed to setup Lustre after test execution"
60 elif $restore_modules; then
62 error "Couldn't load modules after test execution"
68 load_module ../libcfs/libcfs/libcfs
69 # Prevent local MODOPTS_LIBCFS being passed as part of environment
70 # variable to remote nodes
73 set_default_debug "neterror net nettrace malloc"
74 load_module ../lnet/lnet/lnet "$@"
76 LNDPATH=${LNDPATH:-"../lnet/klnds"}
77 if [ -z "$LNETLND" ]; then
79 o2ib*) LNETLND="o2iblnd/ko2iblnd" ;;
80 tcp*) LNETLND="socklnd/ksocklnd" ;;
81 *) local lnd="${NETTYPE%%[0-9]}lnd"
82 [ -f "$LNDPATH/$lnd/k$lnd.ko" ] &&
83 LNETLND="$lnd/k$lnd" ||
84 LNETLND="socklnd/ksocklnd"
87 load_module ../lnet/klnds/$LNETLND
99 echo "ip netns exec $TESTNS $@"
100 ip netns exec $TESTNS "$@"
108 netns_arg="netns $netns"
110 ip link add 'test1pl' type veth peer name $FAKE_IF $netns_arg
111 ip link set 'test1pl' up
112 if [[ -n $netns ]]; then
113 do_ns ip addr add "${FAKE_IP}/31" dev $FAKE_IF
114 do_ns ip link set $FAKE_IF up
116 ip addr add "${FAKE_IP}/31" dev $FAKE_IF
117 ip link set $FAKE_IF up
122 ip link show test1pl >& /dev/null && ip link del test1pl || return 0
133 (ip netns list | grep -q $TESTNS) && ip netns del $TESTNS
138 echo "Loading LNet and configuring DLC"
140 do_lnetctl lnet configure
143 GLOBAL_YAML_FILE=$TMP/sanity-lnet-global.yaml
144 define_global_yaml() {
145 $LNETCTL export --backup >${GLOBAL_YAML_FILE} ||
146 error "Failed to export global yaml $?"
150 if lsmod | grep -q lnet; then
151 do_lnetctl lnet unconfigure ||
152 error "lnetctl lnet unconfigure failed $?"
153 do_lnetctl lnet configure ||
154 error "lnetctl lnet configure failed $?"
156 configure_dlc || error "configure_dlc failed $?"
161 append_global_yaml() {
162 [[ ! -e ${GLOBAL_YAML_FILE} ]] &&
163 error "Missing global yaml at ${GLOBAL_YAML_FILE}"
165 cat ${GLOBAL_YAML_FILE} >> $TMP/sanity-lnet-$testnum-expected.yaml
168 create_base_yaml_file() {
172 compare_yaml_files() {
173 local expected="$TMP/sanity-lnet-$testnum-expected.yaml"
174 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
176 ! [[ -e $expected ]] && echo "$expected not found" && return 1
177 ! [[ -e $actual ]] && echo "$actual not found" && return 1
178 diff -upN ${actual} ${expected} || rc=$?
188 local net="${nid//*@/}"
189 local addr="${nid//@*/}"
191 local num_re='[0-9]\+'
192 local ip_re="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
194 if [[ $net =~ gni[0-9]* ]]; then
195 [[ $addr =~ ${num_re} ]] && return 0
197 [[ $addr =~ ${ip_re} ]] && return 0
202 local yfile=$TMP/sanity-lnet-$testnum-actual.yaml
203 local primary_nids=$(awk '/- primary nid:/{print $NF}' $yfile | xargs echo)
204 local secondary_nids=$(awk '/- nid:/{print $NF}' $yfile | xargs echo)
205 local gateway_nids=$(awk '/gateway:/{print $NF}' $yfile | xargs echo)
208 for nid in $primary_nids $secondary_nids; do
209 validate_nid "$nid" || error "Bad NID \"${nid}\""
214 validate_peer_nids() {
216 local nids_per_peer="$2"
218 local expect_p="$num_peers"
219 # The primary nid also shows up in the list of secondary nids
220 local expect_s="$(($num_peers + $(($nids_per_peer*$num_peers))))"
222 local actual_p=$(grep -c -- '- primary nid:' $TMP/sanity-lnet-$testnum-actual.yaml)
223 local actual_s=$(grep -c -- '- nid:' $TMP/sanity-lnet-$testnum-actual.yaml)
224 if [[ $expect_p -ne $actual_p ]]; then
226 error "Expected $expect_p but found $actual_p primary nids"
227 elif [[ $expect_s -ne $actual_s ]]; then
229 error "Expected $expect_s but found $actual_s secondary nids"
234 validate_gateway_nids() {
235 local expect_gw=$(grep -c -- 'gateway:' $TMP/sanity-lnet-$testnum-expected.yaml)
236 local actual_gw=$(grep -c -- 'gateway:' $TMP/sanity-lnet-$testnum-actual.yaml)
237 if [[ $expect_gw -ne $actual_gw ]]; then
239 error "Expected $expect_gw gateways but found $actual_gw gateways"
245 setup_netns || error "setup_netns failed with $?"
247 stack_trap 'cleanup_testsuite' EXIT
250 load_module ../lnet/lnet/lnet || error "Failed to load module rc = $?"
251 do_lnetctl lnet configure || error "lnet configure failed rc = $?"
253 reinit_dlc || return $?
254 do_lnetctl import < ${GLOBAL_YAML_FILE} || error "Import failed $?"
255 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
256 create_base_yaml_file
257 compare_yaml_files || error "Configuration changed after import"
259 run_test 0 "Export empty config, import the config, compare"
262 local prim_nid="${1:+--prim_nid $1}"
263 local nid="${2:+--nid $2}"
265 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
267 do_lnetctl peer add ${prim_nid} ${nid} || error "peer add failed $?"
268 $LNETCTL export --backup > $actual || error "export failed $?"
274 reinit_dlc || return $?
275 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
277 - primary nid: 1.1.1.1@tcp
283 compare_peer_add "1.1.1.1@tcp"
285 run_test 1 "Add peer with single nid (tcp)"
288 reinit_dlc || return $?
289 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
291 - primary nid: 2.2.2.2@o2ib
297 compare_peer_add "2.2.2.2@o2ib"
299 run_test 2 "Add peer with single nid (o2ib)"
302 reinit_dlc || return $?
303 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
305 - primary nid: 3.3.3.3@tcp
312 compare_peer_add "3.3.3.3@tcp" "3.3.3.3@o2ib"
314 run_test 3 "Add peer with tcp primary o2ib secondary"
317 reinit_dlc || return $?
318 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
320 - primary nid: 4.4.4.4@tcp
329 echo "Add peer with nidrange (tcp)"
330 compare_peer_add "4.4.4.4@tcp" "4.4.4.[1-3]@tcp"
332 echo "Add peer with nidrange that overlaps primary nid (tcp)"
333 compare_peer_add "4.4.4.4@tcp" "4.4.4.[1-4]@tcp"
335 run_test 4 "Add peer with nidrange (tcp)"
338 reinit_dlc || return $?
339 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
341 - primary nid: 5.5.5.5@o2ib
351 echo "Add peer with nidrange (o2ib)"
352 compare_peer_add "5.5.5.5@o2ib" "5.5.5.[1-4]@o2ib"
354 echo "Add peer with nidranage that overlaps primary nid (o2ib)"
355 compare_peer_add "5.5.5.5@o2ib" "5.5.5.[1-4]@o2ib"
357 run_test 5 "Add peer with nidrange (o2ib)"
360 reinit_dlc || return $?
361 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
363 - primary nid: 6.6.6.6@tcp
383 compare_peer_add "6.6.6.6@tcp" \
384 "6.6.[6-7].[0-4/2]@tcp,6.6.[1-4/2].[0-6/3]@o2ib,[6-12/4]@gni"
386 run_test 6 "Add peer with multiple nidranges"
389 local prim_nid="${1:+--prim_nid $1}"
390 local nid="${2:+--nid $2}"
392 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
394 do_lnetctl peer del ${prim_nid} ${nid} || error "peer del failed $?"
395 $LNETCTL export --backup > $actual || error "export failed $?"
401 reinit_dlc || return $?
402 create_base_yaml_file
404 echo "Delete peer with single nid (tcp)"
405 do_lnetctl peer add --prim_nid 7.7.7.7@tcp || error "Peer add failed $?"
406 compare_peer_del "7.7.7.7@tcp"
408 echo "Delete peer with single nid (o2ib)"
409 do_lnetctl peer add --prim_nid 7.7.7.7@o2ib || error "Peer add failed $?"
410 compare_peer_del "7.7.7.7@o2ib"
412 echo "Delete peer that has multiple nids (tcp)"
413 do_lnetctl peer add --prim_nid 7.7.7.7@tcp --nid 7.7.7.[8-12]@tcp ||
414 error "Peer add failed $?"
415 compare_peer_del "7.7.7.7@tcp"
417 echo "Delete peer that has multiple nids (o2ib)"
418 do_lnetctl peer add --prim_nid 7.7.7.7@o2ib --nid 7.7.7.[8-12]@o2ib ||
419 error "Peer add failed $?"
420 compare_peer_del "7.7.7.7@o2ib"
422 echo "Delete peer that has both tcp and o2ib nids"
423 do_lnetctl peer add --prim_nid 7.7.7.7@tcp \
424 --nid 7.7.7.[9-12]@tcp,7.7.7.[13-15]@o2ib ||
425 error "Peer add failed $?"
426 compare_peer_del "7.7.7.7@tcp"
428 echo "Delete peer with single nid (gni)"
429 do_lnetctl peer add --prim_nid 7@gni || error "Peer add failed $?"
430 compare_peer_del "7@gni"
432 echo "Delete peer that has multiple nids (gni)"
433 do_lnetctl peer add --prim_nid 7@gni --nid [8-12]@gni ||
434 error "Peer add failed $?"
435 compare_peer_del "7@gni"
437 echo "Delete peer that has tcp, o2ib and gni nids"
438 do_lnetctl peer add --prim_nid 7@gni \
439 --nid [8-12]@gni,7.7.7.[9-12]@tcp,7.7.7.[13-15]@o2ib ||
440 error "Peer add failed $?"
441 compare_peer_del "7@gni"
443 run_test 7 "Various peer delete tests"
446 reinit_dlc || return $?
448 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
450 - primary nid: 8.8.8.8@tcp
462 do_lnetctl peer add --prim_nid 8.8.8.8@tcp --nid 8.8.8.[10-15]@tcp ||
463 error "Peer add failed $?"
464 compare_peer_del "8.8.8.8@tcp" "8.8.8.13@tcp"
466 run_test 8 "Delete single secondary nid from peer (tcp)"
469 reinit_dlc || return $?
471 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
473 - primary nid: 9.9.9.9@tcp
480 do_lnetctl peer add --prim_nid 9.9.9.9@tcp \
481 --nid 9.9.9.[11-16]@tcp || error "Peer add failed $?"
482 compare_peer_del "9.9.9.9@tcp" "9.9.9.[11-16]@tcp"
484 run_test 9 "Delete all secondary nids from peer (tcp)"
487 reinit_dlc || return $?
489 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
491 - primary nid: 10.10.10.10@tcp
494 - nid: 10.10.10.10@tcp
495 - nid: 10.10.10.12@tcp
496 - nid: 10.10.10.13@tcp
497 - nid: 10.10.10.15@tcp
498 - nid: 10.10.10.16@tcp
501 do_lnetctl peer add --prim_nid 10.10.10.10@tcp \
502 --nid 10.10.10.[12-16]@tcp || error "Peer add failed $?"
503 compare_peer_del "10.10.10.10@tcp" "10.10.10.14@tcp"
505 run_test 10 "Delete single secondary nid from peer (o2ib)"
508 reinit_dlc || return $?
510 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
512 - primary nid: 11.11.11.11@tcp
515 - nid: 11.11.11.11@tcp
518 do_lnetctl peer add --prim_nid 11.11.11.11@tcp \
519 --nid 11.11.11.[13-17]@tcp || error "Peer add failed $?"
520 compare_peer_del "11.11.11.11@tcp" "11.11.11.[13-17]@tcp"
522 run_test 11 "Delete all secondary nids from peer (o2ib)"
525 reinit_dlc || return $?
527 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
529 - primary nid: 12.12.12.12@o2ib
532 - nid: 12.12.12.12@o2ib
533 - nid: 13.13.13.13@o2ib
534 - nid: 14.13.13.13@o2ib
535 - nid: 14.15.13.13@o2ib
537 - nid: 15.17.1.10@tcp
538 - nid: 15.17.1.20@tcp
541 do_lnetctl peer add --prim_nid 12.12.12.12@o2ib \
542 --nid [13-14/1].[13-15/2].13.13@o2ib,[15-16/3].[17-19/4].[1].[5-20/5]@tcp ||
543 error "Peer add failed $?"
544 compare_peer_del "12.12.12.12@o2ib" "13.15.13.13@o2ib,15.17.1.15@tcp"
546 run_test 12 "Delete a secondary nid from peer (tcp and o2ib)"
549 reinit_dlc || return $?
551 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
553 - primary nid: 13.13.13.13@o2ib
556 - nid: 13.13.13.13@o2ib
559 do_lnetctl peer add --prim_nid 13.13.13.13@o2ib \
560 --nid [14-15].[1-2/1].[1].[100-254/10]@tcp,14.14.[254].14@o2ib ||
561 error "Peer add failed $?"
562 compare_peer_del "13.13.13.13@o2ib" \
563 "[14-15].[1-2/1].[1].[100-254/10]@tcp,14.14.[254].14@o2ib"
565 run_test 13 "Delete all secondary nids from peer (tcp and o2ib)"
571 if [[ $net =~ gni* ]]; then
574 echo "${num}.${num}.${num}.${num}@${net}"
578 create_mr_peer_yaml() {
580 local secondary_nids="$2"
583 echo "Generating peer yaml for $num_peers peers with $secondary_nids secondary nids"
584 echo "peer:" >> $TMP/sanity-lnet-$testnum-expected.yaml
586 local total_nids=$((num_peers + $((num_peers * secondary_nids))))
589 while [[ $created -lt $num_peers ]]; do
590 local primary=$(create_nid ${nidnum} ${net})
591 cat <<EOF >> $TMP/sanity-lnet-$testnum-expected.yaml
592 - primary nid: $primary
598 local start=$((nidnum + 1))
599 local end=$((nidnum + $secondary_nids))
600 for j in $(seq ${start} ${end}); do
601 local nid=$(create_nid $j ${net})
602 echo " - nid: $nid" >> $TMP/sanity-lnet-$testnum-expected.yaml
610 reinit_dlc || return $?
612 echo "Create single peer, single nid, using import"
613 create_mr_peer_yaml 1 0 tcp
614 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
615 error "Import failed $?"
617 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
620 echo "Delete single peer using import --del"
621 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
622 error "Import failed $?"
623 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
624 create_base_yaml_file
625 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
628 run_test 14 "import peer create/delete with single nid"
631 reinit_dlc || return $?
633 echo "Create multiple peers, single nid per peer, using import"
634 create_mr_peer_yaml 5 0 o2ib
635 # The ordering of nids for this use-case is non-deterministic, so we
636 # we can't just diff the expected/actual output.
637 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
638 error "Import failed $?"
639 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
640 validate_peer_nids 5 0
642 echo "Delete multiple peers, single nid per peer, using import --del"
643 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
644 error "Import failed $?"
645 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
646 create_base_yaml_file
647 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
650 run_test 15 "import multi peer create/delete with single nid per peer"
653 reinit_dlc || return $?
655 echo "Create single peer, multiple nids, using import"
656 create_mr_peer_yaml 1 5 tcp
657 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
658 error "Import failed $?"
659 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
660 validate_peer_nids 1 5
662 echo "Delete single peer, multiple nids, using import --del"
663 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
664 error "Import failed $?"
665 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
666 create_base_yaml_file
667 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
670 run_test 16 "import peer create/delete with multiple nids"
673 reinit_dlc || return $?
675 echo "Create multiple peers, multiple nids per peer, using import"
676 create_mr_peer_yaml 5 7 o2ib
677 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
678 error "Import failed $?"
679 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
680 validate_peer_nids 5 7
682 echo "Delete multiple peers, multiple nids per peer, using import --del"
683 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
684 error "Import failed $?"
685 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
686 create_base_yaml_file
687 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
690 run_test 17 "import multi peer create/delete with multiple nids"
693 reinit_dlc || return $?
695 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
697 - primary nid: 1.1.1.1@tcp
706 echo "Import peer with 5 nids"
707 cat $TMP/sanity-lnet-$testnum-expected.yaml
708 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
709 error "Import failed $?"
710 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
712 - primary nid: 1.1.1.1@tcp
719 echo "Delete three of the nids"
720 cat $TMP/sanity-lnet-$testnum-expected.yaml
721 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml
722 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
724 - primary nid: 1.1.1.1@tcp
730 echo "Check peer has expected nids remaining"
731 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
735 run_test 18a "Delete a subset of nids from a single peer using import --del"
738 reinit_dlc || return $?
740 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
742 - primary nid: 1.1.1.1@tcp
750 - primary nid: 6.6.6.6@o2ib
759 echo "Import two peers with 5 nids each"
760 cat $TMP/sanity-lnet-$testnum-expected.yaml
761 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
762 error "Import failed $?"
763 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
765 - primary nid: 1.1.1.1@tcp
771 - primary nid: 6.6.6.6@o2ib
778 echo "Delete three of the nids from each peer"
779 cat $TMP/sanity-lnet-$testnum-expected.yaml
780 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml
781 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
783 - primary nid: 6.6.6.6@o2ib
788 - primary nid: 1.1.1.1@tcp
795 echo "Check peers have expected nids remaining"
796 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
798 validate_peer_nids 2 1
800 run_test 18b "Delete multiple nids from multiple peers using import --del"
803 reinit_dlc || return $?
804 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
806 - primary nid: 19@gni
812 compare_peer_add "19@gni"
814 run_test 19 "Add peer with single nid (gni)"
817 reinit_dlc || return $?
818 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
820 - primary nid: 20@gni
824 - nid: 20.20.20.20@tcp
825 - nid: 20.20.20.20@o2ib
828 compare_peer_add "20@gni" "20.20.20.20@tcp,20.20.20.20@o2ib"
830 run_test 20 "Add peer with gni primary and tcp, o2ib secondary"
833 reinit_dlc || return $?
834 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
836 - primary nid: 21@gni
846 echo"Add peer with nidrange (gni)"
847 compare_peer_add "21@gni" "[22-25]@gni" || error
848 echo "Add peer with nidrange that overlaps primary nid (gni)"
849 compare_peer_add "21@gni" "[21-25]@gni"
851 run_test 21 "Add peer with nidrange (gni)"
854 reinit_dlc || return $?
855 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
857 - primary nid: 22@gni
868 do_lnetctl peer add --prim_nid 22@gni --nid [24-29]@gni ||
869 error "Peer add failed $?"
870 compare_peer_del "22@gni" "26@gni"
872 run_test 22 "Delete single secondary nid from peer (gni)"
875 reinit_dlc || return $?
876 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
878 - primary nid: 23@gni
885 do_lnetctl peer add --prim_nid 23@gni --nid [25-29]@gni ||
886 error "Peer add failed $?"
887 compare_peer_del "23@gni" "[25-29]@gni"
889 run_test 23 "Delete all secondary nids from peer (gni)"
892 reinit_dlc || return $?
893 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
895 - primary nid: 24@gni
900 - nid: 13.13.13.13@o2ib
901 - nid: 14.13.13.13@o2ib
902 - nid: 14.15.13.13@o2ib
904 - nid: 15.17.1.10@tcp
905 - nid: 15.17.1.20@tcp
908 do_lnetctl peer add --prim_nid 24@gni \
909 --nid [13-14/1].[13-15/2].13.13@o2ib,[15-16/3].[17-19/4].[1].[5-20/5]@tcp,[5-12/6]@gni ||
910 error "Peer add failed $?"
911 compare_peer_del "24@gni" "5@gni,13.15.13.13@o2ib,15.17.1.15@tcp"
913 run_test 24 "Delete a secondary nid from peer (tcp, o2ib and gni)"
916 reinit_dlc || return $?
917 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
919 - primary nid: 25@gni
925 do_lnetctl peer add --prim_nid 25@gni \
926 --nid [26-27].[4-10/3].26.26@tcp,26.26.26.26@o2ib,[30-35]@gni ||
927 error "Peer add failed $?"
928 compare_peer_del "25@gni" \
929 "[26-27].[4-10/3].26.26@tcp,26.26.26.26@o2ib,[30-35]@gni"
931 run_test 25 "Delete all secondary nids from peer (tcp, gni and o2ib)"
934 reinit_dlc || return $?
936 echo "Invalid prim_nid - peer add"
937 do_lnetctl peer add --prim_nid foobar &&
938 error "Command should have failed"
940 echo "Invalid prim_nid - peer del"
941 do_lnetctl peer del --prim_nid foobar &&
942 error "Command should have failed"
944 echo "Delete non-existing peer"
945 do_lnetctl peer del --prim_nid 1.1.1.1@o2ib &&
946 error "Command should have failed"
948 echo "Don't provide mandatory argument for peer del"
949 do_lnetctl peer del --nid 1.1.1.1@tcp &&
950 error "Command should have failed"
952 echo "Don't provide mandatory argument for peer add"
953 do_lnetctl peer add --nid 1.1.1.1@tcp &&
954 error "Command should have failed"
956 echo "Don't provide mandatory arguments peer add"
957 do_lnetctl peer add &&
958 error "Command should have failed"
960 echo "Invalid secondary nids"
961 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid foobar &&
962 error "Command should have failed"
964 echo "Exceed max nids per peer"
965 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid 1.1.1.[2-255]@tcp &&
966 error "Command should have failed"
968 echo "Invalid net type"
969 do_lnetctl peer add --prim_nid 1@foo &&
970 error "Command should have failed"
972 echo "Invalid nid format"
973 local invalid_nids="1@tcp 1@o2ib 1.1.1.1@gni"
976 for nid in ${invalid_nids}; do
977 echo "Check invalid primary nid - '$nid'"
978 do_lnetctl peer add --prim_nid $nid &&
979 error "Command should have failed"
982 local invalid_strs="[2-1]@gni [a-f/x]@gni 256.256.256.256@tcp"
983 invalid_strs+=" 1.1.1.1.[2-5/f]@tcp 1.]2[.3.4@o2ib"
984 invalid_strs+="1.[2-4,[5-6],7-8].1.1@tcp foobar"
987 for nidstr in ${invalid_strs}; do
988 echo "Check invalid nidstring - '$nidstr'"
989 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid $nidstr &&
990 error "Command should have failed"
993 echo "Add non-local gateway"
994 do_lnetctl route add --net tcp --gateway 1@gni &&
995 error "Command should have failed"
999 run_test 99a "Check various invalid inputs to lnetctl peer"
1002 reinit_dlc || return $?
1004 create_base_yaml_file
1006 cat <<EOF > $TMP/sanity-lnet-$testnum-invalid.yaml
1008 - primary nid: 99.99.99.99@tcp
1011 - nid: 99.99.99.99@tcp
1013 do_lnetctl import < $TMP/sanity-lnet-$testnum-invalid.yaml &&
1014 error "import should have failed"
1015 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
1018 run_test 99b "Invalid value for Multi-Rail in yaml import"
1022 local ip=$(ip addr show dev $if | awk '/ inet /{print $2}')
1030 if ! lsmod | grep -q ksocklnd ; then
1031 load_module ../lnet/klnds/socklnd/ksocklnd ||
1032 error "Can't load ksocklnd.ko"
1035 do_lnetctl net add --net ${net} --if ${if} ||
1036 error "Failed to add net ${net} on if ${if}"
1039 compare_route_add() {
1043 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
1045 do_lnetctl route add --net ${rnet} --gateway ${gw} ||
1046 error "route add failed $?"
1047 # CPT configuration is pruned from the exported yaml, since the default
1048 # can vary across test systems (unlike default values for things like
1049 # peer_credits, peer_timeout, etc.)
1050 $LNETCTL export --backup | grep -v CPT > $actual ||
1051 error "export failed $?"
1052 validate_gateway_nids
1057 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1058 reinit_dlc || return $?
1059 add_net "tcp" "eth0"
1060 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
1069 peer_buffer_credits: 0
1073 gateway: 7.7.7.7@tcp
1076 health_sensitivity: 1
1078 - primary nid: 7.7.7.7@tcp
1084 compare_route_add "tcp7" "7.7.7.7@tcp" || return $?
1087 run_test 100 "Add route with single gw (tcp)"
1090 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1091 reinit_dlc || return $?
1092 add_net "tcp" "eth0"
1093 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
1102 peer_buffer_credits: 0
1106 gateway: 8.8.8.10@tcp
1109 health_sensitivity: 1
1111 gateway: 8.8.8.9@tcp
1114 health_sensitivity: 1
1116 gateway: 8.8.8.8@tcp
1119 health_sensitivity: 1
1121 - primary nid: 8.8.8.9@tcp
1125 - primary nid: 8.8.8.10@tcp
1129 - primary nid: 8.8.8.8@tcp
1135 compare_route_add "tcp8" "8.8.8.[8-10]@tcp"
1137 run_test 101 "Add route with multiple gw (tcp)"
1139 compare_route_del() {
1143 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
1145 do_lnetctl route del --net ${rnet} --gateway ${gw} ||
1146 error "route del failed $?"
1147 $LNETCTL export --backup > $actual ||
1148 error "export failed $?"
1149 validate_gateway_nids
1153 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1154 reinit_dlc || return $?
1155 add_net "tcp" "eth0"
1156 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml
1157 do_lnetctl route add --net tcp102 --gateway 102.102.102.102@tcp ||
1158 error "route add failed $?"
1159 compare_route_del "tcp102" "102.102.102.102@tcp"
1161 run_test 102 "Delete route with single gw (tcp)"
1164 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1165 reinit_dlc || return $?
1166 add_net "tcp" "eth0"
1167 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml
1168 do_lnetctl route add --net tcp103 \
1169 --gateway 103.103.103.[103-120/4]@tcp ||
1170 error "route add failed $?"
1171 compare_route_del "tcp103" "103.103.103.[103-120/4]@tcp"
1173 run_test 103 "Delete route with multiple gw (tcp)"
1176 local tyaml="$TMP/sanity-lnet-$testnum-expected.yaml"
1178 reinit_dlc || return $?
1180 # Default value is '3'
1181 local val=$($LNETCTL global show | awk '/response_tracking/{print $NF}')
1183 error "Expect 3 found $val"
1185 echo "Set < 0; Should fail"
1186 do_lnetctl set response_tracking -1 &&
1187 error "should have failed $?"
1189 reinit_dlc || return $?
1192 response_tracking: -10
1194 do_lnetctl import < $tyaml &&
1195 error "should have failed $?"
1197 echo "Check valid values; Should succeed"
1199 for ((i = 0; i < 4; i++)); do
1200 reinit_dlc || return $?
1201 do_lnetctl set response_tracking $i ||
1202 error "should have succeeded $?"
1203 $LNETCTL global show | grep -q "response_tracking: $i" ||
1204 error "Failed to set response_tracking to $i"
1205 reinit_dlc || return $?
1208 response_tracking: $i
1210 do_lnetctl import < $tyaml ||
1211 error "should have succeeded $?"
1212 $LNETCTL global show | grep -q "response_tracking: $i" ||
1213 error "Failed to set response_tracking to $i"
1216 reinit_dlc || return $?
1217 echo "Set > 3; Should fail"
1218 do_lnetctl set response_tracking 4 &&
1219 error "should have failed $?"
1221 reinit_dlc || return $?
1224 response_tracking: 10
1226 do_lnetctl import < $tyaml &&
1227 error "should have failed $?"
1230 run_test 104 "Set/check response_tracking param"
1232 ### load lnet in default namespace, configure in target namespace
1235 cleanup_lnet || exit 1
1236 load_lnet "networks=\"\""
1237 do_ns $LNETCTL lnet configure --all || exit 1
1238 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
1240 run_test 200 "load lnet w/o module option, configure in a non-default namespace"
1243 cleanup_lnet || exit 1
1244 load_lnet "networks=tcp($FAKE_IF)"
1245 do_ns $LNETCTL lnet configure --all || exit 1
1246 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
1248 run_test 201 "load lnet using networks module options in a non-default namespace"
1251 cleanup_lnet || exit 1
1252 load_lnet "networks=\"\" ip2nets=\"tcp0($FAKE_IF) ${FAKE_IP}\""
1253 do_ns $LNETCTL lnet configure --all || exit 1
1254 $LNETCTL net show | grep -q "nid: ${FAKE_IP}@tcp$"
1256 run_test 202 "load lnet using ip2nets in a non-default namespace"
1259 ### Add the interfaces in the target namespace
1262 cleanup_lnet || exit 1
1264 do_lnetctl lnet configure || exit 1
1265 do_ns $LNETCTL net add --net tcp0 --if $FAKE_IF
1267 run_test 203 "add a network using an interface in the non-default namespace"
1269 LNET_PARAMS_FILE="$TMP/$TESTSUITE.parameters"
1270 function save_lnet_params() {
1271 $LNETCTL global show | egrep -v '^global:$' |
1272 sed 's/://' > $LNET_PARAMS_FILE
1275 function restore_lnet_params() {
1277 while read param value; do
1278 [[ $param == max_intf ]] && continue
1279 [[ $param == lnd_timeout ]] && continue
1280 $LNETCTL set ${param} ${value} ||
1281 error "Failed to restore ${param} to ${value}"
1282 done < $LNET_PARAMS_FILE
1285 function lnet_health_pre() {
1288 # Lower transaction timeout to speed up test execution
1289 $LNETCTL set transaction_timeout 10 ||
1290 error "Failed to set transaction_timeout $?"
1292 # Increase recovery interval so we have time to capture health values
1293 $LNETCTL set recovery_interval 20 ||
1294 error "Failed to set recovery_interval $?"
1296 RETRY_PARAM=$($LNETCTL global show | awk '/retry_count/{print $NF}')
1297 RSND_PRE=$($LNETCTL stats show | awk '/resend_count/{print $NF}')
1298 LO_HVAL_PRE=$($LNETCTL net show -v 2 | awk '/health value/{print $NF}' |
1299 xargs echo | sed 's/ /+/g' | bc -l)
1301 local my_nid=$($LCTL list_nids | head -n 1)
1303 RMT_HVAL_PRE=$($LNETCTL peer show --nid $my_nid -v 2 2>/dev/null |
1304 awk '/health value/{print $NF}' | xargs echo |
1305 sed 's/ /+/g' | bc -l)
1307 # Might not have any peers so initialize to zero.
1308 RMT_HVAL_PRE=${RMT_HVAL_PRE:-0}
1313 function lnet_health_post() {
1314 RSND_POST=$($LNETCTL stats show | awk '/resend_count/{print $NF}')
1315 LO_HVAL_POST=$($LNETCTL net show -v 2 |
1316 awk '/health value/{print $NF}' |
1317 xargs echo | sed 's/ /+/g' | bc -l)
1319 local my_nid=$($LCTL list_nids | head -n 1)
1321 RMT_HVAL_POST=$($LNETCTL peer show --nid $my_nid -v 2 2>/dev/null |
1322 awk '/health value/{print $NF}' | xargs echo |
1323 sed 's/ /+/g' | bc -l)
1325 # Might not have any peers so initialize to zero.
1326 RMT_HVAL_POST=${RMT_HVAL_POST:-0}
1329 echo "Pre resends: $RSND_PRE" &&
1330 echo "Post resends: $RSND_POST" &&
1331 echo "Resends delta: $((RSND_POST - RSND_PRE))" &&
1332 echo "Pre local health: $LO_HVAL_PRE" &&
1333 echo "Post local health: $LO_HVAL_POST" &&
1334 echo "Pre remote health: $RMT_HVAL_PRE" &&
1335 echo "Post remote health: $RMT_HVAL_POST"
1342 function check_no_resends() {
1343 echo "Check that no resends took place"
1344 [[ $RSND_POST -ne $RSND_PRE ]] &&
1345 error "Found resends: $RSND_POST != $RSND_PRE"
1350 function check_resends() {
1351 local delta=$((RSND_POST - RSND_PRE))
1353 echo "Check that $RETRY_PARAM resends took place"
1354 [[ $delta -ne $RETRY_PARAM ]] &&
1355 error "Expected $RETRY_PARAM resends found $delta"
1360 function check_no_local_health() {
1361 echo "Check that local NI health is unchanged"
1362 [[ $LO_HVAL_POST -ne $LO_HVAL_PRE ]] &&
1363 error "Local health changed: $LO_HVAL_POST != $LO_HVAL_PRE"
1368 function check_local_health() {
1369 echo "Check that local NI health has been changed"
1370 [[ $LO_HVAL_POST -eq $LO_HVAL_PRE ]] &&
1371 error "Local health unchanged: $LO_HVAL_POST == $LO_HVAL_PRE"
1376 function check_no_remote_health() {
1377 echo "Check that remote NI health is unchanged"
1378 [[ $RMT_HVAL_POST -ne $RMT_HVAL_PRE ]] &&
1379 error "Remote health changed: $RMT_HVAL_POST != $RMT_HVAL_PRE"
1384 function check_remote_health() {
1385 echo "Check that remote NI health has been changed"
1386 [[ $RMT_HVAL_POST -eq $RMT_HVAL_PRE ]] &&
1387 error "Remote health unchanged: $RMT_HVAL_POST == $RMT_HVAL_PRE"
1392 # See lnet/lnet/lib-msg.c:lnet_health_check()
1393 LNET_LOCAL_RESEND_STATUSES="local_interrupt local_dropped local_aborted"
1394 LNET_LOCAL_RESEND_STATUSES+=" local_no_route local_timeout"
1395 LNET_LOCAL_NO_RESEND_STATUSES="local_error"
1397 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1398 reinit_dlc || return $?
1399 add_net "tcp" "eth0" || return $?
1401 lnet_health_pre || return $?
1404 for hstatus in ${LNET_LOCAL_RESEND_STATUSES} \
1405 ${LNET_LOCAL_NO_RESEND_STATUSES}; do
1406 echo "Simulate $hstatus"
1407 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1408 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1409 error "Should have failed"
1410 $LCTL net_drop_del *
1415 check_no_resends || return $?
1416 check_no_local_health || return $?
1420 run_test 204 "Check no health or resends for single-rail local failures"
1423 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1426 for hstatus in ${LNET_LOCAL_RESEND_STATUSES}; do
1427 reinit_dlc || return $?
1428 add_net "tcp" "eth0" || return $?
1429 add_net "tcp1" "eth0" || return $?
1431 echo "Simulate $hstatus"
1434 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1435 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1436 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1437 error "Should have failed"
1438 $LCTL net_drop_del *
1442 check_resends || return $?
1443 check_local_health || return $?
1446 for hstatus in ${LNET_LOCAL_NO_RESEND_STATUSES}; do
1447 reinit_dlc || return $?
1448 add_net "tcp" "eth0" || return $?
1449 add_net "tcp1" "eth0" || return $?
1451 echo "Simulate $hstatus"
1452 lnet_health_pre || return $?
1454 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1455 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1456 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1457 error "Should have failed"
1458 $LCTL net_drop_del *
1462 check_no_resends || return $?
1463 check_local_health || return $?
1468 run_test 205 "Check health and resends for multi-rail local failures"
1470 # See lnet/lnet/lib-msg.c:lnet_health_check()
1471 LNET_REMOTE_RESEND_STATUSES="remote_dropped"
1472 LNET_REMOTE_NO_RESEND_STATUSES="remote_error remote_timeout network_timeout"
1474 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1475 reinit_dlc || return $?
1476 add_net "tcp" "eth0" || return $?
1478 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1479 error "failed to discover myself"
1481 lnet_health_pre || return $?
1484 for hstatus in ${LNET_REMOTE_RESEND_STATUSES} \
1485 ${LNET_REMOTE_NO_RESEND_STATUSES}; do
1486 echo "Simulate $hstatus"
1487 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1488 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1489 error "Should have failed"
1490 $LCTL net_drop_del *
1495 check_no_resends || return $?
1496 check_no_local_health || return $?
1497 check_no_remote_health || return $?
1501 run_test 206 "Check no health or resends for single-rail remote failures"
1504 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1507 for hstatus in ${LNET_REMOTE_RESEND_STATUSES}; do
1508 reinit_dlc || return $?
1509 add_net "tcp" "eth0" || return $?
1510 add_net "tcp1" "eth0" || return $?
1512 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1513 error "failed to discover myself"
1515 echo "Simulate $hstatus"
1516 lnet_health_pre || return $?
1517 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1518 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1519 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1520 error "Should have failed"
1521 $LCTL net_drop_del *
1525 check_resends || return $?
1526 check_no_local_health || return $?
1527 check_remote_health || return $?
1529 for hstatus in ${LNET_REMOTE_NO_RESEND_STATUSES}; do
1530 reinit_dlc || return $?
1531 add_net "tcp" "eth0" || return $?
1532 add_net "tcp1" "eth0" || return $?
1534 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1535 error "failed to discover myself"
1537 echo "Simulate $hstatus"
1538 lnet_health_pre || return $?
1539 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1540 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1541 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1542 error "Should have failed"
1543 $LCTL net_drop_del *
1547 check_no_resends || return $?
1548 check_no_local_health || return $?
1549 check_remote_health || return $?
1554 run_test 207 "Check health and resends for multi-rail remote errors"
1556 test_208_load_and_check_lnet() {
1560 local num_expected=1
1562 load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
1565 error "Failed to load LNet with ip2nets \"${ip2nets_str}\""
1571 nids=( $($LCTL list_nids) )
1573 [[ ${#nids[@]} -ne ${num_expected} ]] &&
1574 error "Expect ${num_expected} NIDs found ${#nids[@]}"
1576 [[ ${nids[0]} == ${p_nid} ]] ||
1577 error "Expect NID \"${p_nid}\" found \"${nids[0]}\""
1579 [[ -n $s_nid ]] && [[ ${nids[1]} != ${s_nid} ]] &&
1580 error "Expect second NID \"${s_nid}\" found \"${nids[1]}\""
1582 $LCTL net down &>/dev/null
1587 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1589 cleanup_netns || error "Failed to cleanup netns before test execution"
1590 cleanup_lnet || error "Failed to unload modules before test execution"
1591 setup_fakeif || error "Failed to add fake IF"
1593 have_interface "$FAKE_IF" ||
1594 error "Expect $FAKE_IF configured but not found"
1596 local eth0_ip=$(ip --oneline addr show dev eth0 |
1597 awk '/inet /{print $4}' |
1599 local ip2nets_str="tcp(eth0) $eth0_ip"
1601 echo "Configure single NID \"$ip2nets_str\""
1602 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp"
1604 ip2nets_str="tcp(eth0) $eth0_ip; tcp1($FAKE_IF) $FAKE_IP"
1605 echo "Configure two NIDs; two NETs \"$ip2nets_str\""
1606 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
1609 ip2nets_str="tcp(eth0) $eth0_ip; tcp($FAKE_IF) $FAKE_IP"
1610 echo "Configure two NIDs; one NET \"$ip2nets_str\""
1611 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
1613 local addr1=( ${eth0_ip//./ } )
1614 local addr2=( ${FAKE_IP//./ } )
1615 local range="[${addr1[0]},${addr2[0]}]"
1618 for i in $(seq 1 3); do
1619 range+=".[${addr1[$i]},${addr2[$i]}]"
1621 ip2nets_str="tcp(eth0,${FAKE_IF}) ${range}"
1623 echo "Configured two NIDs; one NET alt syntax \"$ip2nets_str\""
1624 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
1629 echo "alt syntax with missing IF \"$ip2nets_str\""
1630 load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
1632 echo "$LCTL net up should fail"
1634 error "LNet bringup should have failed"
1638 run_test 208 "Test various kernel ip2nets configurations"
1643 local out=$TMP/$tfile
1644 local prefix=/usr/include/linux/lnet
1646 # We use a hard coded prefix so that this test will not fail
1649 if ! which $CC > /dev/null 2>&1; then
1650 skip_env "$CC is not installed"
1653 cleanup_lnet || exit 1
1656 if ! [[ -d $prefix ]]; then
1657 # Assume we're running in tree and fixup the include path.
1658 prefix=$LUSTRE/../lnet/include/uapi/linux/lnet
1661 for header in $prefix/*.h; do
1662 if ! [[ -f "$header" ]]; then
1666 $CC -Wall -Werror -std=c99 -include $header -c -x c /dev/null -o $out ||
1667 error "cannot compile '$header'"
1671 run_test 300 "packaged LNet UAPI headers can be compiled"