The same as tcp, put the connecting setup while loop into whatchdog while
loop and make sure we can kill all the connections immediately after timeout.

Signed-off-by: Hangbin Liu <[email protected]>
---
 .../stress/udp/multi-diffip/udp4-multi-diffip01    | 64 +++++++++++-----------
 .../stress/udp/multi-diffnic/udp4-multi-diffnic01  | 26 ++++-----
 .../udp/multi-diffport/udp4-multi-diffport01       | 50 ++++++++---------
 3 files changed, 70 insertions(+), 70 deletions(-)

diff --git a/testcases/network/stress/udp/multi-diffip/udp4-multi-diffip01 
b/testcases/network/stress/udp/multi-diffip/udp4-multi-diffip01
index 33d2265..2c7f6af 100644
--- a/testcases/network/stress/udp/multi-diffip/udp4-multi-diffip01
+++ b/testcases/network/stress/udp/multi-diffip/udp4-multi-diffip01
@@ -356,43 +356,43 @@ done
 server_pid=`grep PID: $info_file | cut -f 2 -d ' '`
 rm -f $info_file
 
-# Make connections
 connection_num=0
-while [ $connection_num -lt $ipaddr_pair_num ]; do
-    # IP addresses
-    x=`expr $connection_num \/ 255 % 255`
-    y=`expr $connection_num % 255`
-
-    case $IP_VER in
-       4)
-       lhost_addr="10.${x}.${y}.2"
-       ;;
-
-       6)
-       hex_x=`printf %x $x`
-       hex_y=`printf %x $y`
-       lhost_addr="fd00:1:${hex_x}:${hex_y}::2"
-       ;;
-    esac
-
-    # Run a client
-    ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpclient -b -f $IP_VER 
-S $lhost_addr -p $server_port' ; echo $?'`
-    if [ $ret -ne 0 ]; then
-       if [ $connection_num -eq 0 ]; then
-           tst_resm TFAIL "Failed to run any client"
-           exit 1
-       else
-           tst_resm TINFO "$connection_num seems the maximum number of the 
client"
-       fi
-       break
-    fi
-    connection_num=`expr $connection_num + 1`
-done
-
 
 # Watch the UDP traffic server
 start_epoc=`date +%s`
 while true ; do
+       # Make connections
+       if [ $connection_num -lt $ipaddr_pair_num ]; then
+               # IP addresses
+               x=`expr $connection_num \/ 255 % 255`
+               y=`expr $connection_num % 255`
+
+               case $IP_VER in
+                       4)
+                               lhost_addr="10.${x}.${y}.2"
+                               ;;
+
+                       6)
+                               hex_x=`printf %x $x`
+                               hex_y=`printf %x $y`
+                               lhost_addr="fd00:1:${hex_x}:${hex_y}::2"
+                               ;;
+               esac
+
+               # Run a client
+               ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpclient -b 
-f $IP_VER -S $lhost_addr -p $server_port' ; echo $?'`
+               if [ $ret -ne 0 ]; then
+                       if [ $connection_num -eq 0 ]; then
+                               tst_resm TFAIL "Failed to run any client"
+                               exit 1
+                       else
+                               tst_resm TINFO "$connection_num seems the 
maximum number of the client"
+                       fi
+                       break
+               fi
+               connection_num=`expr $connection_num + 1`
+       fi
+
     current_epoc=`date +%s`
     elapse_epoc=`expr $current_epoc - $start_epoc`
 
diff --git a/testcases/network/stress/udp/multi-diffnic/udp4-multi-diffnic01 
b/testcases/network/stress/udp/multi-diffnic/udp4-multi-diffnic01
index 20ff259..d25ce3e 100644
--- a/testcases/network/stress/udp/multi-diffnic/udp4-multi-diffnic01
+++ b/testcases/network/stress/udp/multi-diffnic/udp4-multi-diffnic01
@@ -308,23 +308,23 @@ rm -f $info_file
 
 # Main loop
 connection_num=0
-while [ $connection_num -lt $link_total ]; do
-    field=`expr $connection_num + 1`
-    lhost_addr=`echo $lhost_addrs | cut -d ' ' -f $field`
-
-    # Run a client
-    ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpclient -b -f $IP_VER 
-S $lhost_addr -p $server_port' ; echo $?'`
-    if [ $ret -ne 0 ]; then
-       tst_resm TFAIL "Failed to run client on Link${connection_num}"
-       exit 1
-    fi
-    connection_num=`expr $connection_num + 1`
-done
-
 
 # Watch the UDP traffic server
 start_epoc=`date +%s`
 while true ; do
+       if [ $connection_num -lt $link_total ]; then
+               field=`expr $connection_num + 1`
+               lhost_addr=`echo $lhost_addrs | cut -d ' ' -f $field`
+
+               # Run a client
+               ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpclient -b 
-f $IP_VER -S $lhost_addr -p $server_port' ; echo $?'`
+               if [ $ret -ne 0 ]; then
+                       tst_resm TFAIL "Failed to run client on 
Link${connection_num}"
+                       exit 1
+               fi
+               connection_num=`expr $connection_num + 1`
+       fi
+
     current_epoc=`date +%s`
     elapse_epoc=`expr $current_epoc - $start_epoc`
 
diff --git a/testcases/network/stress/udp/multi-diffport/udp4-multi-diffport01 
b/testcases/network/stress/udp/multi-diffport/udp4-multi-diffport01
index d130ff9..e3efb2e 100644
--- a/testcases/network/stress/udp/multi-diffport/udp4-multi-diffport01
+++ b/testcases/network/stress/udp/multi-diffport/udp4-multi-diffport01
@@ -291,35 +291,35 @@ end_port=`echo $portbundle | cut -f 2 -d '-'`
 # Run the pair of server and client
 connection_num=0
 current_port=$start_port
-while [ $current_port -le $end_port ]; do
-    # Run a UDP traffic server
-    ns-udpserver -b -f $IP_VER -p $current_port
-    if [ $? -ne 0 ]; then
-       if [ $connection_num -eq 0 ]; then
-           tst_resm TFAIL "Failed to run a server"
-           exit 1
-       fi
-       tst_resm TINFO "$connection_num seems the maximum number of the client"
-       break
-    fi
-
-    ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpclient -b -f $IP_VER 
-S $lhost_addr -p $current_port'; echo $?'`
-    if [ $ret -ne 0 ]; then
-       if [ $connection_num -eq 0 ]; then
-           tst_resm TFAIL "Failed to run a client"
-           exit 1
-       fi
-       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 UDP traffic server
 start_epoc=`date +%s`
 while true ; do
+       if [ $current_port -le $end_port ]; then
+               # Run a UDP traffic server
+               ns-udpserver -b -f $IP_VER -p $current_port
+               if [ $? -ne 0 ]; then
+                       if [ $connection_num -eq 0 ]; then
+                               tst_resm TFAIL "Failed to run a server"
+                               exit 1
+                       fi
+                       tst_resm TINFO "$connection_num seems the maximum 
number of the client"
+                       break
+               fi
+
+               ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpclient -b 
-f $IP_VER -S $lhost_addr -p $current_port'; echo $?'`
+               if [ $ret -ne 0 ]; then
+                       if [ $connection_num -eq 0 ]; then
+                               tst_resm TFAIL "Failed to run a client"
+                               exit 1
+                       fi
+                       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`
+       fi
+
     current_epoc=`date +%s`
     elapse_epoc=`expr $current_epoc - $start_epoc`
     if [ $elapse_epoc -ge $NS_DURATION ]; then
-- 
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

Reply via email to