Finalize ping local test.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 25 Nov 2010 13:30:28 +0000 (13:30 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 25 Nov 2010 13:30:28 +0000 (13:30 +0000)
org.glite.testsuites.ctb/gridsite/tests/gridsite-common.sh
org.glite.testsuites.ctb/gridsite/tests/ping-local.sh

index 0cdc0d3..003ef64 100755 (executable)
@@ -47,8 +47,16 @@ SYS_GREP=grep
 SYS_SED=sed
 SYS_PS=ps
 SYS_PIDOF=pidof
-SYS_APACHE=apache2
-SYS_APACHECTL=apache2ctl
+if test -f /usr/sbin/apache2; then
+       SYS_APACHE=apache2
+else
+       SYS_APACHE=httpd
+fi
+if test -f /usr/sbin/apache2ctl; then
+       SYS_APACHECTL=apache2ctl
+else
+       SYS_APACHECTL=apachectl
+fi
 SYS_PING=ping
 SYS_AWK=awk
 SYS_ECHO=echo
@@ -147,8 +155,8 @@ function check_listener()
                 return $TEST_ERROR
         fi
 
-       pid=`lsof -F p -i TCP:$req_port | sed "s/^p//"`
-       if [ -z $pid ]; then
+       pid=`lsof -F p -i TCP:$req_port | sed "s/^p//" | head -n 1`
+       if [ -z "$pid" ]; then
                return $TEST_ERROR
        fi
        program=`ps -p ${pid} -o args= | grep -E "[\/]*$req_program[ \t]*"`
index 62c53c8..6fa1aba 100755 (executable)
@@ -29,6 +29,7 @@ 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 " -f | --config          Apache config file."
 }
 
 # read common definitions and functions
@@ -49,6 +50,7 @@ do
                "-t" | "--text")  setOutputASCII ;;
                "-c" | "--color") setOutputColor ;;
                "-x" | "--html")  setOutputHTML ;;
+               "-f" | "--config") shift; apache_config_arg="-f $1" ;;
        esac
        shift
 done
@@ -71,7 +73,7 @@ test_start
 
 # check_binaries
 printf "Testing if all binaries are available"
-check_binaries $SYS_LSOF $SYS_GREP $SYS_SED $SYS_PS $SYS_PIDOF
+check_binaries $SYS_LSOF $SYS_GREP $SYS_SED $SYS_PS $SYS_PIDOF $SYS_APACHECTL
 if [ $? -gt 0 ]; then
        test_failed
 else
@@ -89,9 +91,9 @@ fi
 
 # GridSite module loaded:
 printf "Testing if GridSite is loaded"
-${SYS_APACHECTL} -t -D DUMP_MODULES 2>&1| grep mod_gridsite >/dev/null 2>&1
+${SYS_APACHECTL} ${apache_config_arg} -t -D DUMP_MODULES 2>&1| grep gridsite_module >/dev/null 2>&1
 if [ $? -eq 0 ]; then
-       test done
+       test_done
 else
        test_failed
        print_error "GridSite is not loaded in Apache"