New features
authorZdeněk Šustr <sustr4@cesnet.cz>
Thu, 4 Sep 2008 14:14:28 +0000 (14:14 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Thu, 4 Sep 2008 14:14:28 +0000 (14:14 +0000)
org.glite.testsuites.ctb/LB/lb-common.sh
org.glite.testsuites.ctb/LB/lb-test-server-local.sh

index 7344b29..bfc69ad 100755 (executable)
@@ -39,6 +39,7 @@ LB_SERVER=glite-lb-bkserverd
 
 # default LB ports
 GLITE_LB_SERVER_PORT=${GLITE_LB_SERVER_PORT:-9000}
+GLITE_LB_IL_SOCK=${GLITE_LB_IL_SOCK:-/tmp/interlogger.sock}
 let GLITE_LB_SERVER_QPORT=${GLITE_LB_SERVER_PORT}+1
 if [ -z "${GLITE_LB_SERVER_WPORT}" ]; then 
        let GLITE_LB_SERVER_WPORT=${GLITE_LB_SERVER_PORT}+3
@@ -121,6 +122,9 @@ function check_socket()
 }
 
 # Check listener
+# Arguments:
+#  $1: program expected to listen on the given port
+#  $2: TCP port to check
 function check_listener()
 {
        req_program=$1
@@ -130,7 +134,33 @@ function check_listener()
                 return $TEST_ERROR
         fi
 
-       pid=`lsof -F p +c 0 -i TCP:$req_port | sed "s/^p//"`
+       pid=`lsof -F p -i TCP:$req_port | sed "s/^p//"`
+       if [ -z $pid ]; then
+               return $TEST_ERROR
+       fi
+       program=`ps -p ${pid} -o args= | grep -E "[\/]*$req_program[ \t]*"`
+       if [ -z "$program" ];  then 
+               return $TEST_ERROR
+       else
+               return $TEST_OK
+       fi
+}
+
+
+# Check socket listener
+# Arguments:
+#  $1: program expected to listen on the given socket
+#  $2: socket to check
+function check_socket_listener()
+{
+       req_program=$1
+       req_socket=$2
+        if [ -z $1 ]; then
+                set_error "No program name entered"
+                return $TEST_ERROR
+        fi
+
+       pid=`lsof -F p $req_socket | sed "s/^p//"`
        if [ -z $pid ]; then
                return $TEST_ERROR
        fi
index 7fb4226..75603af 100755 (executable)
@@ -143,7 +143,10 @@ fi
 
 # glite-lb-interlogd running:
 printf "Testing if Interlogger is running"
-if [ "$(pidof glite-lb-interlogd)" ]; then
+
+# glite-lb-interlogd running:
+printf "Testing if Interlogger is running"
+if [ "$(pidof ${LB_INTERLOGD})" ]; then
        test_done
 else
        test_failed
@@ -151,6 +154,17 @@ else
 fi
 
 
+# Interlogger listening on socket:
+printf "Testing if interlogger is listening on socket ${GLITE_LB_IL_SOCK}" 
+check_socket_listener ${LB_INTERLOGD} ${GLITE_LB_IL_SOCK}
+if [ $? -gt 0 ]; then
+        test_failed
+        print_error "LB interlogger is not listening on socket ${GLITE_LB_IL_SOCK}"
+else
+        test_done
+fi
+
+
 
 test_end
 } &> $logfile