networking/stress: make sure we will kill the test case after timeout
PATCH v2 1/1 networking/stress: make sure we will kill the test case after timeout
In some old machines or guests, the system may not have the ability to set up all the connections, e.g. 4000 tcp connections, quickly. Then the system will take lots of time to try setup the connections or just huang there.
I think we should just kill all the connections after testing timeout, no matter how many connections we have setup.
So mv the connecting setup while loop into whatchdog while loop. If we check timeout every connection, it will spend too much time on sleep 1. So we only check timeout every 100 connections.
Also, I will only modify tcp/udp4-multi-diffport01, tcp4-multi-sameport01. For other tests like tcp4-multi-diffip01 or diffnic, these tests only setup total ip/nic connections, which will be only 1 or 2 normally.
--- .../tcp/multi-diffport/tcp4-multi-diffport01 | 67 ++++++++++++---------- .../tcp/multi-sameport/tcp4-multi-sameport01 | 36 +++++++----- .../udp/multi-diffport/udp4-multi-diffport01 | 55 ++++++++++-------- 3 files changed, 87 insertions(+), 71 deletions(-)
testcases/network/stress/tcp/multi-diffport/tcp4-multi-diffport01 +36 -31
@@ -323,41 +323,46 @@ end_port=`echo $portbundle | cut -f 2 -d '-'` # Making connections connection_num=0 current_port=$start_port -while [ $current_port -le $end_port ]; do - # Run a server - ns-tcpserver -b -f $IP_VER -p $current_port - if [ $? -ne 0 ]; then - # Failed to start no server - if [ $connection_num -eq 0 ]; then - tst_resm TFAIL "Failed to run a server" - exit 1 - fi - # Failed to start a server - tst_resm TINFO "$connection_num seems the maximum number of the server" - break - fi - - # Run a clinet - ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-tcpclient -b -f $IP_VER -S $lhost_addr -p $current_port' ; echo $?'` - if [ $ret -ne 0 ]; then - # Failed to start any client - if [ $connection_num -eq 0 ]; then - tst_resm TFAIL "Failed to run any client." - exit 1 - fi - # Failed to start a client - tst_resm TINFO "$connection_num seems the maximum number of the client" - break - fi - - current_port=`expr $current_port + 1` - connection_num=`expr $connection_num + 1` -done - # Watch the TCP traffic server start_epoc=`date +%s` while true ; do + while [ $current_port -le $end_port ]; do + # Run a server + ns-tcpserver -b -f $IP_VER -p $current_port + if [ $? -ne 0 ]; then + # Failed to start no server + if [ $connection_num -eq 0 ]; then + tst_resm TFAIL "Failed to run a server" + exit 1 + fi + # Failed to start a server + tst_resm TINFO "$connection_num seems the maximum number of the server" + break + fi + + # Run a clinet + ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-tcpclient -b -f $IP_VER -S $lhost_addr -p $current_port' ; echo $?'` + if [ $ret -ne 0 ]; then + # Failed to start any client + if [ $connection_num -eq 0 ]; then + tst_resm TFAIL "Failed to run any client." + exit 1 + fi + # Failed to start a client + tst_resm TINFO "$connection_num seems the maximum number of the client" + break + fi + + current_port=`expr $current_port + 1` + connection_num=`expr $connection_num + 1` + + # check timeout every 100 times + if [ $(($connection_num % 100)) -eq 0 ]; then + break + fi + done + current_epoc=`date +%s` elapse_epoc=`expr $current_epoc - $start_epoc` if [ $elapse_epoc -ge $NS_DURATION ]; then
testcases/network/stress/tcp/multi-sameport/tcp4-multi-sameport01 +21 -15
@@ -336,25 +336,31 @@ rm -f $info_file # Making connections connection_num=0 -while [ $connection_num -lt $CONNECTION_TOTAL ]; do - # Run a client - ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-tcpclient -b -f $IP_VER -S $lhost_addr -p $server_port' ; echo $?'` - if [ $ret -ne 0 ]; then - # Failed to start any client - if [ $connection_num -eq 0 ]; then - tst_resm TFAIL "Failed to run any client" - exit 1 - fi - # Failed to start a client - tst_resm TINFO "$connection_num seems the maximum number of the client" - break - fi - connection_num=`expr $connection_num + 1` -done # Watch the TCP traffic server start_epoc=`date +%s` while true ; do + while [ $connection_num -lt $CONNECTION_TOTAL ]; do + # Run a client + ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-tcpclient -b -f $IP_VER -S $lhost_addr -p $server_port' ; echo $?'` + if [ $ret -ne 0 ]; then + # Failed to start any client + if [ $connection_num -eq 0 ]; then + tst_resm TFAIL "Failed to run any client" + exit 1 + fi + # Failed to start a client + tst_resm TINFO "$connection_num seems the maximum number of the client" + break + fi + connection_num=`expr $connection_num + 1` + + # check timeout every 100 times + if [ $(($connection_num % 100)) -eq 0 ]; then + break + fi + done + current_epoc=`date +%s` elapse_epoc=`expr $current_epoc - $start_epoc`
testcases/network/stress/udp/multi-diffport/udp4-multi-diffport01 +30 -25
65 lines not on this page · raw message
Signature · 13 lines
1.8.1.4 ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list