All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/4] multicast/mc_cmds: Some cleanup
@ 2014-08-31 10:29 Zeng Linggang
  2014-08-31 10:30 ` [LTP] [PATCH 2/4] multicast/mc_commo: " Zeng Linggang
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Zeng Linggang @ 2014-08-31 10:29 UTC (permalink / raw)
  To: ltp-list

* Fix a typo.
* Delete trace_logic that is used to debug.
* Use test.sh script and use tst_* instead of end_testcase.
* Delete some unuseful comments.

Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
---
 testcases/network/multicast/mc_cmds/mc_cmds | 239 ++++++++++------------------
 1 file changed, 86 insertions(+), 153 deletions(-)

diff --git a/testcases/network/multicast/mc_cmds/mc_cmds b/testcases/network/multicast/mc_cmds/mc_cmds
index 54fc69c..3799e26 100755
--- a/testcases/network/multicast/mc_cmds/mc_cmds
+++ b/testcases/network/multicast/mc_cmds/mc_cmds
@@ -20,7 +20,7 @@
 #
 #  FILE             : mc_cmds
 #  TEST DESCRIPTION : To determine the stability of the IP Multicast product
-#                and to verify the accuracy and usablility of IP Multicast
+#                and to verify the accuracy and usability of IP Multicast
 #                related publications associated with changes and/or
 #                additions to command level interfaces for this implementations
 #                of IP Multicast.
@@ -30,181 +30,114 @@
 #
 #*******************************************************************************
 
-#Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
-
 TC=mc_cmds
 TCtmp=${TCtmp:-$TMPDIR/$TC$$}
 PING_OUT=${TCtmp}/PING_OUT
-HOSTNAME=`hostname`
-CLEANUP=${CLEANUP:-ON}
 
 export TCID=$TC
 export TST_TOTAL=1
 export TST_COUNT=1
 
+. test.sh
+
 setup()
 {
-   mkdir -p $TCtmp || { tst_brkm TBROK NULL "Could not create $TCtmp"; exit 1; }
+	cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts | grep 1 > /dev/null
+	if [ $? -eq 0 ]; then
+		tst_brkm TCONF "Multicast ping disabled on this system."
+	fi
+
+	mkdir -p $TCtmp
+	if [ $? -ne 0 ]; then
+		tst_brkm TBROK NULL "Could not create $TCtmp";
+	fi
 }
 
-#*******************************************************************************
-#
-# FUNCTION:  do_test
-# PURPOSE:   Test changes to ifconfig, netstat, and ping commands
-# INPUT:     None
-# OUTPUT:    Error messages are logged when any verification test
-#            fails.
-#
-#-----------------------------------------------------------------------
 do_test()
 {
-   $trace_logic
-   echo "Getting ALL enabled interfaces which are configured !"
-
-   IFNAME=${IFNAME:-$(netstat -i -n | grep "^[b-z]\{2,4\}[0-9][^*]"|\
-      awk '{print $1}')}
-   INTERFACE=${INTERFACE:-$(mc_gethost `hostname` | grep addresses: | awk '{print $2}')}
-
-   echo "Testing ifconfig and netstat"
-
-# Commented begin
-#   # See if interface can be used for IP Multicast
-#   ifconfig $IFNAME | grep -q MULTICAST
-#   if [ $? != 0 ]; then
-#	end_testcase "Multicast not listed for $IFNAME"
-#   fi
-#   netstat -gn | grep $IFNAME | grep -q 224.0.0.1
-#   [ $? = 0 ] || end_testcase "all-host-group for $IFNAME not joined"
-# Commented end
-
-#Finds the active ethernet interface
-for eth in $IFNAME
-    do
-         ifconfig $eth | grep -q $INTERFACE
-          if [ $? -eq 0 ]
-          then
-                INTERFACE_DEVICE=$eth
-		break
-           fi
-    done
-
-# Added for support for more adapters configured
-    MulticastAdap=
-    for eth in $IFNAME
-    do
-
-	$trace_logic
-	ifconfig $eth | grep -q MULTICAST
-	if [ $? -eq 0 ]
-	then
-	    $trace_logic
-	    MulticastAdap=$eth
-	    break
+	echo "Getting ALL enabled interfaces which are configured !"
+
+	IFNAME=${IFNAME:-$(netstat -i -n | sed '1,2 d' | awk '{print $1}')}
+	INTERFACE=${INTERFACE:-$(mc_gethost `hostname` | grep addresses: | \
+				 awk '{print $2}')}
+
+	echo "Testing ifconfig and netstat"
+
+	# Finds the active ethernet interface
+	for eth in $IFNAME
+	do
+		ifconfig $eth | grep -q $INTERFACE
+		if [ $? -eq 0 ]; then
+			INTERFACE_DEVICE=$eth
+			break
+		fi
+	done
+
+	MulticastAdap=
+	for eth in $IFNAME
+	do
+
+		ifconfig $eth | grep -q MULTICAST
+		if [ $? -eq 0 ]; then
+			MulticastAdap=$eth
+			break
+		fi
+	done
+	if [ -z $MulticastAdap ]; then
+		tst_brkm TFAIL "Multicast not listed for $IFNAME"
 	fi
-    done
-    if [ -z $MulticastAdap ]
-    then
-	end_testcase "Multicast not listed for $IFNAME"
-    fi
-    MulticastAdapJoined=
-    for eth in $IFNAME
-    do
-	$trace_logic
-	netstat -gn | grep $eth | grep -q 224.0.0.1
-	if [ $? -eq 0 ]
-	then
-	    $trace_logic
-	    MulticastAdapJoined=1
-	    break
+	MulticastAdapJoined=
+	for eth in $IFNAME
+	do
+		netstat -gn | grep $eth | grep -q 224.0.0.1
+		if [ $? -eq 0 ]; then
+			MulticastAdapJoined=1
+			break
+		fi
+	done
+	if [ -z $MulticastAdapJoined ]; then
+		tst_brkm TFAIL "all-host-group for $IFNAME not joined"
 	fi
-    done
-    if [ -z $MulticastAdapJoined ]
-    then
-	end_testcase "all-host-group for $IFNAME not joined"
-    fi
-# Added end
-
-   cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts | grep 1 > /dev/null
-   if [ $? -eq 0 ]
-   then
-       tst_resm TCONF "Multicast ping disabled on this system (this is normal on post year:2005 kernels)"
-       rm -rf $TCtmp
-       exit 0
-   fi
-
-   # Do the ping tests: Execute ping 224.0.0.1 - Verify that the proper
-   # number of responses are returned.
-
-   echo "Ping all-host-groups address(over default route!)"
-   ping -c2 224.0.0.1 > $PING_OUT
-   [ $? = 0 ] || end_testcase "No response from MC hosts to ping 224.0.0.1"
-
-   echo "Ping all-host-groups over specified interface"
-   ping -c2 -I $INTERFACE 224.0.0.1 > $PING_OUT
-  if [ $? -ne 0 ]
-   then
-        echo "Trying to ping with $INTERFACE_DEVICE instead of IP address"
-        echo "with the -I option"
-        ping -c2 -I $INTERFACE_DEVICE 224.0.0.1 > $PING_OUT
-   [ $? = 0 ] || end_testcase "No response from MC hosts to ping -c2 -I$INTERFACE 224.0.0.1"
-fi
-   grep -q $INTERFACE $PING_OUT
-   [ $? = 0 ] || end_testcase "Local host did not respond to ping -c2 -I$INTERFACE 224.0.0.1"
 
+	# Do the ping tests: Execute ping 224.0.0.1 - Verify that the proper
+	# number of responses are returned.
+	echo "Ping all-host-groups address(over default route!)"
+	ping -c2 224.0.0.1 > $PING_OUT
+	if [ $? -ne 0 ]; then
+		tst_brkm TFAIL "No response from MC hosts to ping 224.0.0.1"
+	fi
 
+	echo "Ping all-host-groups over specified interface"
+	ping -c2 -I $INTERFACE 224.0.0.1 > $PING_OUT
+	if [ $? -ne 0 ]; then
+		echo "Trying to ping with $INTERFACE_DEVICE"
+		echo "with the -I option instead of IP address"
+		ping -c2 -I $INTERFACE_DEVICE 224.0.0.1 > $PING_OUT
+		if [ $? -ne 0 ]; then
+			tst_brkm TFAIL "No response from MC hosts to ping -c2 "\
+				       "-I$INTERFACE 224.0.0.1"
+		fi
+	fi
+	grep -q $INTERFACE $PING_OUT
+	if [ $? -ne 0 ]; then
+		tst_brkm TFAIL "Local host did not respond to ping -c2 "\
+			       "-I$INTERFACE 224.0.0.1"
+	fi
 }
 
-#-----------------------------------------------------------------------
-#
-# FUNCTION:     do_cleanup
-# PURPOSE:      Called when the testcase is interrupted by the user
-#               or by interrupt_testcase() when time limit expired
-# INPUT:        None.
-# OUTPUT:       None.
-#
-#-----------------------------------------------------------------------
-
 do_cleanup()
 {
-   $trace_logic
-   echo "$this_file: doing $0."
-   rm -rf $TCtmp
+	rm -rf $TCtmp
 }
 
-#=============================================================================
-# FUNCTION NAME:        end_testcase
-#
-# FUNCTION DESCRIPTION: Clean up
-#
-# PARAMETERS:           string, IF AND ONLY IF the testcase fails
-#
-# RETURNS:              None.
-#=============================================================================
-
-end_testcase()
-{
-   $trace_logic
-   echo "$this_file: doing $0."
-
-   # Call other cleanup functions
-   [ $CLEANUP = "ON" ] && do_cleanup
-
-   [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
-   tst_resm TFAIL "Test Failed: $@"
-   exit 1
-}
-
-#*******************************************************************************
-#
-# FUNCTION:  MAIN
-# PURPOSE:   To invoke functions that perform the tasks as described in
-#            the design in the prolog above.
-# INPUT:     See SETUP in the prolog above.
-# OUTPUT:    Logged run results written to testcase run log
-#
-#*******************************************************************************
 setup
+TST_CLEANUP=do_cleanup
+
 do_test
-end_testcase
+if [ $? -ne 0 ]; then
+	tst_resm TFAIL "Test Failed"
+else
+	tst_resm TPASS "Test Successful"
+fi
+
+tst_exit
-- 
1.9.3




------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 2/4] multicast/mc_commo: Some cleanup
  2014-08-31 10:29 [LTP] [PATCH 1/4] multicast/mc_cmds: Some cleanup Zeng Linggang
@ 2014-08-31 10:30 ` Zeng Linggang
  2014-09-30 11:46   ` chrubis
  2014-08-31 10:30 ` [LTP] [PATCH 3/4] multicast/mc_member: " Zeng Linggang
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Zeng Linggang @ 2014-08-31 10:30 UTC (permalink / raw)
  To: ltp-list

