From 361b31a268be165a19b889261c1e130b14291993 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Thu, 22 Mar 2012 15:57:26 +0000 Subject: [PATCH] Rudimentary test for socket count --- org.glite.testsuites.ctb/LB/tests/lb-common.sh | 1 + .../LB/tests/lb-test-il-recovery.sh | 33 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/org.glite.testsuites.ctb/LB/tests/lb-common.sh b/org.glite.testsuites.ctb/LB/tests/lb-common.sh index 7a4d7a1..4e40ba8 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-common.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-common.sh @@ -127,6 +127,7 @@ SYS_WC=wc SYS_LS=ls SYS_STAT=stat SYS_DPKG_QUERY=dpkg-query +SYS_FIND=find # not used at the moment DEBUG=2 diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-il-recovery.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-il-recovery.sh index a2bdade..1527edf 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-il-recovery.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-test-il-recovery.sh @@ -51,6 +51,10 @@ EndHelpHeader echo " -t | --text Format output as plain ASCII text." echo " -c | --color Format output as text with ANSI colours (autodetected by default)." echo " -x | --html Format output as html." + echo " --stop Command to stop the interlogger." + echo " --start Command to start the interlogger." + echo " -f | --file-prefix IL file prefix." + echo " -u | --user-name Name of user account used to run the IL. (default GLITE_USER or 'glite')" } function generate_done_events() @@ -86,6 +90,11 @@ source ${COMMON} logfile=$$.tmp flag=0 +if [ -z "$GLITE_USER" ]; then + USER="glite" +else + USER="$GLITE_USER" +fi while test -n "$1" do case "$1" in @@ -97,6 +106,7 @@ do "--stop") shift ; STOPCOMMAND="$1" ;; "--start") shift ; STARTCOMMAND="$1" ;; "-f" | "--file-prefix") shift ; EVENTFILE=$1 ;; + "-u" | "--user-name") shift ; USER=$1 ;; esac shift done @@ -119,7 +129,7 @@ test_start # check_binaries printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $SYS_DOMAINNAME $LBJOBSTATUS +check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $SYS_DOMAINNAME $LBJOBSTATUS $SYS_FIND $SYS_WC $SYS_EXPR if [ $? -gt 0 ]; then test_failed else @@ -145,6 +155,11 @@ fi printf "($jobid)" test_done + printf "Getting No. of sockets (user $USER) for a later test... " + SOCKS_PRE=`$SYS_FIND /tmp -maxdepth 1 -type s -user $USER | wc -l` + printf "$SOCKS_PRE" + test_done + #Stopping interlogger (if required) if [ -z $STOPCOMMAND ]; then $SYS_ECHO Info: No command to stop was given @@ -195,6 +210,22 @@ fi print_error "Job is not in appropriate state" fi + + printf "Getting No. of sockets (regression into Savannah Bug #92708)... " + SOCKS_POST=`find /tmp -maxdepth 1 -type s -user $USER | wc -l` + printf "$SOCKS_POST" + test_done + + printf "Comparing No. of sockets... " + $SYS_EXPR $SOCKS_POST \> $SOCKS_PRE > /dev/null + if [ $? -gt 0 ]; then + printf "OK, less or equal" + test_done + else + test_failed + print_error "There are more sockets after IL handled messages" + fi + #Purge test job joblist=$$_jobs_to_purge.txt echo $jobid > ${joblist} -- 1.8.2.3