mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # This will run all the network stress tests, with the status logged in |
| 3 | # /tmp/netpan.log |
| 4 | # |
| 5 | # Please read ltp-yyyymmdd/testcases/network/stress/README before running |
| 6 | |
| 7 | cd `dirname $0` |
| 8 | export LTPROOT=${PWD} |
| 9 | echo $LTPROOT | grep testscripts > /dev/null 2>&1 |
| 10 | if [ $? -eq 0 ]; then |
| 11 | cd .. |
| 12 | export LTPROOT=${PWD} |
| 13 | fi |
| 14 | |
subrata_modak | 1fb6b97 | 2008-04-06 12:43:12 +0000 | [diff] [blame] | 15 | export TMPDIR=/tmp/netst-$$ |
| 16 | mkdir $TMPDIR |
| 17 | VERBOSE="no" |
| 18 | INTERFACE="eth0" |
| 19 | |
| 20 | #=========================================================================== |
| 21 | # Network parameters |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 22 | export RHOST= |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 23 | export RHOST_HWADDRS= |
| 24 | export HTTP_DOWNLOAD_DIR= |
| 25 | export FTP_DOWNLOAD_DIR= |
| 26 | export FTP_UPLOAD_DIR= |
| 27 | export FTP_UPLOAD_URLDIR= |
subrata_modak | 1fb6b97 | 2008-04-06 12:43:12 +0000 | [diff] [blame] | 28 | |
subrata_modak | 8dd5f6a | 2007-11-13 07:43:56 +0000 | [diff] [blame] | 29 | # Set firt three octets of the network address, by default 10.0.0 |
| 30 | export IPV4_NETWORK= |
| 31 | # Set local host last octet, by default 2 |
| 32 | export LHOST_IPV4_HOST= |
| 33 | # Set remote host last octet, by default 1 |
| 34 | export RHOST_IPV4_HOST= |
| 35 | # Set the reverse of IPV4_NETWORK, by default 0.0.10 |
| 36 | export IPV4_NETWORK_REVERSE= |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 37 | |
subrata_modak | 1fb6b97 | 2008-04-06 12:43:12 +0000 | [diff] [blame] | 38 | #=========================================================================== |
| 39 | # Default Test Settings |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 40 | # export LTP_RSH=rsh |
| 41 | # export NS_DURATION=3600 # 1 hour |
| 42 | # export NS_TIMES=10000 |
| 43 | # export CONNECTION_TOTAL=4000 |
| 44 | # export IP_TOTAL=10000 |
| 45 | # export IP_TOTAL_FOR_TCPIP=100 |
| 46 | # export ROUTE_TOTAL=10000 |
| 47 | # export MTU_CHANGE_TIMES=1000 |
| 48 | # export IF_UPDOWN_TIMES=10000 |
| 49 | # export DOWNLOAD_BIGFILESIZE=2147483647 # 2G byte - 1byte |
| 50 | # export DOWNLOAD_REGFILESIZE=1048576 # 1M byte |
| 51 | # export UPLOAD_BIGFILESIZE=2147483647 # 2G byte - 1byte |
| 52 | # export UPLOAD_REGFILESIZE=1024 # 1K byte |
mreed10 | 8af2363 | 2006-07-10 17:30:44 +0000 | [diff] [blame] | 53 | # export MCASTNUM_NORMAL=20 |
| 54 | # export MCASTNUM_HEAVY=40000 |
subrata_modak | 1fb6b97 | 2008-04-06 12:43:12 +0000 | [diff] [blame] | 55 | #=========================================================================== |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 56 | |
subrata_modak | 1fb6b97 | 2008-04-06 12:43:12 +0000 | [diff] [blame] | 57 | usage () { |
| 58 | echo "" |
| 59 | echo "---------------------------------------------------------" |
| 60 | echo -e "\033[31m $0 [options] \033[0m " |
| 61 | echo "---------------------------------------------------------" |
| 62 | echo " -E|e: Stress test for interface" |
| 63 | echo " -I|i: Stress test for ICMP protocol" |
| 64 | echo " -T|t: Stress test for TCP/IP" |
| 65 | echo " -U|u: Stress test for UDP/IP" |
| 66 | echo " -R|r: Stress test for routing table" |
| 67 | echo " -B|b: Stress Broken IP packets" |
| 68 | echo " -M|m: Multicast stress tests" |
| 69 | echo " -S|s: Run selected tests" |
| 70 | echo " -W|w: Run whole network stress tests" |
| 71 | echo " -D|d: Test duration (default ${NS_DURATION} sec)" |
| 72 | echo " -N|n: Select the network interface (default: $INTERFACE)" |
| 73 | echo " -V|v: Enable verbose" |
| 74 | echo " -H|h: This Usage" |
| 75 | echo "" |
| 76 | exit 1 |
| 77 | } |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 78 | |
subrata_modak | 1fb6b97 | 2008-04-06 12:43:12 +0000 | [diff] [blame] | 79 | while getopts EeTtIiUuRrMmSsWwBbVvN:n:D:d: OPTION |
| 80 | do |
| 81 | case $OPTION in |
| 82 | E|e) TEST_CASE="network_stress.interface";; |
| 83 | B|b) TEST_CASE="network_stress.broken_ip";; |
| 84 | I|i) TEST_CASE="network_stress.icmp";; |
| 85 | T|t) TEST_CASE="network_stress.tcp";; |
| 86 | U|u) TEST_CASE="network_stress.udp";; |
| 87 | R|r) TEST_CASE="network_stress.route";; |
| 88 | M|m) TEST_CASE="network_stress.multicast";; |
| 89 | S|s) TEST_CASE="network_stress.selected";; |
| 90 | W|w) TEST_CASE="network_stress.whole";; |
| 91 | V|v) VERBOSE="yes";; |
| 92 | N|n) INTERFACE=${OPTARG};; |
| 93 | D|d) NS_DURATION=${OPTARG};; |
| 94 | H|h) usage;; |
| 95 | *) echo "Error: invalid option..."; usage; exit 1 ;; |
| 96 | esac |
| 97 | done |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 98 | |
subrata_modak | 1fb6b97 | 2008-04-06 12:43:12 +0000 | [diff] [blame] | 99 | if [ -z ${TEST_CASE} ]; then |
| 100 | usage |
| 101 | fi |
| 102 | |
| 103 | export LHOST_HWADDRS=`ifconfig | grep ${INTERFACE} | grep HWaddr |awk '{print $5}'` |
| 104 | |
| 105 | if [ -z ${RHOST} ]; then |
| 106 | ## Just a silly check |
| 107 | echo "Error: pay attention to configure" |
| 108 | echo " network paramaters before running tests." |
| 109 | exit 1 |
| 110 | fi |
| 111 | |
| 112 | cat ${LTPROOT}/runtest/${TEST_CASE} > $TMPDIR/network_stress.tests |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 113 | |
| 114 | cd $TMPDIR |
| 115 | |
| 116 | export PATH="${PATH}:${LTPROOT}/testcases/bin" |
| 117 | |
subrata_modak | 1fb6b97 | 2008-04-06 12:43:12 +0000 | [diff] [blame] | 118 | if [ ${VERBOSE} = "yes" ]; then |
| 119 | echo "Network parameters:" |
| 120 | echo " - ${INTERFACE} local interface (MAC address: ${LHOST_HWADDRS})" |
| 121 | echo " - Remote IP address: ${RHOST}" |
| 122 | echo " - Remote MAC address: ${RHOST_HWADDRS}" |
| 123 | |
| 124 | cat $TMPDIR/network_stress.tests |
| 125 | ${LTPROOT}/ver_linux |
| 126 | echo "" |
subrata_modak | 14390fd | 2009-05-19 09:39:11 +0000 | [diff] [blame^] | 127 | echo ${LTPROOT}/pan/ltp-pan -e -l /tmp/netstress.log -S -a netstress -n netstress -f ${TMPDIR}/network_stress.tests |
subrata_modak | 1fb6b97 | 2008-04-06 12:43:12 +0000 | [diff] [blame] | 128 | fi |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 129 | |
subrata_modak | 14390fd | 2009-05-19 09:39:11 +0000 | [diff] [blame^] | 130 | ${LTPROOT}/pan/ltp-pan -e -l /tmp/netstress.log -S -a netstress -n netstress -f ${TMPDIR}/network_stress.tests |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 131 | |
| 132 | if [ $? -eq "0" ]; then |
subrata_modak | 14390fd | 2009-05-19 09:39:11 +0000 | [diff] [blame^] | 133 | echo ltp-pan reported PASS |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 134 | else |
subrata_modak | 14390fd | 2009-05-19 09:39:11 +0000 | [diff] [blame^] | 135 | echo ltp-pan reported FAIL |
mridge | d1b67cb | 2005-11-08 16:41:11 +0000 | [diff] [blame] | 136 | fi |
| 137 | |
| 138 | rm -rf ${TMPDIR} |