blob: b16f56596bae278f5812ebb2c8bb204b769107ca [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
3# /tmp/netpan.log
4#
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
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
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 "---------------------------------------------------------"
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}
mridged1b67cb2005-11-08 16:41:11 +000078
subrata_modak1fb6b972008-04-06 12:43:12 +000079while getopts EeTtIiUuRrMmSsWwBbVvN:n:D:d: OPTION
80do
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
97done
mridged1b67cb2005-11-08 16:41:11 +000098
subrata_modak1fb6b972008-04-06 12:43:12 +000099if [ -z ${TEST_CASE} ]; then
100 usage
101fi
102
103export LHOST_HWADDRS=`ifconfig | grep ${INTERFACE} | grep HWaddr |awk '{print $5}'`
104
105if [ -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
110fi
111
112cat ${LTPROOT}/runtest/${TEST_CASE} > $TMPDIR/network_stress.tests
mridged1b67cb2005-11-08 16:41:11 +0000113
114cd $TMPDIR
115
116export PATH="${PATH}:${LTPROOT}/testcases/bin"
117
subrata_modak1fb6b972008-04-06 12:43:12 +0000118if [ ${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_modak14390fd2009-05-19 09:39:11 +0000127 echo ${LTPROOT}/pan/ltp-pan -e -l /tmp/netstress.log -S -a netstress -n netstress -f ${TMPDIR}/network_stress.tests
subrata_modak1fb6b972008-04-06 12:43:12 +0000128fi
mridged1b67cb2005-11-08 16:41:11 +0000129
subrata_modak14390fd2009-05-19 09:39:11 +0000130${LTPROOT}/pan/ltp-pan -e -l /tmp/netstress.log -S -a netstress -n netstress -f ${TMPDIR}/network_stress.tests
mridged1b67cb2005-11-08 16:41:11 +0000131
132if [ $? -eq "0" ]; then
subrata_modak14390fd2009-05-19 09:39:11 +0000133 echo ltp-pan reported PASS
mridged1b67cb2005-11-08 16:41:11 +0000134else
subrata_modak14390fd2009-05-19 09:39:11 +0000135 echo ltp-pan reported FAIL
mridged1b67cb2005-11-08 16:41:11 +0000136fi
137
138rm -rf ${TMPDIR}