From cd53af72184724fb4e9b8a2453821c0c96c3f481 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Thu, 25 Nov 2010 13:30:28 +0000 Subject: [PATCH] Finalize ping local test. --- .../gridsite/tests/gridsite-common.sh | 16 ++++++++++++---- org.glite.testsuites.ctb/gridsite/tests/ping-local.sh | 8 +++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/org.glite.testsuites.ctb/gridsite/tests/gridsite-common.sh b/org.glite.testsuites.ctb/gridsite/tests/gridsite-common.sh index 0cdc0d3..003ef64 100755 --- a/org.glite.testsuites.ctb/gridsite/tests/gridsite-common.sh +++ b/org.glite.testsuites.ctb/gridsite/tests/gridsite-common.sh @@ -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]*"` diff --git a/org.glite.testsuites.ctb/gridsite/tests/ping-local.sh b/org.glite.testsuites.ctb/gridsite/tests/ping-local.sh index 62c53c8..6fa1aba 100755 --- a/org.glite.testsuites.ctb/gridsite/tests/ping-local.sh +++ b/org.glite.testsuites.ctb/gridsite/tests/ping-local.sh @@ -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" -- 1.8.2.3