* Delete trace_logic that is used to debug.
* Use test.sh script and use tst_* instead of end_testcase.
* Delete some unuseful comments.

* Fix old-style function definition.

Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
---
 testcases/network/multicast/mc_commo/mc_commo  | 283 ++++++++++---------------
 testcases/network/multicast/mc_commo/mc_recv.c |   2 +-
 testcases/network/multicast/mc_commo/mc_send.c |   8 +-
 3 files changed, 118 insertions(+), 175 deletions(-)

diff --git a/testcases/network/multicast/mc_commo/mc_commo b/testcases/network/multicast/mc_commo/mc_commo
index 44e9f7f..88cf2ba 100755
--- a/testcases/network/multicast/mc_commo/mc_commo
+++ b/testcases/network/multicast/mc_commo/mc_commo
@@ -33,199 +33,144 @@ unset LIBPATH
 #        for SLES
 #
 #******************************************************************************
-#Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
-
 
 TC=mc_commo
 TCtmp=${TCtmp:-"/tmp/mc_commo.$$"}
-CLEANUP=${CLEANUP:-ON}
-LTPROOT=${LTPROOT:-../../../..}
 TTL=10
 PORT=3333
 RHOST=${RHOST:-`hostname`}
 OUTFILE=$TCtmp/mc_commo_out
-NUMLOOPS=${NUMLOOPS:-2}
-INTERFACE=${INTERFACE:-$(mc_gethost `hostname` | grep addresses: | awk '{print $2}')}
+INTERFACE=${INTERFACE:-$(mc_gethost `hostname` | grep addresses: | \
+			 awk '{print $2}')}
 
 export TCID=$TC
 export TST_TOTAL=1
 export TST_COUNT=1
 
