blob: b40af72385b226500dedf3fb4b1573a6e0466db1 [file] [log] [blame]
mridged1b67cb2005-11-08 16:41:11 +00001#!/bin/sh
2# This will run all the network stress tests, with the status logged in
Chris Dearman37550cf2012-10-17 19:54:01 -07003# /tmp/netpan.log
mridged1b67cb2005-11-08 16:41:11 +00004#
5# Please read ltp-yyyymmdd/testcases/network/stress/README before running
6
7cd `dirname $0`
8export LTPROOT=${PWD}
9echo $LTPROOT | grep testscripts > /dev/null 2>&1
10if [ $? -eq 0 ]; then
11 cd ..
12 export LTPROOT=${PWD}
13fi
14
subrata_modak1fb6b972008-04-06 12:43:12 +000015export TMPDIR=/tmp/netst-$$
16mkdir $TMPDIR
17VERBOSE="no"
18INTERFACE="eth0"
19
20#===========================================================================
21# Network parameters
mridged1b67cb2005-11-08 16:41:11 +000022export RHOST=
mridged1b67cb2005-11-08 16:41:11 +000023export RHOST_HWADDRS=
24export HTTP_DOWNLOAD_DIR=
25export FTP_DOWNLOAD_DIR=
26export FTP_UPLOAD_DIR=
27export FTP_UPLOAD_URLDIR=
subrata_modak1fb6b972008-04-06 12:43:12 +000028
subrata_modak8dd5f6a2007-11-13 07:43:56 +000029# Set firt three octets of the network address, by default 10.0.0
30export IPV4_NETWORK=
31# Set local host last octet, by default 2
32export LHOST_IPV4_HOST=
33# Set remote host last octet, by default 1
34export RHOST_IPV4_HOST=
35# Set the reverse of IPV4_NETWORK, by default 0.0.10
36export IPV4_NETWORK_REVERSE=
mridged1b67cb2005-11-08 16:41:11 +000037
subrata_modak1fb6b972008-04-06 12:43:12 +000038#===========================================================================
39# Default Test Settings
mridged1b67cb2005-11-08 16:41:11 +000040# 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
Chris Dearman37550cf2012-10-17 19:54:01 -070045# export IP_TOTAL_FOR_TCPIP=100
mridged1b67cb2005-11-08 16:41:11 +000046# 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
mreed108af23632006-07-10 17:30:44 +000053# export MCASTNUM_NORMAL=20
54# export MCASTNUM_HEAVY=40000
subrata_modak1fb6b972008-04-06 12:43:12 +000055#===========================================================================
mridged1b67cb2005-11-08 16:41:11 +000056
subrata_modak1fb6b972008-04-06 12:43:12 +000057usage () {
58 echo ""
59 echo "---------------------------------------------------------"
60 echo -e "\033[31m $0 [options] \033[0m "
61 echo "---------------------------------------------------------"
Hangbin Liub26e6332012-10-09 22:48:36 +080062 echo " -A|a: Stress test for appl"
subrata_modak1fb6b972008-04-06 12:43:12 +000063 echo " -E|e: Stress test for interface"
64 echo " -I|i: Stress test for ICMP protocol"
65 echo " -T|t: Stress test for TCP/IP"
66 echo " -U|u: Stress test for UDP/IP"
67 echo " -R|r: Stress test for routing table"
68 echo " -B|b: Stress Broken IP packets"
69 echo " -M|m: Multicast stress tests"
70 echo " -S|s: Run selected tests"
71 echo " -W|w: Run whole network stress tests"
72 echo " -D|d: Test duration (default ${NS_DURATION} sec)"
73 echo " -N|n: Select the network interface (default: $INTERFACE)"
74 echo " -V|v: Enable verbose"
75 echo " -H|h: This Usage"
76 echo ""
77 exit 1
78}
mridged1b67cb2005-11-08 16:41:11 +000079
Hangbin Liub26e6332012-10-09 22:48:36 +080080while getopts AaEeTtIiUuRrMmSsWwBbVvN:n:D:d: OPTION
subrata_modak1fb6b972008-04-06 12:43:12 +000081do
82 case $OPTION in
Hangbin Liub26e6332012-10-09 22:48:36 +080083 A|a) TEST_CASE="network_stress.appl";;
subrata_modak1fb6b972008-04-06 12:43:12 +000084 E|e) TEST_CASE="network_stress.interface";;
85 B|b) TEST_CASE="network_stress.broken_ip";;
86 I|i) TEST_CASE="network_stress.icmp";;
87 T|t) TEST_CASE="network_stress.tcp";;
88 U|u) TEST_CASE="network_stress.udp";;
89 R|r) TEST_CASE="network_stress.route";;
90 M|m) TEST_CASE="network_stress.multicast";;
91 S|s) TEST_CASE="network_stress.selected";;
92 W|w) TEST_CASE="network_stress.whole";;
93 V|v) VERBOSE="yes";;
94 N|n) INTERFACE=${OPTARG};;
95 D|d) NS_DURATION=${OPTARG};;
96 H|h) usage;;
97 *) echo "Error: invalid option..."; usage; exit 1 ;;
98 esac
99done
mridged1b67cb2005-11-08 16:41:11 +0000100
subrata_modak1fb6b972008-04-06 12:43:12 +0000101if [ -z ${TEST_CASE} ]; then
102 usage
103fi
104
105export LHOST_HWADDRS=`ifconfig | grep ${INTERFACE} | grep HWaddr |awk '{print $5}'`
106
107if [ -z ${RHOST} ]; then
108 ## Just a silly check
109 echo "Error: pay attention to configure"
110 echo " network paramaters before running tests."
111 exit 1
112fi
113
114cat ${LTPROOT}/runtest/${TEST_CASE} > $TMPDIR/network_stress.tests
mridged1b67cb2005-11-08 16:41:11 +0000115
116cd $TMPDIR
117
118export PATH="${PATH}:${LTPROOT}/testcases/bin"
Chris Dearman37550cf2012-10-17 19:54:01 -0700119
subrata_modak1fb6b972008-04-06 12:43:12 +0000120if [ ${VERBOSE} = "yes" ]; then
121 echo "Network parameters:"
122 echo " - ${INTERFACE} local interface (MAC address: ${LHOST_HWADDRS})"
123 echo " - Remote IP address: ${RHOST}"
124 echo " - Remote MAC address: ${RHOST_HWADDRS}"
125
126 cat $TMPDIR/network_stress.tests
127 ${LTPROOT}/ver_linux
128 echo ""
root02f8fe82010-02-19 09:42:56 -0800129 echo ${LTPROOT}/bin/ltp-pan -e -l /tmp/netstress.log -S -a netstress -n netstress -f ${TMPDIR}/network_stress.tests
subrata_modak1fb6b972008-04-06 12:43:12 +0000130fi
mridged1b67cb2005-11-08 16:41:11 +0000131
root02f8fe82010-02-19 09:42:56 -0800132${LTPROOT}/bin/ltp-pan -e -l /tmp/netstress.log -S -a netstress -n netstress -f ${TMPDIR}/network_stress.tests
mridged1b67cb2005-11-08 16:41:11 +0000133
134if [ $? -eq "0" ]; then
subrata_modak14390fd2009-05-19 09:39:11 +0000135 echo ltp-pan reported PASS
mridged1b67cb2005-11-08 16:41:11 +0000136else
subrata_modak14390fd2009-05-19 09:39:11 +0000137 echo ltp-pan reported FAIL
mridged1b67cb2005-11-08 16:41:11 +0000138fi
139
140rm -rf ${TMPDIR}