From: Zdeněk Šustr Date: Fri, 12 Sep 2008 09:47:33 +0000 (+0000) Subject: Test-specific binary checking X-Git-Tag: myproxy-config-R_2_0_2_1~26 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=eed4ac947733730b69bd09769a791756368a6b65;p=jra1mw.git Test-specific binary checking --- diff --git a/org.glite.testsuites.ctb/LB/lb-common.sh b/org.glite.testsuites.ctb/LB/lb-common.sh index 4be088c..2a0f3fd 100755 --- a/org.glite.testsuites.ctb/LB/lb-common.sh +++ b/org.glite.testsuites.ctb/LB/lb-common.sh @@ -37,7 +37,11 @@ LB_LOGD=glite-lb-logd LB_INTERLOGD=glite-lb-interlogd LB_SERVER=glite-lb-bkserverd -#grid binaries +LB_READY_SH=glite-lb-ready.sh +LB_RUNNING_SH=glite-lb-running.sh +LB_DONE_SH=glite-lb-done.sh + +#general grid binaries GRIDPROXYINFO=grid-proxy-info # default LB ports @@ -60,6 +64,7 @@ SYS_PIDOF=pidof SYS_MYSQLD=mysqld SYS_MYSQLADMIN=mysqladmin SYS_PING=ping +SYS_AWK=awk # not used at the moment DEBUG=2 @@ -73,7 +78,7 @@ function ping_host() fi PING_HOST=$1 # XXX: there might be a better way to test the network reachability - result=`ping -c 3 $PING_HOST 2>/dev/null | grep " 0% packet loss"| wc -l` + result=`${SYS_PING} -c 3 $PING_HOST 2>/dev/null | ${SYS_GREP} " 0% packet loss"| wc -l` if [ $result -gt 0 ]; then return $TEST_OK else @@ -102,7 +107,7 @@ function check_binaries() { # TODO: test only the binaries that are needed - it can differ in each test local ret=$TEST_OK - for file in $LBLOGEVENT $LBJOBLOG $LBJOBREG $LBUSERJOBS $LBJOBSTATUS $LBCHANGEACL $TEST_SOCKET $SYS_LSOF $SYS_GREP $SYS_SED $SYS_PS + for file in $@ do check_exec $file if [ $? -gt 0 ]; then @@ -180,3 +185,9 @@ function check_socket_listener() } #df /var/lib/mysql/ | tail -n 1 | awk '{ print $4 }' + +function test_args() +{ + echo $@ +} + diff --git a/org.glite.testsuites.ctb/LB/lb-test-job-registration.sh b/org.glite.testsuites.ctb/LB/lb-test-job-registration.sh index 074fb8b..6da1981 100755 --- a/org.glite.testsuites.ctb/LB/lb-test-job-registration.sh +++ b/org.glite.testsuites.ctb/LB/lb-test-job-registration.sh @@ -73,7 +73,7 @@ test_start # check_binaries printf "Testing if all binaries are available" -check_binaries +check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK if [ $? -gt 0 ]; then test_failed else @@ -82,35 +82,39 @@ fi printf "Testing credentials" -proxysubject=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^subject" | ${SYS_SED} "s/subject\s*:\s//"` -if [ "$proxysubject" = "" ]; then - test_failed - print_error "No credentials" -else - test_done - - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${EDG_WL_QUERY_SERVER} -s application | grep "new jobid" | awk '{ print $3 }'` +timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - test_done - fi - - jobstate=`${LBJOBSTATUS} ${jobid} | grep "state :" | awk '{print $3}'` - printf "Is the testing job ($jobid) in a correct state? $jobstate" - - if [ "${jobstate}" = "Submitted" ]; then - test_done - else - test_failed - print_error "Job has not been submitted" +if [ "$timeleft" = "" ]; then + test_failed + print_error "No credentials" +else + if [ "$timeleft" = "0:00:00" ]; then + test_failed + print_error "Credentials expired" + else + test_done + + # Register job: + printf "Registering testing job " + jobid=`${LBJOBREG} -m ${EDG_WL_QUERY_SERVER} -s application | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` + + if [ -z $jobid ]; then + test_failed + print_error "Failed to register job" + else + test_done + fi + + jobstate=`${LBJOBSTATUS} ${jobid} | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` + printf "Is the testing job ($jobid) in a correct state? $jobstate" + + if [ "${jobstate}" = "Submitted" ]; then + test_done + else + test_failed + print_error "Job has not been submitted" + fi fi - fi test_end diff --git a/org.glite.testsuites.ctb/LB/lb-test-logger-local.sh b/org.glite.testsuites.ctb/LB/lb-test-logger-local.sh index 034742c..9a8f9dc 100755 --- a/org.glite.testsuites.ctb/LB/lb-test-logger-local.sh +++ b/org.glite.testsuites.ctb/LB/lb-test-logger-local.sh @@ -76,7 +76,7 @@ test_start # check_binaries printf "Testing if all binaries are available" -check_binaries +check_binaries $SYS_LSOF $SYS_GREP $SYS_SED $SYS_PS $SYS_MYSQLADMIN $SYS_PIDOF if [ $? -gt 0 ]; then test_failed else @@ -85,7 +85,7 @@ fi # logger running: printf "Testing if LB logger is running" -if [ "$(pidof ${LB_LOGD})" ]; then +if [ "$(${SYS_PIDOF} ${LB_LOGD})" ]; then test_done else test_failed @@ -104,7 +104,7 @@ fi # interlogger running: printf "Testing if Interlogger is running" -if [ "$(pidof ${LB_INTERLOGD})" ]; then +if [ "$(${SYS_PIDOF} ${LB_INTERLOGD})" ]; then test_done else test_failed diff --git a/org.glite.testsuites.ctb/LB/lb-test-logger-remote.sh b/org.glite.testsuites.ctb/LB/lb-test-logger-remote.sh index b4259e5..28ebd84 100755 --- a/org.glite.testsuites.ctb/LB/lb-test-logger-remote.sh +++ b/org.glite.testsuites.ctb/LB/lb-test-logger-remote.sh @@ -82,7 +82,7 @@ test_start # check_binaries printf "Testing if all binaries are available" -check_binaries +check_binaries $TEST_SOCKET $SYS_PING $SYS_GREP if [ $? -gt 0 ]; then test_failed print_error "Some binaries are missing" diff --git a/org.glite.testsuites.ctb/LB/lb-test-normal-event-delivery-remote.sh b/org.glite.testsuites.ctb/LB/lb-test-normal-event-delivery-remote.sh index b38ffd7..20085fb 100755 --- a/org.glite.testsuites.ctb/LB/lb-test-normal-event-delivery-remote.sh +++ b/org.glite.testsuites.ctb/LB/lb-test-normal-event-delivery-remote.sh @@ -77,7 +77,7 @@ test_start # check_binaries printf "Testing if all binaries are available" -check_binaries +check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $LB_READY_SH $LB_RUNNING_SH $LB_DONE_SH $SYS_AWK if [ $? -gt 0 ]; then test_failed else @@ -86,64 +86,69 @@ fi printf "Testing credentials" -proxysubject=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^subject" | ${SYS_SED} "s/subject\s*:\s//"` -if [ "$proxysubject" = "" ]; then +timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` + +if [ "$timeleft" = "" ]; then test_failed print_error "No credentials" else - test_done - - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${EDG_WL_QUERY_SERVER} -s application | grep "new jobid" | awk '{ print $3 }'` - - if [ -z $jobid ]; then + if [ "$timeleft" = "0:00:00" ]; then test_failed - print_error "Failed to register job" + print_error "Credentials expired" else test_done - printf "\nRegistered job: $jobid\n" - fi - # log events: - printf "Logging events resulting in READY state\n" - glite-lb-ready.sh -j ${jobid} > /dev/null 2> /dev/null - printf "Sleeping for 10 seconds (waiting for events to deliver)...\n" + # Register job: + printf "Registering testing job " + jobid=`${LBJOBREG} -m ${EDG_WL_QUERY_SERVER} -s application | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'` - sleep 10 + if [ -z $jobid ]; then + test_failed + print_error "Failed to register job" + else + test_done + printf "\nRegistered job: $jobid\n" + fi - jobstate=`${LBJOBSTATUS} ${jobid} | grep "state :" | awk '{print $3}'` - printf "Is the testing job ($jobid) in a correct state? $jobstate" + # log events: + printf "Logging events resulting in READY state\n" + $LB_READY_SH -j ${jobid} > /dev/null 2> /dev/null - if [ "${jobstate}" = "Ready" ]; then - test_done - else - test_failed - print_error "Job is not in appropriate state" - fi + printf "Sleeping for 10 seconds (waiting for events to deliver)...\n" - printf "Logging events resulting in RUNNING state\n" - glite-lb-running.sh -j ${jobid} > /dev/null 2> /dev/null + sleep 10 - printf "Logging events resulting in DONE state\n" - glite-lb-done.sh -j ${jobid} > /dev/null 2> /dev/null + jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` + printf "Is the testing job ($jobid) in a correct state? $jobstate" - printf "Sleeping for 10 seconds (waiting for events to deliver)...\n" + if [ "${jobstate}" = "Ready" ]; then + test_done + else + test_failed + print_error "Job is not in appropriate state" + fi - sleep 10 + printf "Logging events resulting in RUNNING state\n" + $LB_RUNNING_SH -j ${jobid} > /dev/null 2> /dev/null - jobstate=`${LBJOBSTATUS} ${jobid} | grep "state :" | awk '{print $3}'` - printf "Testing job ($jobid) is in state: $jobstate\n" + printf "Logging events resulting in DONE state\n" + $LB_DONE_SH -j ${jobid} > /dev/null 2> /dev/null - if [ "${jobstate}" = "Done" ]; then - test_done - else - test_failed - print_error "Job is not in appropriate state" - fi + printf "Sleeping for 10 seconds (waiting for events to deliver)...\n" + + sleep 10 + jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` + printf "Testing job ($jobid) is in state: $jobstate\n" + + if [ "${jobstate}" = "Done" ]; then + test_done + else + test_failed + print_error "Job is not in appropriate state" + fi + fi fi test_end diff --git a/org.glite.testsuites.ctb/LB/lb-test-server-local.sh b/org.glite.testsuites.ctb/LB/lb-test-server-local.sh index da45f24..8a095a5 100755 --- a/org.glite.testsuites.ctb/LB/lb-test-server-local.sh +++ b/org.glite.testsuites.ctb/LB/lb-test-server-local.sh @@ -76,7 +76,7 @@ test_start # check_binaries printf "Testing if all binaries are available" -check_binaries +check_binaries $SYS_LSOF $SYS_GREP $SYS_SED $SYS_PS $SYS_MYSQLADMIN $SYS_PIDOF if [ $? -gt 0 ]; then test_failed else @@ -143,7 +143,7 @@ fi # Interlogger running: printf "Testing if Interlogger is running" -if [ "$(pidof ${LB_INTERLOGD})" ]; then +if [ "$(${SYS_PIDOF} ${LB_INTERLOGD})" ]; then test_done else test_failed diff --git a/org.glite.testsuites.ctb/LB/lb-test-server-remote.sh b/org.glite.testsuites.ctb/LB/lb-test-server-remote.sh index 2fabbf0..d558f16 100755 --- a/org.glite.testsuites.ctb/LB/lb-test-server-remote.sh +++ b/org.glite.testsuites.ctb/LB/lb-test-server-remote.sh @@ -83,7 +83,7 @@ test_start # check_binaries printf "Testing if all binaries are available" -check_binaries +check_binaries $TEST_SOCKET $SYS_PING $SYS_GREP if [ $? -gt 0 ]; then test_failed print_error "Some binaries are missing"