-this_file=${0##*/}
-trap "interrupt_test" 2
+. test.sh
 
-do_setup() {
-  mkdir -p $TCtmp
-  OCTET=`ps -ewf | grep [m]c_commo | wc -l | awk '{print $1}'`
-  GROUP_ADDR=224.0.0.$OCTET
+do_setup()
+{
+	mkdir -p $TCtmp
+	OCTET=`ps -ewf | grep [m]c_commo | wc -l | awk '{print $1}'`
+	GROUP_ADDR=224.0.0.$OCTET
 }
 
-#*******************************************************************************
-#
-# FUNCTION:  do_test
-# PURPOSE:   Executes the testcases.
-# INPUT:     Number of iterations
-# OUTPUT:    Error messages are logged when any verification test
-#            fails.
-#
-#-----------------------------------------------------------------------
-
 do_test ()
 {
-   $trace_logic
-   echo "$this_file: doing $0."
-
-
-
-   COUNT=1
-   while [ $COUNT -le $NUMLOOPS ]
-   do
-
-      # Run setsockopt/getsockopt test
-      # Start up the recv on local host
-      echo "Starting mc_recv on $GROUP_ADDR $INTERFACE $PORT"
-
-      mc_recv $GROUP_ADDR $INTERFACE $PORT \
-	>> $OUTFILE &
-      SERVER_PID=$!
-      sleep 5
-      ps -ewf | grep mc_recv | grep -v grep
-      [ $? = 0 ] || end_testcase "Could NOT start mc_recv on `hostname`"
-
-      grep -q "cannot join group" $OUTFILE
-      [ $? = 0 ] && end_testcase "Membership NOT set"
-
-      netstat -ng | grep -q $GROUP_ADDR
-      [ $? = 0 ] || end_testcase "membership not set for $GROUP_ADDR"
-
-# This eliminates the ping test but does not compromise the execution of the
-# test
-
-#      distro_version=""
-#      distro_name=""
-#      distro_version=`cat /etc/issue | awk {'print $7'}`
-#      distro_name=`cat /etc/issue | awk {'print $3'}`
-
-#       if [ $distro_version -ge 9 -a $distro_name = SUSE ]; then
-#          echo "Ping test skipped"
-#       else
-#           echo "Running ping to verify group can be reached "
-#           ping -c5 -I $INTERFACE $GROUP_ADDR > /dev/null
-#        [ $? = 0 ] || end_testcase "failed: ping -c5 -I $INTERFACE $GROUP_ADDR"
-#       fi
-
-
-      # Flood the interface in an attempt to overload the sends and
-      # recvs to and from the host.
-      #ping -f -s 4800 -I $INTERFACE $GROUP_ADDR >$TCtmp/pingfile  2>&1 &
-      #PING_PID=$!
-      #sleep 2
-      #kill -9 $PING_PID >/dev/null 2>&1
-      #cat $TCtmp/pingfile | grep "Message too long"
-      #[ $? = 0 ] || end_testcase "ping -f -s 4088 -c 1000 -I $INTERFACE $GROUP_ADDR should return an error regarding message being too long"
-
-      for HOST in $RHOST
-      do
-         echo "Running on $HOST mc_send $GROUP_ADDR $HOST $PORT $TTL"
-
-         rsh -n -l root $HOST "$LTPROOT/testcases/bin/mc_send" $GROUP_ADDR \
-	 $HOST $PORT $TTL >/dev/null &
-         sleep 10
-	rsh -n -l root $HOST "ps -ewf | grep mc_send | grep -v grep"
-          [ $? = 0 ] || end_testcase "Could NOT start mc_send on $HOST"
-      done
-
-      echo "Waiting for 100 sec.! Do not interrupt."
-      sleep 100  #wait until datagrams are received in $STATUS
-      COUNT=$(( $COUNT + 1 ))
-   done
-
-   #test if datagrams has been sent
-   for HOST in $RHOST
-   do
-      grep -q "$HOST [0-9] [0-9]" $OUTFILE
-      [ $? = 0 ] || end_testcase "NO Datagrams received from $HOST"
-   done
+	echo "doing test."
+
+	COUNT=1
+	while [ $COUNT -le 2 ]
+	do
+
+		# Run setsockopt/getsockopt test
+		# Start up the recv on local host
+		echo "Starting mc_recv on $GROUP_ADDR $INTERFACE $PORT"
+
+		mc_recv $GROUP_ADDR $INTERFACE $PORT >> $OUTFILE &
+		SERVER_PID=$!
+		sleep 5
+		ps -ewf | grep mc_recv | grep -v grep
+		if [ $? -ne 0 ]; then
+			tst_brkm TFAIL "Could NOT start mc_recv on `hostname`"
+		fi
+
+		grep -q "cannot join group" $OUTFILE
+		if [ $? -eq 0 ]; then
+			tst_brkm TFAIL "Membership NOT set"
+		fi
+
+		netstat -ng | grep -q $GROUP_ADDR
+		if [ $? -ne 0 ]; then
+			tst_brkm TFAIL "membership not set for $GROUP_ADDR"
+		fi
+
+		# This eliminates the ping test but does not compromise the
+		# execution of the test
+
+		#distro_version=""
+		#distro_name=""
+		#distro_version=`cat /etc/issue | awk {'print $7'}`
+		#distro_name=`cat /etc/issue | awk {'print $3'}`
+
+		#if [ $distro_version -ge 9 -a $distro_name = SUSE ]; then
+		#	echo "Ping test skipped"
+		#else
+		#	echo "Running ping to verify group can be reached "
+		#	ping -c5 -I $INTERFACE $GROUP_ADDR > /dev/null
+		#	if [ $? -ne 0 ]; then
+		#		tst_brkm TFAIL "failed: ping -c5 -I "\
+		#			       "$INTERFACE $GROUP_ADDR"
+		#	fi
+		#fi
+
+		# Flood the interface in an attempt to overload the sends and
+		# recvs to and from the host.
+		#ping -f -s 4800 -I $INTERFACE $GROUP_ADDR \
+		#     > $TCtmp/pingfile 2>&1 &
+		#PING_PID=$!
+		#sleep 2
+		#kill -9 $PING_PID >/dev/null 2>&1
+		#cat $TCtmp/pingfile | grep "Message too long"
+		#if [ $? -ne 0 ]; then
+		#	tst_brkm TFAIL "ping -f -s 4088 -c 1000 -I $INTERFACE "\
+		#		 "$GROUP_ADDR should return an error "\
+		#		 "regarding message being too long"
+		#fi
+
+		for HOST in $RHOST
+		do
+			echo "Running on $HOST mc_send $GROUP_ADDR $HOST "\
+			     "$PORT $TTL"
+
+			rsh -n -l root $HOST "$LTPROOT/testcases/bin/mc_send" \
+			    $GROUP_ADDR $HOST $PORT $TTL >/dev/null &
+			sleep 10
+			rsh -n -l root $HOST "ps -ewf | grep mc_send | "\
+			    "grep -v grep"
+			if [ $? -ne 0 ]; then
+				tst_brkm TFAIL "Could NOT start mc_send on "\
+					 "$HOST"
+			fi
+		done
+
+		echo "Waiting for 100 sec.! Do not interrupt."
+		sleep 100  #wait until datagrams are received in $STATUS
+		COUNT=$(( $COUNT + 1 ))
+	done
+
+	#test if datagrams has been sent
+	for HOST in $RHOST
+	do
+		grep -q "$HOST [0-9] [0-9]" $OUTFILE
+		if [ $? -ne 0 ]; then
+			tst_brkm TFAIL "NO Datagrams received from $HOST"
+		fi
+	done
 }
 
-#-----------------------------------------------------------------------
-#
-# FUNCTION:     do_cleanup
-# PURPOSE:      Called when the testcase is interrupted by the user
-#               or by interrupt_testcase() when time limit expired
-# INPUT:        None.
-# OUTPUT:       None.
-#
-#-----------------------------------------------------------------------
-
 do_cleanup()
 {
-   $trace_logic
-   echo "$this_file: doing $0."
-
-   # Kill all recv processes
-   echo "Killing all recv processes!!"
-   kill -9 $SERVER_PID
-
-   #PIDLIST=`ps -ef |grep "ping -f -s 4800" |awk '{print $2}'`
-   #for PID in $PIDLIST
-   #do
-   #   kill -9 $PID > /dev/null 2>>/dev/null
-   #done
-   rm -rf $TCtmp/pingfile
-   rm -rf $TCtmp/mc_commo_out
-   rm -rf $TCtmp
-}
+	echo "doing cleanup."
 
-#=============================================================================
-# FUNCTION NAME:        end_testcase
-#
-# FUNCTION DESCRIPTION: Clean up
-#
-# PARAMETERS:           string, IF AND ONLY IF the testcase fails
-#
-# RETURNS:              None.
-#=============================================================================
-
-end_testcase()
-{
-   $trace_logic
-   echo "$this_file: doing $0."
+	# Kill all recv processes
+	echo "Killing all recv processes!!"
+	kill -9 $SERVER_PID
 
-   # Call other cleanup functions
-   [ $CLEANUP = "ON" ] && do_cleanup
-
-   [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
-   tst_resm TFAIL "Test Failed: $@"
-   exit 1
-}
-
-#*****************************************************************************
-#
-# FUNCTION:  interrupt_test
-# PURPOSE:   Handle process interrupts set by trap.
-# INPUT:     none
-# OUTPUT:    none
-#
-#*****************************************************************************
-
-interrupt_test()
-{
-   echo "test interrupted"
-   end_testcase
+	rm -rf $TCtmp/pingfile
+	rm -rf $TCtmp/mc_commo_out
+	rm -rf $TCtmp
 }
 
-#******************************************************************************
-#
-# FUNCTION:  MAIN
-# PURPOSE:   To invoke functions that perform the tasks as described in
-#            the design in the prolog above.
-# INPUT:     See SETUP in the prolog above.
-# OUTPUT:    Logged run results written to testcase run log
-#
-#******************************************************************************
 do_setup
+TST_CLEANUP=do_cleanup
+
 do_test
-end_testcase
+if [ $? -ne 0 ]; then
+	tst_resm TFAIL "Test Failed"
+else
+	tst_resm TPASS "Test Successful"
+fi
+
+tst_exit
diff --git a/testcases/network/multicast/mc_commo/mc_recv.c b/testcases/network/multicast/mc_commo/mc_recv.c
index 43768f2..bb25a3d 100644
--- a/testcases/network/multicast/mc_commo/mc_recv.c
+++ b/testcases/network/multicast/mc_commo/mc_recv.c
@@ -11,7 +11,7 @@
 
 #define	MAXBUFSIZ	8096
 
-char buf[MAXBUFSIZ];
+static char buf[MAXBUFSIZ];
 
 int main(int argc, char *argv[])
 {
diff --git a/testcases/network/multicast/mc_commo/mc_send.c b/testcases/network/multicast/mc_commo/mc_send.c
index 6bc5fbf..df9a263 100644
--- a/testcases/network/multicast/mc_commo/mc_send.c
+++ b/testcases/network/multicast/mc_commo/mc_send.c
@@ -12,12 +12,10 @@
 
 #define	MAXBUFSIZ	8096
 
-char buf[MAXBUFSIZ];
-int Num_Loops = 100;
+static char buf[MAXBUFSIZ];
+static int Num_Loops = 100;
 
-int main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
 {
 	struct ip_mreq imr;
 	struct sockaddr_in sin, mcast_out;
-- 
1.9.3




------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 3/4] multicast/mc_member: Some cleanup
  2014-08-31 10:29 [LTP] [PATCH 1/4] multicast/mc_cmds: Some cleanup Zeng Linggang
  2014-08-31 10:30 ` [LTP] [PATCH 2/4] multicast/mc_commo: " Zeng Linggang
@ 2014-08-31 10:30 ` Zeng Linggang
  2014-09-30 11:54   ` chrubis
  2014-08-31 10:31 ` [LTP] [PATCH 4/4] multicast/mc_opts: " Zeng Linggang
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Zeng Linggang @ 2014-08-31 10:30 UTC (permalink / raw)
  To: ltp-list

* Delete trace_logic that is used to debug.
* Use test.sh script and use tst_* instead of end_testcase.
* Delete some unuseful comments.

* Fix old-style function definition.

Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
---
 testcases/network/multicast/mc_member/mc_member | 237 +++++++++---------------
 testcases/network/multicast/mc_member/member.c  |  21 +--
 2 files changed, 94 insertions(+), 164 deletions(-)

diff --git a/testcases/network/multicast/mc_member/mc_member b/testcases/network/multicast/mc_member/mc_member
index 3ffdc99..2034e6a 100755
--- a/testcases/network/multicast/mc_member/mc_member
+++ b/testcases/network/multicast/mc_member/mc_member
@@ -33,17 +33,11 @@ unset LIBPATH
 #      -Ported
 #
 #******************************************************************************
-#Uncomment the line below for debug output
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
 
 TC=mc_member
 TCsrc=${TCsrc:-`pwd`}
 TCtmp=${TCtmp:-$TCsrc/$TC$$}
-CLEANUP=${CLEANUP:-ON}
 
-EXECUTABLES=${EXECUTABLES:-"member"}
-NUMLOOPS=${NUMLOOPS:-2}
 INTERFACE=${INTERFACE:-$(mc_gethost `hostname`| grep address |awk '{ print $2 }')}
 GLIST=${GLIST:-$TCsrc/ManyGroups}
 TooManyGLIST=${TooManyGLIST:-$TCsrc/TooManyGroups}
@@ -53,168 +47,107 @@ export TCID=$TC
 export TST_TOTAL=1
 export TST_COUNT=1
 
-this_file=${0##*/}
-trap "interrupt_test" 2
+. test.sh
 
 setup()
 {
-  mkdir -p $TCtmp
+	mkdir -p $TCtmp
 }
 
 get_address()
 {
-  DIGIT=`ps -ef | grep mc_member | grep -v grep | wc -l`
-  ADDRESS=$DIGIT.$DIGIT.$DIGIT.$DIGIT
+	DIGIT=`ps -ef | grep mc_member | grep -v grep | wc -l`
+	ADDRESS=$DIGIT.$DIGIT.$DIGIT.$DIGIT
 }
 
-#******************************************************************************
-#
-# FUNCTION:  do_test
-# PURPOSE:   Executes the testcases.
-# INPUT:     Number of iterations
-# OUTPUT:    Error messages are logged when any verification test
-#            fails.
-#
-#-----------------------------------------------------------------------
-
 do_test()
 {
-   $trace_logic
-   echo "$this_file: doing $0."
-
-   COUNT=1
-   while [ $COUNT -le $NUMLOOPS ]
-   do
-      # Run setsockopt test with bogus network
-      get_address
-      echo "Running mc_member_e on $ADDRESS"
-      $TCsrc/$EXECUTABLES -j -g $GLIST -s 30 -i $ADDRESS >/dev/null 2>&1
-
-      # Run setsockopt/getsockopt test
-
-      $TCsrc/$EXECUTABLES -g $GLIST -s 80 -i $INTERFACE > $ERRFILE 2>&1 &
-
-      # Join twice and leave once and see if the groups are still joined on
-      # all specified interfaces.
-
-      for agroup in `cat $GLIST`
-      do
-         echo "Running (1st) member on $INTERFACE"
-         $TCsrc/$EXECUTABLES -j -g $GLIST -s 30 -i $INTERFACE > $ERRFILE 2>&1 &
-         sleep 5
-         grep "cannot join group" $ERRFILE
-         [ $? = 0 ] && end_testcase "MC group could NOT join $INTERFACE"
-
-         echo "Running (2nd) member on  $INTERFACE"
-         $TCsrc/$EXECUTABLES -g $GLIST -s 60 -i $INTERFACE > $ERRFILE 2>&1 &
-         sleep 5
-         grep "cannot join group" $ERRFILE
-         [ $? = 0 ] && end_testcase "MC group could NOT join $INTERFACE"
-      done
-
-      # See if the groups are joined
-
-      for agroup in `cat $GLIST`
-      do
-	 netstat -gn | grep $agroup
-         [ $? = 0 ] || end_testcase "$agroup NOT joined to $INTERFACE"
-
-         # See if they respond to a ping.
-	 #ping -c 3 -I $INTERFACE $agroup
-	 #[ $? != 0 ] && { echo "Error - $TC: $agroup NOT responding over $INTERFACE" ;}
-
-      done
-
-      echo "Waiting 60 seconds! Do not interrupt!"
-      sleep 60 # Make sure the first process has stopped
-
-      for agroup in `cat $GLIST`
-      do
-	netstat -gn | grep $agroup
-        if [ $? != 1 ]; then
-	   end_testcase "$agroup still joined on $INTERFACE"
-	fi
-      done
-
-      # Test the membership boundaries
-
-      echo "Running member on too many groups over $INTERFACE"
-      $TCsrc/$EXECUTABLES -j -g $TooManyGLIST -i $INTERFACE > $ERRFILE 2>&1 &
-
-      count=`grep 105 $ERRFILE | wc -l`
-
-      [ $count -gt 3 ] && end_testcase "Could not join members!"
-
-      COUNT=$(( $COUNT + 1 ))
-
-   done   # end of while numloop
+	echo "doing test."
+
+	COUNT=1
+	while [ $COUNT -le 2 ]
+	do
+		# Run setsockopt test with bogus network
+		get_address
+		echo "Running mc_member_e on $ADDRESS"
+		member -j -g $GLIST -s 30 -i $ADDRESS >/dev/null 2>&1
+
+		# Run setsockopt/getsockopt test
+		member -g $GLIST -s 80 -i $INTERFACE > $ERRFILE 2>&1 &
+
+		# Join twice and leave once and see if the groups are still
+		# joined on all specified interfaces.
+		for agroup in `cat $GLIST`
+		do
+			echo "Running (1st) member on $INTERFACE"
+			member -j -g $GLIST -s 30 -i $INTERFACE \
+			       > $ERRFILE 2>&1 &
+			sleep 5
+			grep "cannot join group" $ERRFILE
+			if [ $? -eq 0 ]; then
+				tst_brkm FAIL "MC group could NOT join "\
+					      "$INTERFACE"
+			fi
+
+			echo "Running (2nd) member on $INTERFACE"
+			member -g $GLIST -s 60 -i $INTERFACE > $ERRFILE 2>&1 &
+			sleep 5
+			grep "cannot join group" $ERRFILE
+			if [ $? -eq 0 ]; then
+				tst_brkm FAIL "MC group could NOT join "\
+					      "$INTERFACE"
+			fi
+		done
+
+		# See if the groups are joined
+		for agroup in `cat $GLIST`
+		do
+			netstat -gn | grep $agroup
+			if [ $? -ne 0 ]; then
+				tst_brkm FAIL "$agroup NOT joined to $INTERFACE"
+			fi
+		done
+
+		echo "Waiting 60 seconds! Do not interrupt!"
+		sleep 60 # Make sure the first process has stopped
+
+		for agroup in `cat $GLIST`
+		do
+			netstat -gn | grep $agroup
+			if [ $? -ne 1 ]; then
+				tst_brkm FAIL "$agroup still joined on "\
+					      "$INTERFACE"
+			fi
+		done
+
+		# Test the membership boundaries
+		echo "Running member on too many groups over $INTERFACE"
+		member -j -g $TooManyGLIST -i $INTERFACE > $ERRFILE 2>&1 &
+
+		count=`grep 105 $ERRFILE | wc -l`
+		if [ $count -gt 3 ]; then
+			tst_brkm FAIL "Could not join members!"
+		fi
+
+		COUNT=$(( $COUNT + 1 ))
+
+	done   # end of while numloop
 }
 
-#-----------------------------------------------------------------------
-#
-# FUNCTION:     do_cleanup
-# PURPOSE:      Called when the testcase is interrupted by the user
-#               or by interrupt_testcase() when time limit expired
-# INPUT:        None.
-# OUTPUT:       None.
-#
-#-----------------------------------------------------------------------
-
 do_cleanup()
 {
-   $trace_logic
-   echo "$this_file: doing $0."
-
-   rm -rf $TCtmp
-}
-
-#=============================================================================
-# FUNCTION NAME:        end_testcase
-#
-# FUNCTION DESCRIPTION: Clean up
-#
-# PARAMETERS:           string, IF AND ONLY IF the testcase fails
-#
-# RETURNS:              None.
-#=============================================================================
-
-end_testcase()
-{
-   $trace_logic
-   echo "$this_file: doing $0."
-
-   # Call other cleanup functions
-   [ $CLEANUP = "ON" ] && do_cleanup
-
-   [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
-   tst_resm TFAIL "Test Failed: $@"
-   exit 1
-}
-
-#******************************************************************************
-#
-# FUNCTION:  interrupt_test
-# PURPOSE:   Handle process interrupts set by trap.
-# INPUT:     none
-# OUTPUT:    none
-#
-#******************************************************************************
-
-interrupt_test()
-{
-   echo "test interrupted"
-   end_testcase
+	echo "doing cleanup."
+	rm -rf $TCtmp
 }
 
-#******************************************************************************
-#
-# FUNCTION:  MAIN
-# PURPOSE:   To invoke functions that perform the tasks as described in
-#            the design in the prolog above.
-# INPUT:     See SETUP in the prolog above.
-# OUTPUT:    Logged run results written to testcase run log
-#
-#******************************************************************************
 setup
+TST_CLEANUP=do_cleanup
+
 do_test
-end_testcase
+if [ $? -ne 0 ]; then
+	tst_resm TFAIL "Test Failed"
+else
+	tst_resm TPASS "Test Successful"
+fi
+
+tst_exit
diff --git a/testcases/network/multicast/mc_member/member.c b/testcases/network/multicast/mc_member/member.c
index 5b51dbe..810b786 100644
--- a/testcases/network/multicast/mc_member/member.c
+++ b/testcases/network/multicast/mc_member/member.c
@@ -9,17 +9,14 @@
 #include <netdb.h>
 #include <unistd.h>
 
-char *prog;
-int errors = 0;
-int ttl_no = 255;
+static char *prog;
+static int errors;
 
-int join_group(int, char *, struct ip_mreq *);
-int leave_group(int, char *, struct ip_mreq *);
-void usage(void);
+static int join_group(int, char *, struct ip_mreq *);
+static int leave_group(int, char *, struct ip_mreq *);
+static void usage(void);
 
-int main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
 {
 	int s;
 	struct ip_mreq imr;
@@ -111,7 +108,7 @@ char *argv[];
 	return (0);
 }
 
-int join_group(int s, char *glist, struct ip_mreq *imr)
+static int join_group(int s, char *glist, struct ip_mreq *imr)
 {
 	char buf[40];
 	unsigned g1, g2, g3, g4;
@@ -145,7 +142,7 @@ int join_group(int s, char *glist, struct ip_mreq *imr)
 	return (0);
 }
 
-int leave_group(int s, char *glist, struct ip_mreq *imr)
+static int leave_group(int s, char *glist, struct ip_mreq *imr)
 {
 	char buf[40];
 	unsigned g1, g2, g3, g4;
@@ -178,7 +175,7 @@ int leave_group(int s, char *glist, struct ip_mreq *imr)
 	return (0);
 }
 
-void usage()
+static void usage(void)
 {
 	fprintf(stderr,
 		"usage: %s [ -j -l ] -g group_list [-s time_to_sleep] -i interface_name (or i.i.i.i)\n",
-- 
1.9.3




------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 4/4] multicast/mc_opts: Some cleanup
  2014-08-31 10:29 [LTP] [PATCH 1/4] multicast/mc_cmds: Some cleanup Zeng Linggang
  2014-08-31 10:30 ` [LTP] [PATCH 2/4] multicast/mc_commo: " Zeng Linggang
  2014-08-31 10:30 ` [LTP] [PATCH 3/4] multicast/mc_member: " Zeng Linggang
@ 2014-08-31 10:31 ` Zeng Linggang
  2014-09-30 12:16   ` chrubis
  2014-09-25  9:53 ` [LTP] [PATCH 1/4] multicast/mc_cmds: " Zeng Linggang
  2014-09-30  9:42 ` [LTP] [PATCH 1/4] multicast/mc_cmds: " chrubis
  4 siblings, 1 reply; 14+ messages in thread
From: Zeng Linggang @ 2014-08-31 10:31 UTC (permalink / raw)
  To: ltp-list

* Delete trace_logic that is used to debug.
* Use test.sh script and use tst_* instead of end_testcase.
* Delete some unuseful comments.

* Fix old-style function definition.

Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
---
 testcases/network/multicast/mc_opts/mc_opts  | 161 ++++++---------------------
 testcases/network/multicast/mc_opts/opts.c   |   7 +-
 testcases/network/multicast/mc_opts/opts_e.c |   6 +-
 3 files changed, 40 insertions(+), 134 deletions(-)

diff --git a/testcases/network/multicast/mc_opts/mc_opts b/testcases/network/multicast/mc_opts/mc_opts
index f40112c..5433deb 100755
--- a/testcases/network/multicast/mc_opts/mc_opts
+++ b/testcases/network/multicast/mc_opts/mc_opts
@@ -35,142 +35,55 @@ unset LIBPATH
 #      -Ported
 #
 #******************************************************************************
-#Uncomment the line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
 
-if [ -z $LTPBIN ]; then
-  PATH=../../../bin/:./:$PATH
-fi
 TC=mc_opts
-TCtmp=${TCtmp:-$LTPROOT/bin/$TC$$}
-CLEANUP=${CLEANUP:-ON}
 EXECUTABLES=${EXECUTABLES:-"opts opts_e"}
-NUMLOOPS=${NUMLOOPS:-10}
 IPADDR=${IPADDR:-$(mc_gethost `hostname`| grep address |awk '{ print $2 }')}
 
 export TCID=$TC
 export TST_TOTAL=1
 export TST_COUNT=1
 
-this_file=${0##*/}
-trap "interrupt_test" 2
-
-setup()
-{
-  mkdir -p $TCtmp
-  for i in $EXECUTABLES
-  do
-    install -m 0755 "$LTPROOT/testcases/bin/$i" "$TCtmp/."
-  done
-}
-
-#-----------------------------------------------------------------------
-#
-# FUNCTION:  do_test
-# PURPOSE:   Executes the testcases.
-# INPUT:     Number of iterations
-# OUTPUT:    Error messages are logged when any verification test
-#            fails.
-#
-#-----------------------------------------------------------------------
+. test.sh
 
 do_test()
 {
-   $trace_logic
-   echo "$this_file: doing $0."
-
-   COUNT=1
-   while [ $COUNT -le $NUMLOOPS ]
-   do
-      # Run setsockopt/getsockopt test
-      echo "Running mc_$EXECUTABLES on $IPADDR"
-      for i in $EXECUTABLES
-      do
-        $TCtmp/$i $IPADDR
-        [ $? = 0 ] || end_testcase "$i $IPADDR failed"
-      done
-
-      echo "Running ping with bad values"
-      ping -T 777 224.0.0.1 > /dev/null 2>&1
-      [ $? = 0 ] && end_testcase "Multicast range should be out of range"
-
-      echo "Running ping on a invalid interface!"
-      ping -I 3.3.3.3 224.0.0.1 > /dev/null 2>&1
-      [ $? = 0 ] && end_testcase "ping on bogus interface should fail"
-
-      COUNT=$(( $COUNT + 1 ))
-   done
+	echo "doing test."
+
+	COUNT=1
+	while [ $COUNT -le 10 ]
+	do
+		# Run setsockopt/getsockopt test
+		echo "Running mc_$EXECUTABLES on $IPADDR"
+		for i in $EXECUTABLES
+		do
+			$i $IPADDR
+			if [ $? -ne 0 ]; then
+				tst_brkm FAIL "$i $IPADDR failed"
+			fi
+		done
+
+		echo "Running ping with bad values"
+		ping -T 777 224.0.0.1 > /dev/null 2>&1
+		if [ $? -eq 0 ]; then
+			tst_brkm FAIL "Multicast range should be out of range"
+		fi
+
+		echo "Running ping on a invalid interface!"
+		ping -I 3.3.3.3 224.0.0.1 > /dev/null 2>&1
+		if [ $? -eq 0 ]; then
+			tst_brkm FAIL "ping on bogus interface should fail"
+		fi
+
+		COUNT=$(( $COUNT + 1 ))
+	done
 }
 
-#-----------------------------------------------------------------------
-#
-# FUNCTION:     do_cleanup
-# PURPOSE:      Called when the testcase is interrupted by the user
-#               or by interrupt_testcase() when time limit expired
-# INPUT:        None.
-# OUTPUT:       None.
-#
-#-----------------------------------------------------------------------
-
-do_cleanup()
-{
-   $trace_logic
-   echo "$this_file: doing $0."
-
-   cd /
-   if [ "x$TCtmp" != "x$TCsrc" ]; then
-      rm -rf $TCtmp
-   fi
-}
-
-#=============================================================================
-# FUNCTION NAME:        end_testcase
-#
-# FUNCTION DESCRIPTION: Clean up
-#
-# PARAMETERS:           string, IF AND ONLY IF the testcase fails
-#
-# RETURNS:              None.
-#=============================================================================
-
-end_testcase()
-{
-   $trace_logic
-   echo "$this_file: doing $0."
-
-   # Call other cleanup functions
-   [ $CLEANUP = "ON" ] && do_cleanup
-
-   [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
-   tst_resm TFAIL "Test Failed: $@"
-   exit 1
-}
-
-#******************************************************************************
-#
-# FUNCTION:  interrupt_test
-# PURPOSE:   Handle process interrupts set by trap.
-# INPUT:     none
-# OUTPUT:    none
-#
-#******************************************************************************
-
-interrupt_test()
-{
-   echo "test interrupted"
-   end_testcase
-}
-
-#******************************************************************************
-#
-# FUNCTION:  MAIN
-# PURPOSE:   To invoke functions that perform the tasks as described in
-#            the design in the prolog above.
-# INPUT:     See SETUP in the prolog above.
-# OUTPUT:    Logged run results written to testcase run log
-#
-#******************************************************************************
-setup
 do_test
-end_testcase
+if [ $? -ne 0 ]; then
+	tst_resm TFAIL "Test Failed"
+else
+	tst_resm TPASS "Test Successful"
+fi
+
+tst_exit
diff --git a/testcases/network/multicast/mc_opts/opts.c b/testcases/network/multicast/mc_opts/opts.c
index 0174d91..8a1f5c8 100644
--- a/testcases/network/multicast/mc_opts/opts.c
+++ b/testcases/network/multicast/mc_opts/opts.c
@@ -11,12 +11,9 @@
 
 #define	MAXBUFSIZ	8096
 
-char buff[MAXBUFSIZ];
-int errors = 0;
+static int errors = 0;
 
-int main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
 {
 	int s;
 	struct in_addr gimr;
diff --git a/testcases/network/multicast/mc_opts/opts_e.c b/testcases/network/multicast/mc_opts/opts_e.c
index f91fa93..663032a 100644
--- a/testcases/network/multicast/mc_opts/opts_e.c
+++ b/testcases/network/multicast/mc_opts/opts_e.c
@@ -10,11 +10,7 @@
 
 #define	MAXBUFSIZ	8096
 
-char buff[MAXBUFSIZ];
-
-int main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
 {
 	int s;
 	struct in_addr simr, gimr;
-- 
1.9.3




------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [LTP] [PATCH 1/4] multicast/mc_cmds: Some cleanup
  2014-08-31 10:29 [LTP] [PATCH 1/4] multicast/mc_cmds: Some cleanup Zeng Linggang
                   ` (2 preceding siblings ...)
  2014-08-31 10:31 ` [LTP] [PATCH 4/4] multicast/mc_opts: " Zeng Linggang
@ 2014-09-25  9:53 ` Zeng Linggang
  2014-09-30 12:20   ` chrubis
  2014-09-30  9:42 ` [LTP] [PATCH 1/4] multicast/mc_cmds: " chrubis
  4 siblings, 1 reply; 14+ messages in thread
From: Zeng Linggang @ 2014-09-25  9:53 UTC (permalink / raw)
  To: ltp-list

Ping. :)

Best regards,
Zeng
On Sun, 2014-08-31 at 18:29 +0800, Zeng Linggang wrote:
> * Fix a typo.
> * Delete trace_logic that is used to debug.
> * Use test.sh script and use tst_* instead of end_testcase.
> * Delete some unuseful comments.
> 
> Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
> ---
>  testcases/network/multicast/mc_cmds/mc_cmds | 239 ++++++++++------------------
>  1 file changed, 86 insertions(+), 153 deletions(-)
> 
> diff --git a/testcases/network/multicast/mc_cmds/mc_cmds b/testcases/network/multicast/mc_cmds/mc_cmds
> index 54fc69c..3799e26 100755
> --- a/testcases/network/multicast/mc_cmds/mc_cmds
> +++ b/testcases/network/multicast/mc_cmds/mc_cmds
> @@ -20,7 +20,7 @@
>  #
>  #  FILE             : mc_cmds
>  #  TEST DESCRIPTION : To determine the stability of the IP Multicast product
> -#                and to verify the accuracy and usablility of IP Multicast
> +#                and to verify the accuracy and usability of IP Multicast
>  #                related publications associated with changes and/or
>  #                additions to command level interfaces for this implementations
>  #                of IP Multicast.
> @@ -30,181 +30,114 @@
>  #
>  #*******************************************************************************
>  
> -#Uncomment line below for debug output.
> -#trace_logic=${trace_logic:-"set -x"}
> -$trace_logic
> -
>  TC=mc_cmds
>  TCtmp=${TCtmp:-$TMPDIR/$TC$$}
>  PING_OUT=${TCtmp}/PING_OUT
> -HOSTNAME=`hostname`
> -CLEANUP=${CLEANUP:-ON}
>  
>  export TCID=$TC
>  export TST_TOTAL=1
>  export TST_COUNT=1
>  
> +. test.sh
> +
>  setup()
>  {
> -   mkdir -p $TCtmp || { tst_brkm TBROK NULL "Could not create $TCtmp"; exit 1; }
> +	cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts | grep 1 > /dev/null
> +	if [ $? -eq 0 ]; then
> +		tst_brkm TCONF "Multicast ping disabled on this system."
> +	fi
> +
> +	mkdir -p $TCtmp
> +	if [ $? -ne 0 ]; then
> +		tst_brkm TBROK NULL "Could not create $TCtmp";
> +	fi
>  }
>  
> -#*******************************************************************************
> -#
> -# FUNCTION:  do_test
> -# PURPOSE:   Test changes to ifconfig, netstat, and ping commands
> -# INPUT:     None
> -# OUTPUT:    Error messages are logged when any verification test
> -#            fails.
> -#
> -#-----------------------------------------------------------------------
>  do_test()
>  {
> -   $trace_logic
> -   echo "Getting ALL enabled interfaces which are configured !"
> -
> -   IFNAME=${IFNAME:-$(netstat -i -n | grep "^[b-z]\{2,4\}[0-9][^*]"|\
> -      awk '{print $1}')}
> -   INTERFACE=${INTERFACE:-$(mc_gethost `hostname` | grep addresses: | awk '{print $2}')}
> -
> -   echo "Testing ifconfig and netstat"
> -
> -# Commented begin
> -#   # See if interface can be used for IP Multicast
> -#   ifconfig $IFNAME | grep -q MULTICAST
> -#   if [ $? != 0 ]; then
> -#	end_testcase "Multicast not listed for $IFNAME"
> -#   fi
> -#   netstat -gn | grep $IFNAME | grep -q 224.0.0.1
> -#   [ $? = 0 ] || end_testcase "all-host-group for $IFNAME not joined"
> -# Commented end
> -
> -#Finds the active ethernet interface
> -for eth in $IFNAME
> -    do
> -         ifconfig $eth | grep -q $INTERFACE
> -          if [ $? -eq 0 ]
> -          then
> -                INTERFACE_DEVICE=$eth
> -		break
> -           fi
> -    done
> -
> -# Added for support for more adapters configured
> -    MulticastAdap=
> -    for eth in $IFNAME
> -    do
> -
> -	$trace_logic
> -	ifconfig $eth | grep -q MULTICAST
> -	if [ $? -eq 0 ]
> -	then
> -	    $trace_logic
> -	    MulticastAdap=$eth
> -	    break
> +	echo "Getting ALL enabled interfaces which are configured !"
> +
> +	IFNAME=${IFNAME:-$(netstat -i -n | sed '1,2 d' | awk '{print $1}')}
> +	INTERFACE=${INTERFACE:-$(mc_gethost `hostname` | grep addresses: | \
> +				 awk '{print $2}')}
> +
> +	echo "Testing ifconfig and netstat"
> +
> +	# Finds the active ethernet interface
> +	for eth in $IFNAME
> +	do
> +		ifconfig $eth | grep -q $INTERFACE
> +		if [ $? -eq 0 ]; then
> +			INTERFACE_DEVICE=$eth
> +			break
> +		fi
> +	done
> +
> +	MulticastAdap=
> +	for eth in $IFNAME
> +	do
> +
> +		ifconfig $eth | grep -q MULTICAST
> +		if [ $? -eq 0 ]; then
> +			MulticastAdap=$eth
> +			break
> +		fi
> +	done
> +	if [ -z $MulticastAdap ]; then
> +		tst_brkm TFAIL "Multicast not listed for $IFNAME"
>  	fi
> -    done
> -    if [ -z $MulticastAdap ]
> -    then
> -	end_testcase "Multicast not listed for $IFNAME"
> -    fi
> -    MulticastAdapJoined=
> -    for eth in $IFNAME
> -    do
> -	$trace_logic
> -	netstat -gn | grep $eth | grep -q 224.0.0.1
> -	if [ $? -eq 0 ]
> -	then
> -	    $trace_logic
> -	    MulticastAdapJoined=1
> -	    break
> +	MulticastAdapJoined=
> +	for eth in $IFNAME
> +	do
> +		netstat -gn | grep $eth | grep -q 224.0.0.1
> +		if [ $? -eq 0 ]; then
> +			MulticastAdapJoined=1
> +			break
> +		fi
> +	done
> +	if [ -z $MulticastAdapJoined ]; then
> +		tst_brkm TFAIL "all-host-group for $IFNAME not joined"
>  	fi
> -    done
> -    if [ -z $MulticastAdapJoined ]
> -    then
> -	end_testcase "all-host-group for $IFNAME not joined"
> -    fi
> -# Added end
> -
> -   cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts | grep 1 > /dev/null
> -   if [ $? -eq 0 ]
> -   then
> -       tst_resm TCONF "Multicast ping disabled on this system (this is normal on post year:2005 kernels)"
> -       rm -rf $TCtmp
> -       exit 0
> -   fi
> -
> -   # Do the ping tests: Execute ping 224.0.0.1 - Verify that the proper
> -   # number of responses are returned.
> -
> -   echo "Ping all-host-groups address(over default route!)"
> -   ping -c2 224.0.0.1 > $PING_OUT
> -   [ $? = 0 ] || end_testcase "No response from MC hosts to ping 224.0.0.1"
> -
> -   echo "Ping all-host-groups over specified interface"
> -   ping -c2 -I $INTERFACE 224.0.0.1 > $PING_OUT
> -  if [ $? -ne 0 ]
> -   then
> -        echo "Trying to ping with $INTERFACE_DEVICE instead of IP address"
> -        echo "with the -I option"
> -        ping -c2 -I $INTERFACE_DEVICE 224.0.0.1 > $PING_OUT
> -   [ $? = 0 ] || end_testcase "No response from MC hosts to ping -c2 -I$INTERFACE 224.0.0.1"
> -fi
> -   grep -q $INTERFACE $PING_OUT
> -   [ $? = 0 ] || end_testcase "Local host did not respond to ping -c2 -I$INTERFACE 224.0.0.1"
>  
> +	# Do the ping tests: Execute ping 224.0.0.1 - Verify that the proper
> +	# number of responses are returned.
> +	echo "Ping all-host-groups address(over default route!)"
> +	ping -c2 224.0.0.1 > $PING_OUT
> +	if [ $? -ne 0 ]; then
> +		tst_brkm TFAIL "No response from MC hosts to ping 224.0.0.1"
> +	fi
>  
> +	echo "Ping all-host-groups over specified interface"
> +	ping -c2 -I $INTERFACE 224.0.0.1 > $PING_OUT
> +	if [ $? -ne 0 ]; then
> +		echo "Trying to ping with $INTERFACE_DEVICE"
> +		echo "with the -I option instead of IP address"
> +		ping -c2 -I $INTERFACE_DEVICE 224.0.0.1 > $PING_OUT
> +		if [ $? -ne 0 ]; then
> +			tst_brkm TFAIL "No response from MC hosts to ping -c2 "\
> +				       "-I$INTERFACE 224.0.0.1"
> +		fi
> +	fi
> +	grep -q $INTERFACE $PING_OUT
> +	if [ $? -ne 0 ]; then
> +		tst_brkm TFAIL "Local host did not respond to ping -c2 "\
> +			       "-I$INTERFACE 224.0.0.1"
> +	fi
>  }
>  
> -#-----------------------------------------------------------------------
> -#
> -# FUNCTION:     do_cleanup
> -# PURPOSE:      Called when the testcase is interrupted by the user
> -#               or by interrupt_testcase() when time limit expired
> -# INPUT:        None.
> -# OUTPUT:       None.
> -#
> -#-----------------------------------------------------------------------
> -
>  do_cleanup()
>  {
> -   $trace_logic
> -   echo "$this_file: doing $0."
> -   rm -rf $TCtmp
> +	rm -rf $TCtmp
>  }
>  
> -#=============================================================================
> -# FUNCTION NAME:        end_testcase
> -#
> -# FUNCTION DESCRIPTION: Clean up
> -#
> -# PARAMETERS:           string, IF AND ONLY IF the testcase fails
> -#
> -# RETURNS:              None.
> -#=============================================================================
> -
> -end_testcase()
> -{
> -   $trace_logic
> -   echo "$this_file: doing $0."
> -
> -   # Call other cleanup functions
> -   [ $CLEANUP = "ON" ] && do_cleanup
> -
> -   [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
> -   tst_resm TFAIL "Test Failed: $@"
> -   exit 1
> -}
> -
> -#*******************************************************************************
> -#
> -# FUNCTION:  MAIN
> -# PURPOSE:   To invoke functions that perform the tasks as described in
> -#            the design in the prolog above.
> -# INPUT:     See SETUP in the prolog above.
> -# OUTPUT:    Logged run results written to testcase run log
> -#
> -#*******************************************************************************
>  setup
> +TST_CLEANUP=do_cleanup
> +
>  do_test
> -end_testcase
> +if [ $? -ne 0 ]; then
> +	tst_resm TFAIL "Test Failed"
> +else
> +	tst_resm TPASS "Test Successful"
> +fi
> +
> +tst_exit



------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [LTP] [PATCH 1/4] multicast/mc_cmds: Some cleanup
  2014-08-31 10:29 [LTP] [PATCH 1/4] multicast/mc_cmds: Some cleanup Zeng Linggang
                   ` (3 preceding siblings ...)
  2014-09-25  9:53 ` [LTP] [PATCH 1/4] multicast/mc_cmds: " Zeng Linggang
@ 2014-09-30  9:42 ` chrubis
  4 siblings, 0 replies; 14+ messages in thread
From: chrubis @ 2014-09-30  9:42 UTC (permalink / raw)
  To: Zeng Linggang; +Cc: ltp-list

Hi!
> * Fix a typo.
> * Delete trace_logic that is used to debug.
> * Use test.sh script and use tst_* instead of end_testcase.
> * Delete some unuseful comments.
> 
> Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
> ---
>  testcases/network/multicast/mc_cmds/mc_cmds | 239 ++++++++++------------------
>  1 file changed, 86 insertions(+), 153 deletions(-)
> 
> diff --git a/testcases/network/multicast/mc_cmds/mc_cmds b/testcases/network/multicast/mc_cmds/mc_cmds
> index 54fc69c..3799e26 100755
> --- a/testcases/network/multicast/mc_cmds/mc_cmds
> +++ b/testcases/network/multicast/mc_cmds/mc_cmds
> @@ -20,7 +20,7 @@
>  #
>  #  FILE             : mc_cmds
>  #  TEST DESCRIPTION : To determine the stability of the IP Multicast product
> -#                and to verify the accuracy and usablility of IP Multicast
> +#                and to verify the accuracy and usability of IP Multicast
>  #                related publications associated with changes and/or
>  #                additions to command level interfaces for this implementations
>  #                of IP Multicast.
> @@ -30,181 +30,114 @@
>  #
>  #*******************************************************************************
>  
> -#Uncomment line below for debug output.
> -#trace_logic=${trace_logic:-"set -x"}
> -$trace_logic
> -
>  TC=mc_cmds
>  TCtmp=${TCtmp:-$TMPDIR/$TC$$}
>  PING_OUT=${TCtmp}/PING_OUT
> -HOSTNAME=`hostname`
> -CLEANUP=${CLEANUP:-ON}
>  
>  export TCID=$TC
>  export TST_TOTAL=1
>  export TST_COUNT=1
>  
> +. test.sh
> +
>  setup()
>  {
> -   mkdir -p $TCtmp || { tst_brkm TBROK NULL "Could not create $TCtmp"; exit 1; }
> +	cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts | grep 1 > /dev/null

Why the grep?

we can do:

val = $(cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts)
if [ "$val" -ne 0 ]; then
	...

> +	if [ $? -eq 0 ]; then
> +		tst_brkm TCONF "Multicast ping disabled on this system."
> +	fi
> +
> +	mkdir -p $TCtmp
> +	if [ $? -ne 0 ]; then
> +		tst_brkm TBROK NULL "Could not create $TCtmp";
> +	fi

You should rather use tst_tmpdir once the testcase is being converted to
test.sh library.

>  }
>  
> -#*******************************************************************************
> -#
> -# FUNCTION:  do_test
> -# PURPOSE:   Test changes to ifconfig, netstat, and ping commands
> -# INPUT:     None
> -# OUTPUT:    Error messages are logged when any verification test
> -#            fails.
> -#
> -#-----------------------------------------------------------------------
>  do_test()
>  {
> -   $trace_logic
> -   echo "Getting ALL enabled interfaces which are configured !"
> -
> -   IFNAME=${IFNAME:-$(netstat -i -n | grep "^[b-z]\{2,4\}[0-9][^*]"|\
> -      awk '{print $1}')}
> -   INTERFACE=${INTERFACE:-$(mc_gethost `hostname` | grep addresses: | awk '{print $2}')}
> -
> -   echo "Testing ifconfig and netstat"
> -
> -# Commented begin
> -#   # See if interface can be used for IP Multicast
> -#   ifconfig $IFNAME | grep -q MULTICAST
> -#   if [ $? != 0 ]; then
> -#	end_testcase "Multicast not listed for $IFNAME"
> -#   fi
> -#   netstat -gn | grep $IFNAME | grep -q 224.0.0.1
> -#   [ $? = 0 ] || end_testcase "all-host-group for $IFNAME not joined"
> -# Commented end
> -
> -#Finds the active ethernet interface
> -for eth in $IFNAME
> -    do
> -         ifconfig $eth | grep -q $INTERFACE
> -          if [ $? -eq 0 ]
> -          then
> -                INTERFACE_DEVICE=$eth
> -		break
> -           fi
> -    done
> -
> -# Added for support for more adapters configured
> -    MulticastAdap=
> -    for eth in $IFNAME
> -    do
> -
> -	$trace_logic
> -	ifconfig $eth | grep -q MULTICAST
> -	if [ $? -eq 0 ]
> -	then
> -	    $trace_logic
> -	    MulticastAdap=$eth
> -	    break
> +	echo "Getting ALL enabled interfaces which are configured !"

This should be tst_resm TINFO but that is rather cosmetic.

> +
> +	IFNAME=${IFNAME:-$(netstat -i -n | sed '1,2 d' | awk '{print $1}')}
> +	INTERFACE=${INTERFACE:-$(mc_gethost `hostname` | grep addresses: | \
> +				 awk '{print $2}')}
> +
> +	echo "Testing ifconfig and netstat"

Here as well.

> +	# Finds the active ethernet interface
> +	for eth in $IFNAME
> +	do
> +		ifconfig $eth | grep -q $INTERFACE
> +		if [ $? -eq 0 ]; then
> +			INTERFACE_DEVICE=$eth
> +			break
> +		fi
> +	done
> +
> +	MulticastAdap=
> +	for eth in $IFNAME
> +	do
> +
> +		ifconfig $eth | grep -q MULTICAST
> +		if [ $? -eq 0 ]; then
> +			MulticastAdap=$eth
> +			break
> +		fi
> +	done
> +	if [ -z $MulticastAdap ]; then
> +		tst_brkm TFAIL "Multicast not listed for $IFNAME"
>  	fi
> -    done
> -    if [ -z $MulticastAdap ]
> -    then
> -	end_testcase "Multicast not listed for $IFNAME"
> -    fi
> -    MulticastAdapJoined=
> -    for eth in $IFNAME
> -    do
> -	$trace_logic
> -	netstat -gn | grep $eth | grep -q 224.0.0.1
> -	if [ $? -eq 0 ]
> -	then
> -	    $trace_logic
> -	    MulticastAdapJoined=1
> -	    break
> +	MulticastAdapJoined=
> +	for eth in $IFNAME
> +	do
> +		netstat -gn | grep $eth | grep -q 224.0.0.1
> +		if [ $? -eq 0 ]; then
> +			MulticastAdapJoined=1
> +			break
> +		fi
> +	done
> +	if [ -z $MulticastAdapJoined ]; then
> +		tst_brkm TFAIL "all-host-group for $IFNAME not joined"
>  	fi
> -    done
> -    if [ -z $MulticastAdapJoined ]
> -    then
> -	end_testcase "all-host-group for $IFNAME not joined"
> -    fi
> -# Added end
> -
> -   cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts | grep 1 > /dev/null
> -   if [ $? -eq 0 ]
> -   then
> -       tst_resm TCONF "Multicast ping disabled on this system (this is normal on post year:2005 kernels)"
> -       rm -rf $TCtmp
> -       exit 0
> -   fi
> -
> -   # Do the ping tests: Execute ping 224.0.0.1 - Verify that the proper
> -   # number of responses are returned.
> -
> -   echo "Ping all-host-groups address(over default route!)"
> -   ping -c2 224.0.0.1 > $PING_OUT
> -   [ $? = 0 ] || end_testcase "No response from MC hosts to ping 224.0.0.1"
> -
> -   echo "Ping all-host-groups over specified interface"
> -   ping -c2 -I $INTERFACE 224.0.0.1 > $PING_OUT
> -  if [ $? -ne 0 ]
> -   then
> -        echo "Trying to ping with $INTERFACE_DEVICE instead of IP address"
> -        echo "with the -I option"
> -        ping -c2 -I $INTERFACE_DEVICE 224.0.0.1 > $PING_OUT
> -   [ $? = 0 ] || end_testcase "No response from MC hosts to ping -c2 -I$INTERFACE 224.0.0.1"
> -fi
> -   grep -q $INTERFACE $PING_OUT
> -   [ $? = 0 ] || end_testcase "Local host did not respond to ping -c2 -I$INTERFACE 224.0.0.1"
>  
> +	# Do the ping tests: Execute ping 224.0.0.1 - Verify that the proper
> +	# number of responses are returned.
> +	echo "Ping all-host-groups address(over default route!)"
> +	ping -c2 224.0.0.1 > $PING_OUT
> +	if [ $? -ne 0 ]; then
> +		tst_brkm TFAIL "No response from MC hosts to ping 224.0.0.1"
> +	fi
>  
> +	echo "Ping all-host-groups over specified interface"
> +	ping -c2 -I $INTERFACE 224.0.0.1 > $PING_OUT
> +	if [ $? -ne 0 ]; then
> +		echo "Trying to ping with $INTERFACE_DEVICE"
> +		echo "with the -I option instead of IP address"
> +		ping -c2 -I $INTERFACE_DEVICE 224.0.0.1 > $PING_OUT
> +		if [ $? -ne 0 ]; then
> +			tst_brkm TFAIL "No response from MC hosts to ping -c2 "\
> +				       "-I$INTERFACE 224.0.0.1"
> +		fi
> +	fi
> +	grep -q $INTERFACE $PING_OUT
> +	if [ $? -ne 0 ]; then
> +		tst_brkm TFAIL "Local host did not respond to ping -c2 "\
> +			       "-I$INTERFACE 224.0.0.1"
> +	fi
>  }
>  
> -#-----------------------------------------------------------------------
> -#
> -# FUNCTION:     do_cleanup
> -# PURPOSE:      Called when the testcase is interrupted by the user
> -#               or by interrupt_testcase() when time limit expired
> -# INPUT:        None.
> -# OUTPUT:       None.
> -#
> -#-----------------------------------------------------------------------
> -
>  do_cleanup()
>  {
> -   $trace_logic
> -   echo "$this_file: doing $0."
> -   rm -rf $TCtmp
> +	rm -rf $TCtmp

And we should do tst_rmdir() here instead.

>  }
>  
> -#=============================================================================
> -# FUNCTION NAME:        end_testcase
> -#
> -# FUNCTION DESCRIPTION: Clean up
> -#
> -# PARAMETERS:           string, IF AND ONLY IF the testcase fails
> -#
> -# RETURNS:              None.
> -#=============================================================================
> -
> -end_testcase()
> -{
> -   $trace_logic
> -   echo "$this_file: doing $0."
> -
> -   # Call other cleanup functions
> -   [ $CLEANUP = "ON" ] && do_cleanup
> -
> -   [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
> -   tst_resm TFAIL "Test Failed: $@"
> -   exit 1
> -}
> -
> -#*******************************************************************************
> -#
> -# FUNCTION:  MAIN
> -# PURPOSE:   To invoke functions that perform the tasks as described in
> -#            the design in the prolog above.
> -# INPUT:     See SETUP in the prolog above.
> -# OUTPUT:    Logged run results written to testcase run log
> -#
> -#*******************************************************************************
>  setup
> +TST_CLEANUP=do_cleanup
> +
>  do_test
> -end_testcase
> +if [ $? -ne 0 ]; then
> +	tst_resm TFAIL "Test Failed"

Given that the do_test() now calls tst_brkm when something goes wrong I
doubt that you can get to this tst_resm at all.

What should be sufficient is to add the tst_resm TPASS "Test
successfull" and tst_exit to the end of the do_test function and all
that needs to be done here then is to call the do_test function.

> +else
> +	tst_resm TPASS "Test Successful"
> +fi
> +
> +tst_exit
> -- 
> 1.9.3
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Slashdot TV.  
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [LTP] [PATCH 2/4] multicast/mc_commo: Some cleanup
  2014-08-31 10:30 ` [LTP] [PATCH 2/4] multicast/mc_commo: " Zeng Linggang
@ 2014-09-30 11:46   ` chrubis
  0 siblings, 0 replies; 14+ messages in thread
From: chrubis @ 2014-09-30 11:46 UTC (permalink / raw)
  To: Zeng Linggang; +Cc: ltp-list

Hi!
> Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>

The same applies to this patch as well.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [LTP] [PATCH 3/4] multicast/mc_member: Some cleanup
  2014-08-31 10:30 ` [LTP] [PATCH 3/4] multicast/mc_member: " Zeng Linggang
@ 2014-09-30 11:54   ` chrubis
  0 siblings, 0 replies; 14+ messages in thread
From: chrubis @ 2014-09-30 11:54 UTC (permalink / raw)
  To: Zeng Linggang; +Cc: ltp-list

Hi!
> * Delete trace_logic that is used to debug.
> * Use test.sh script and use tst_* instead of end_testcase.
> * Delete some unuseful comments.
> 
> * Fix old-style function definition.

And the same applies to this patch as well.

> +		count=`grep 105 $ERRFILE | wc -l`
> +		if [ $count -gt 3 ]; then
> +			tst_brkm FAIL "Could not join members!"
> +		fi
> +
> +		COUNT=$(( $COUNT + 1 ))
> +
> +	done   # end of while numloop
                ^
		Please remove these dumbious comments too.


-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [LTP] [PATCH 4/4] multicast/mc_opts: Some cleanup
  2014-08-31 10:31 ` [LTP] [PATCH 4/4] multicast/mc_opts: " Zeng Linggang
@ 2014-09-30 12:16   ` chrubis
  0 siblings, 0 replies; 14+ messages in thread
From: chrubis @ 2014-09-30 12:16 UTC (permalink / raw)
  To: Zeng Linggang; +Cc: ltp-list

Hi!
> * Delete trace_logic that is used to debug.
> * Use test.sh script and use tst_* instead of end_testcase.
> * Delete some unuseful comments.

And the same (minus the tst_tmpdir because the test does not need a
temporary directory) applies here as well.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [LTP] [PATCH 1/4] multicast/mc_cmds: Some cleanup
  2014-09-25  9:53 ` [LTP] [PATCH 1/4] multicast/mc_cmds: " Zeng Linggang
@ 2014-09-30 12:20   ` chrubis
       [not found]     ` <1412659019.2433.14.camel@G08JYZSD130126.localdomain>
                       ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: chrubis @ 2014-09-30 12:20 UTC (permalink / raw)
  To: Zeng Linggang; +Cc: ltp-list

Hi!
> Ping. :)

Pong, sorry for the long delay.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [LTP] [PATCH v2 1/4] multicast/mc_cmds: Some cleanup
       [not found]     ` <1412659019.2433.14.camel@G08JYZSD130126.localdomain>
@ 2014-10-16 11:57       ` Cyril Hrubis
  0 siblings, 0 replies; 14+ messages in thread
From: Cyril Hrubis @ 2014-10-16 11:57 UTC (permalink / raw)
  To: Zeng Linggang; +Cc: ltp-list

Hi!
> -   IFNAME=${IFNAME:-$(netstat -i -n | grep "^[b-z]\{2,4\}[0-9][^*]"|\
> -      awk '{print $1}')}
> +	IFNAME=${IFNAME:-$(netstat -i -n | sed '1,2 d' | awk '{print $1}')}


This line has been changed from grep to sed. Not that it's wrong but the
reason to do so should be noted in the commit log message.

Otherwise it looks fine.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [LTP] [PATCH v2 2/4] multicast/mc_commo: Some cleanup
       [not found]     ` <1412659112.2433.16.camel@G08JYZSD130126.localdomain>
@ 2014-10-16 12:01       ` Cyril Hrubis
  0 siblings, 0 replies; 14+ messages in thread
From: Cyril Hrubis @ 2014-10-16 12:01 UTC (permalink / raw)
  To: Zeng Linggang; +Cc: ltp-list

Hi!
> -   kill -9 $SERVER_PID
> +#	kill -9 $SERVER_PID

Why is the line commented out now?

> +	wait $SERVER_PID

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [LTP] [PATCH v2 3/4] multicast/mc_member: Some cleanup
       [not found]     ` <1412659186.2433.18.camel@G08JYZSD130126.localdomain>
@ 2014-10-16 12:18       ` Cyril Hrubis
  0 siblings, 0 replies; 14+ messages in thread
From: Cyril Hrubis @ 2014-10-16 12:18 UTC (permalink / raw)
  To: Zeng Linggang; +Cc: ltp-list

Hi!
> -EXECUTABLES=${EXECUTABLES:-"member"}
> -NUMLOOPS=${NUMLOOPS:-2}
> -INTERFACE=${INTERFACE:-$(mc_gethost `hostname`| grep address |awk '{ print $2 }')}
> +INTERFACE=${INTERFACE:-$(mc_gethost `hostname`|grep address|awk '{ print $2 }')}
>  GLIST=${GLIST:-$TCsrc/ManyGroups}
>  TooManyGLIST=${TooManyGLIST:-$TCsrc/TooManyGroups}

These two files should be ideally treated as datafiles.

> +	tst_resm TINFO "doing test."
> +
> +	COUNT=1
> +	while [ $COUNT -le 2 ]
> +	do
> +		# Run setsockopt test with bogus network
> +		get_address
> +		tst_resm TINFO "Running mc_member_e on $ADDRESS"
> +		member -j -g $GLIST -s 30 -i $ADDRESS >/dev/null 2>&1

And the member binary should have reasonably unique name (because all
binaries are installed into single directory). I woudl rename it to
something as mc_member_helper or similar.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [LTP] [PATCH v2 4/4] multicast/mc_opts: Some cleanup
       [not found]     ` <1412659252.2433.19.camel@G08JYZSD130126.localdomain>
@ 2014-10-16 12:23       ` Cyril Hrubis
  0 siblings, 0 replies; 14+ messages in thread
From: Cyril Hrubis @ 2014-10-16 12:23 UTC (permalink / raw)
  To: Zeng Linggang; +Cc: ltp-list

Hi!
> * Delete trace_logic that is used to debug.
> * Use test.sh script and use tst_* instead of end_testcase.
> * Delete some unuseful comments.
> 
> Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
> ---
>  testcases/network/multicast/mc_opts/mc_opts  | 164 ++++++---------------------
>  testcases/network/multicast/mc_opts/opts.c   |   7 +-
>  testcases/network/multicast/mc_opts/opts_e.c |   6 +-
>  3 files changed, 37 insertions(+), 140 deletions(-)
> 
> diff --git a/testcases/network/multicast/mc_opts/mc_opts b/testcases/network/multicast/mc_opts/mc_opts
> index f40112c..7e99733 100755
> --- a/testcases/network/multicast/mc_opts/mc_opts
> +++ b/testcases/network/multicast/mc_opts/mc_opts
> @@ -35,142 +35,46 @@ unset LIBPATH
>  #      -Ported
>  #
>  #******************************************************************************
> -#Uncomment the line below for debug output.
> -#trace_logic=${trace_logic:-"set -x"}
> -$trace_logic
>  
> -if [ -z $LTPBIN ]; then
> -  PATH=../../../bin/:./:$PATH
> -fi
>  TC=mc_opts
> -TCtmp=${TCtmp:-$LTPROOT/bin/$TC$$}
> -CLEANUP=${CLEANUP:-ON}
>  EXECUTABLES=${EXECUTABLES:-"opts opts_e"}

The same applies here, it should for example be: mc_opts_helper and
mc_opts_e_helper.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-10-16 12:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-31 10:29 [LTP] [PATCH 1/4] multicast/mc_cmds: Some cleanup Zeng Linggang
2014-08-31 10:30 ` [LTP] [PATCH 2/4] multicast/mc_commo: " Zeng Linggang
2014-09-30 11:46   ` chrubis
2014-08-31 10:30 ` [LTP] [PATCH 3/4] multicast/mc_member: " Zeng Linggang
2014-09-30 11:54   ` chrubis
2014-08-31 10:31 ` [LTP] [PATCH 4/4] multicast/mc_opts: " Zeng Linggang
2014-09-30 12:16   ` chrubis
2014-09-25  9:53 ` [LTP] [PATCH 1/4] multicast/mc_cmds: " Zeng Linggang
2014-09-30 12:20   ` chrubis
     [not found]     ` <1412659019.2433.14.camel@G08JYZSD130126.localdomain>
2014-10-16 11:57       ` [LTP] [PATCH v2 " Cyril Hrubis
     [not found]     ` <1412659112.2433.16.camel@G08JYZSD130126.localdomain>
2014-10-16 12:01       ` [LTP] [PATCH v2 2/4] multicast/mc_commo: " Cyril Hrubis
     [not found]     ` <1412659186.2433.18.camel@G08JYZSD130126.localdomain>
2014-10-16 12:18       ` [LTP] [PATCH v2 3/4] multicast/mc_member: " Cyril Hrubis
     [not found]     ` <1412659252.2433.19.camel@G08JYZSD130126.localdomain>
2014-10-16 12:23       ` [LTP] [PATCH v2 4/4] multicast/mc_opts: " Cyril Hrubis
2014-09-30  9:42 ` [LTP] [PATCH 1/4] multicast/mc_cmds: " chrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.