Skip to contentSkip to conversation

networking/stress/udp: make sure we will kill the test case after timeout

PATCH Superseded Hangbin Liu 1 participant 1 message Jun 25, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 networking/stress/udp: make sure we will kill the test case after timeout

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.

---
 .../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(-)
testcases/network/stress/udp/multi-diffip/udp4-multi-diffip01 +32 -32
index 33d2265..2c7f6af 100644
@@ -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`
 
testcases/network/stress/udp/multi-diffnic/udp4-multi-diffnic01 +13 -13
index 20ff259..d25ce3e 100644
@@ -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`
 
testcases/network/stress/udp/multi-diffport/udp4-multi-diffport01 +25 -25

60 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