blob: 2d2c6762c173405f9f141f923fd9565c601665a0 [file] [log] [blame]
Alexey Kodanev50c8ec32014-09-16 18:15:55 +04001#!/bin/sh
2
Alexey Kodanev6538f7a2016-05-06 15:52:44 +03003cd $(dirname $0)
4export LTPROOT=${LTPROOT:-"$PWD"}
5echo $LTPROOT | grep -q testscripts
6if [ $? -eq 0 ]; then
7 cd ..
8 export LTPROOT=${PWD}
9fi
10
Alexey Kodanev50c8ec32014-09-16 18:15:55 +040011export TMPDIR=/tmp/netpan-$$
12mkdir -p $TMPDIR
13CMDFILE=${TMPDIR}/network.tests
14VERBOSE="no"
15
Alexey Kodanev50c8ec32014-09-16 18:15:55 +040016export PATH="${PATH}:${LTPROOT}/testcases/bin"
17
Alexey Kodaneva94a6692016-05-10 11:25:43 +030018usage()
19{
20 echo "Usage: $0 OPTIONS"
21 echo " -6 IPv6 tests"
22 echo " -m multicast tests"
23 echo " -n NFS tests"
24 echo " -r RPC tests"
25 echo " -s SCTP tests"
26 echo " -t TCP/IP command tests"
27 echo " -a Application tests (HTTP, SSH, DNS)"
28 echo " -e Interface stress tests"
29 echo " -b Stress tests with malformed ICMP packets"
30 echo " -i IPsec ICMP stress tests"
31 echo " -T IPsec TCP stress tests"
32 echo " -U IPsec UDP stress tests"
33 echo " -R route stress tests"
34 echo " -M multicast stress tests"
35 echo " -F network features tests (TFO, vxlan, etc.)"
36 echo " -f x where x is a runtest file"
37 echo " -V|v verbose"
38 echo " -h print this help"
39}
40
Alexey Kodanev6538f7a2016-05-06 15:52:44 +030041TEST_CASES=
42
Alexey Kodaneva94a6692016-05-10 11:25:43 +030043while getopts 6mnrstaebiTURMFf:Vvh OPTION
Alexey Kodanev6538f7a2016-05-06 15:52:44 +030044do
45 case $OPTION in
Alexey Kodaneva94a6692016-05-10 11:25:43 +030046 6) TEST_CASES="$TEST_CASES net.ipv6 net.ipv6_lib";;
47 m) TEST_CASES="$TEST_CASES net.multicast" ;;
48 n) TEST_CASES="$TEST_CASES net.nfs" ;;
49 r) TEST_CASES="$TEST_CASES net.rpc" ;;
50 s) TEST_CASES="$TEST_CASES net.sctp" ;;
51 t) TEST_CASES="$TEST_CASES net.tcp_cmds" ;;
52 a) TEST_CASES="$TEST_CASES net_stress.appl";;
53 e) TEST_CASES="$TEST_CASES net_stress.interface";;
54 b) TEST_CASES="$TEST_CASES net_stress.broken_ip";;
55 i) TEST_CASES="$TEST_CASES net_stress.ipsec_icmp";;
56 T) TEST_CASES="$TEST_CASES net_stress.ipsec_tcp";;
57 U) TEST_CASES="$TEST_CASES net_stress.ipsec_udp";;
58 R) TEST_CASES="$TEST_CASES net_stress.route";;
59 M) TEST_CASES="$TEST_CASES net_stress.multicast";;
60 F) TEST_CASES="$TEST_CASES net.features";;
Alexey Kodanev6538f7a2016-05-06 15:52:44 +030061 f) TEST_CASES=${OPTARG} ;;
62 V|v) VERBOSE="yes";;
Alexey Kodaneva94a6692016-05-10 11:25:43 +030063 h) usage; exit 0 ;;
64 *) echo "Error: invalid option..."; usage; exit 1 ;;
Alexey Kodanev6538f7a2016-05-06 15:52:44 +030065 esac
66done
67
Alexey Kodaneva94a6692016-05-10 11:25:43 +030068if [ "$OPTIND" -eq 1 ]; then
69 echo "Error: option is required"
70 usage
71 exit 1
72fi
73
Petr Vorel35edc262016-11-09 15:35:39 +010074TST_TOTAL=1
75TCID="network_settings"
76
77. test_net.sh
78
79# Reset variables.
80# Don't break the tests which are using 'testcases/lib/cmdlib.sh'
81export TCID=
82export TST_LIB_LOADED=
83
Alexey Kodanev6538f7a2016-05-06 15:52:44 +030084rm -f $CMDFILE
85
86for t in $TEST_CASES; do
87 cat ${LTPROOT}/runtest/$t >> $CMDFILE
88done
89
90cd $TMPDIR
91
92if [ ${VERBOSE} = "yes" ]; then
93 echo "Network parameters:"
94 echo " - ${LHOST_IFACES} local interface (MAC address: ${LHOST_HWADDRS})"
95 echo " - ${RHOST_IFACES} remote interface (MAC address: ${RHOST_HWADDRS})"
96
Petr Voreld685e312016-12-08 10:54:06 +010097 cat $CMDFILE
Alexey Kodanev6538f7a2016-05-06 15:52:44 +030098 ${LTPROOT}/ver_linux
99 echo ""
100 echo ${LTPROOT}/bin/ltp-pan -e -l /tmp/netpan.log -S -a ltpnet -n ltpnet -f $CMDFILE
101fi
102
103${LTPROOT}/bin/ltp-pan -e -l /tmp/netpan.log -S -a ltpnet -n ltpnet -f $CMDFILE
104
105if [ $? -eq "0" ]; then
106 echo ltp-pan reported PASS
107else
108 echo ltp-pan reported FAIL
109fi