Alexey Kodanev | 50c8ec3 | 2014-09-16 18:15:55 +0400 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Alexey Kodanev | 6538f7a | 2016-05-06 15:52:44 +0300 | [diff] [blame] | 3 | cd $(dirname $0) |
| 4 | export LTPROOT=${LTPROOT:-"$PWD"} |
| 5 | echo $LTPROOT | grep -q testscripts |
| 6 | if [ $? -eq 0 ]; then |
| 7 | cd .. |
| 8 | export LTPROOT=${PWD} |
| 9 | fi |
| 10 | |
Alexey Kodanev | 50c8ec3 | 2014-09-16 18:15:55 +0400 | [diff] [blame] | 11 | export TMPDIR=/tmp/netpan-$$ |
| 12 | mkdir -p $TMPDIR |
| 13 | CMDFILE=${TMPDIR}/network.tests |
| 14 | VERBOSE="no" |
| 15 | |
Alexey Kodanev | 50c8ec3 | 2014-09-16 18:15:55 +0400 | [diff] [blame] | 16 | export PATH="${PATH}:${LTPROOT}/testcases/bin" |
| 17 | |
Alexey Kodanev | a94a669 | 2016-05-10 11:25:43 +0300 | [diff] [blame] | 18 | usage() |
| 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 Kodanev | 6538f7a | 2016-05-06 15:52:44 +0300 | [diff] [blame] | 41 | TEST_CASES= |
| 42 | |
Alexey Kodanev | a94a669 | 2016-05-10 11:25:43 +0300 | [diff] [blame] | 43 | while getopts 6mnrstaebiTURMFf:Vvh OPTION |
Alexey Kodanev | 6538f7a | 2016-05-06 15:52:44 +0300 | [diff] [blame] | 44 | do |
| 45 | case $OPTION in |
Alexey Kodanev | a94a669 | 2016-05-10 11:25:43 +0300 | [diff] [blame] | 46 | 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 Kodanev | 6538f7a | 2016-05-06 15:52:44 +0300 | [diff] [blame] | 61 | f) TEST_CASES=${OPTARG} ;; |
| 62 | V|v) VERBOSE="yes";; |
Alexey Kodanev | a94a669 | 2016-05-10 11:25:43 +0300 | [diff] [blame] | 63 | h) usage; exit 0 ;; |
| 64 | *) echo "Error: invalid option..."; usage; exit 1 ;; |
Alexey Kodanev | 6538f7a | 2016-05-06 15:52:44 +0300 | [diff] [blame] | 65 | esac |
| 66 | done |
| 67 | |
Alexey Kodanev | a94a669 | 2016-05-10 11:25:43 +0300 | [diff] [blame] | 68 | if [ "$OPTIND" -eq 1 ]; then |
| 69 | echo "Error: option is required" |
| 70 | usage |
| 71 | exit 1 |
| 72 | fi |
| 73 | |
Petr Vorel | 35edc26 | 2016-11-09 15:35:39 +0100 | [diff] [blame] | 74 | TST_TOTAL=1 |
| 75 | TCID="network_settings" |
| 76 | |
| 77 | . test_net.sh |
| 78 | |
| 79 | # Reset variables. |
| 80 | # Don't break the tests which are using 'testcases/lib/cmdlib.sh' |
| 81 | export TCID= |
| 82 | export TST_LIB_LOADED= |
| 83 | |
Alexey Kodanev | 6538f7a | 2016-05-06 15:52:44 +0300 | [diff] [blame] | 84 | rm -f $CMDFILE |
| 85 | |
| 86 | for t in $TEST_CASES; do |
| 87 | cat ${LTPROOT}/runtest/$t >> $CMDFILE |
| 88 | done |
| 89 | |
| 90 | cd $TMPDIR |
| 91 | |
| 92 | if [ ${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 Vorel | d685e31 | 2016-12-08 10:54:06 +0100 | [diff] [blame] | 97 | cat $CMDFILE |
Alexey Kodanev | 6538f7a | 2016-05-06 15:52:44 +0300 | [diff] [blame] | 98 | ${LTPROOT}/ver_linux |
| 99 | echo "" |
| 100 | echo ${LTPROOT}/bin/ltp-pan -e -l /tmp/netpan.log -S -a ltpnet -n ltpnet -f $CMDFILE |
| 101 | fi |
| 102 | |
| 103 | ${LTPROOT}/bin/ltp-pan -e -l /tmp/netpan.log -S -a ltpnet -n ltpnet -f $CMDFILE |
| 104 | |
| 105 | if [ $? -eq "0" ]; then |
| 106 | echo ltp-pan reported PASS |
| 107 | else |
| 108 | echo ltp-pan reported FAIL |
| 109 | fi |