From: Garrett C. <yab...@us...> - 2009-08-03 11:37:11
|
Update of /cvsroot/ltp/ltp/testcases/network/tcp_cmds/echo In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32037/testcases/network/tcp_cmds/echo Modified Files: Tag: makefile_infra_rework echo01 Log Message: 1. Check in Bourne shell lib related RFC work changes. Prepare for integration test with scripts. 2. Fix a few Makefiles here and there. Index: echo01 =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/network/tcp_cmds/echo/echo01,v retrieving revision 1.9 retrieving revision 1.9.4.1 diff -C2 -d -r1.9 -r1.9.4.1 *** echo01 7 Apr 2003 18:54:17 -0000 1.9 --- echo01 3 Aug 2009 11:36:56 -0000 1.9.4.1 *************** *** 33,148 **** # #*********************************************************************** - #Uncomment line below for debug output. - #trace_logic=${trace_logic:-"set -x"} - $trace_logic - - TC=sine - RHOST=${RHOST:-`hostname`} - TCbin=${TCbin:-`pwd`} - TCsrc=${TCsrc:-$TCbin} - TCtmp=${TCtmp:-$TCsrc/echo$$} - CLEANUP=${CLEANUP:-ON} - CREATFILE=createfile - ECHOES=echoes - - EXECUTABLES=${EXECUTABLES:-"$CREATFILE $ECHOES"} - ECHOFILE=${ECHOFILE:-echofile} - ECHOSIZE=${ECHOSIZE:-8192} - NUMLOOPS=${NUMLOOPS:-2} - NUMPROCESSES=${NUMPROCESSES:-10} #----------------------------------------------------------------------- # ! # FUNCTION: do_test ! # PURPOSE: Loop until interrupted creating the echo file and then ! # echoing it to RHOST. ! # INPUT: None. ! # OUTPUT: Informational messages are logged into the run log. # #----------------------------------------------------------------------- ! do_test() { - $trace_logic - mkdir $TCtmp - echo "Creating echo file $ECHOFILE" - $TCbin/$CREATFILE $ECHOSIZE $TCtmp/$ECHOFILE - [ $? = 0 ] || end_testcase "$ECHOFILE not created" ! echo "Compute the checksum of this file" ! csum1=`sum $TCtmp/$ECHOFILE |awk '{print $1}'` ! [ $csum1 ] || end_testcase "initial checksum computation failed" ! COUNT=1 ! while [ $COUNT -le $NUMLOOPS ] ! do ! $TCbin/$ECHOES $RHOST $TCtmp/$ECHOFILE $NUMPROCESSES ! [ $? = 0 ] || end_testcase "Error in $ECHOES test in loop $COUNT" ! NUM=0 ! while [ $NUM -lt $NUMPROCESSES ] ! do ! csum2=`sum $TCtmp/$ECHOFILE\$NUM |awk '{print $1}'` ! [ "$csum1" -eq "$csum2" ] || end_testcase "Checksums differ in loop $COUNT" ! NUM=`expr $NUM + 1` ! done - echo "Successful execution for loop $COUNT" - COUNT=`expr $COUNT + 1` - if [ $COUNT -le $NUMLOOPS ]; then - echo "Sleeping 60 seconds to avoid hitting max. connections setting for service" - sleep 60 - 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 ! cd / ! if [ $TCtmp = $TCsrc ]; then ! rm -f $TCtmp/echofile* ! else ! 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 ! ! # Call other cleanup functions ! [ $CLEANUP = "ON" ] && do_cleanup ! [ $# -eq 0 ] && { echo "Test Successful"; exit 0; } ! echo "Test Failed: $@" ! echo"" ! echo "***NOTE***" ! echo "Make sure the streamed echo is uncommented in inetd.conf" ! echo "on the server. Also try increasing max connections from" ! echo "default of 40, i.e. nowait.400" ! exit 1 ! } #----------------------------------------------------------------------- --- 33,117 ---- # #*********************************************************************** #----------------------------------------------------------------------- # ! # FUNCTION: do_setup # #----------------------------------------------------------------------- ! do_setup() { ! NUMLOOPS=${NUMLOOPS:-2} ! TST_TOTAL=$NUMLOOPS ! export TST_COUNT TST_TOTAL ! exists hostname sum ! tst_setup ! ! TC=sine ! RHOST=${RHOST:-`hostname`} ! TCbin=${TCbin:-`pwd`} ! TCsrc=${TCsrc:-$TCbin} ! TCtmp=${TCtmp:-$TCsrc/echo$$} ! CLEANUP=${CLEANUP:-ON} ! CREATFILE=createfile ! ECHOES=echoes ! ! EXECUTABLES=${EXECUTABLES:-"$CREATFILE $ECHOES"} ! ECHOFILE=${ECHOFILE:-echofile} ! ECHOSIZE=${ECHOSIZE:-8192} ! NUMPROCESSES=${NUMPROCESSES:-10} } #----------------------------------------------------------------------- # ! # FUNCTION: do_test ! # PURPOSE: Loop until interrupted creating the echo file and then ! # echoing it to RHOST. ! # INPUT: None. ! # OUTPUT: Informational messages are logged into the run log. # #----------------------------------------------------------------------- ! do_test() { ! mkdir $TCtmp ! echo "Creating echo file $ECHOFILE" ! if ! "$TCbin/$CREATFILE" $ECHOSIZE "$TCtmp/$ECHOFILE"; then ! end_testcase "$ECHOFILE not created" ! fi ! echo "Compute the checksum of this file" ! csum1=$(sum $TCtmp/$ECHOFILE | awk '{print $1}') ! [ $csum1 ] || end_testcase "initial checksum computation failed" ! while [ $TST_COUNT -le $NUMLOOPS ]; do ! if ! "$TCbin/$ECHOES" $RHOST "$TCtmp/$ECHOFILE" $NUMPROCESSES; then ! end_testcase "Error in $ECHOES test in loop $TST_COUNT" ! fi ! NUM=0 ! while [ $NUM -lt $NUMPROCESSES ] ! do ! csum2=$(sum "$TCtmp/${ECHOFILE}${NUM}" | awk '{print $1}') ! if [ "$csum1" = "$csum2" ]; then ! end_testcase "Checksums differ in loop $TST_COUNT" ! fi ! NUM=$(( $NUM + 1 )) ! done ! ! tst_resm TINFO "Execution $TST_COUNT passed." ! ! incr_tst_count ! if [ $TST_COUNT -le $NUMLOOPS ]; then ! tst_resm TINFO "Sleeping 60 seconds to avoid hitting max. connections setting for service" ! sleep 60 ! fi ! done ! } #----------------------------------------------------------------------- *************** *** 155,158 **** --- 124,131 ---- # #----------------------------------------------------------------------- + + . cmdlib.sh + + do_setup do_test end_testcase |