From d00a1bb2f1ca051acfb835b68662b615f29b8893 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Mon, 5 Sep 2011 16:32:48 +0000 Subject: [PATCH] Notification tests updates: - slightly increase timeout - quicker end on succesfull notification arrival - disown background process to suppress "Terminated" message --- org.glite.testsuites.ctb/LB/tests/lb-common.sh | 18 ++++++++++++++++++ .../LB/tests/lb-test-notif-recovery.sh | 8 +++++--- .../LB/tests/lb-test-notif-stream.sh | 17 +++++------------ .../LB/tests/lb-test-notif-switch.sh | 17 ++++++++++------- org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh | 9 +++++---- 5 files changed, 43 insertions(+), 26 deletions(-) diff --git a/org.glite.testsuites.ctb/LB/tests/lb-common.sh b/org.glite.testsuites.ctb/LB/tests/lb-common.sh index 2db7474..09ee9d0 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-common.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-common.sh @@ -310,3 +310,21 @@ function check_srv_version() fi return 0 } + +function notif_wait() { + timeout="$1" + jobid="$2" + f="$3" + + while ! $SYS_GREP ${jobid} "$f" > /dev/null 2>&1; do + sleep 1 + printf "." + timeout=$((timeout-1)) + if [ $timeout -le 0 ]; then + printf "timeout" + break; + fi + done + echo + $SYS_GREP ${jobid} $$_notifications.txt > /dev/null +} diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-recovery.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-notif-recovery.sh index 0a84dc2..fe9ca46 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-recovery.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-test-notif-recovery.sh @@ -150,11 +150,13 @@ else sleep 10 #Start listening for notifications - ${LBNOTIFY} receive -i 5 ${notifid} > $$_notifications.txt & + ${LBNOTIFY} receive -i 10 ${notifid} > $$_notifications.txt & recpid=$! + disown $recpid - sleep 10 - kill $recpid + printf "Receiving notifications " + notif_wait 10 ${jobid} $$_notifications.txt + kill $recpid >/dev/null 2>&1 $SYS_GREP ${jobid} $$_notifications.txt > /dev/null diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh index 9f2ef77..82a17be 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh @@ -171,20 +171,13 @@ while true; do test_done #Start listening for notifications - ${LBNOTIFY} receive -i 5 ${notifid} > $$_notifications.txt & + ${LBNOTIFY} receive -i 10 ${notifid} > $$_notifications.txt & recpid=$! + disown $recpid - printf "Receiving the stream: " - cnt=0 - while ! $SYS_GREP ${jobid} $$_notifications.txt > /dev/null; do - sleep 0.5 - printf "." - cnt=$((cnt+1)) - if [ $cnt -ge 10 ]; then - break - fi - done - kill $recpid + printf "Receiving the stream " + notif_wait 10 ${jobid} $$_notifications.txt + kill $recpid >/dev/null 2>&1 $SYS_GREP ${jobid} $$_notifications.txt > /dev/null if [ $? = 0 ]; then diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-switch.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-notif-switch.sh index e6040c7..9c65952 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-switch.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-test-notif-switch.sh @@ -149,6 +149,7 @@ else #Start listening for notifications ${LBNOTIFY} receive -i 15 ${notifid} > $$_notifications.txt & recpid=$! + disown $recpid printf "Logging events resulting in RUNNING state\n" $LB_RUNNING_SH -j ${jobid} > /dev/null 2> /dev/null @@ -182,11 +183,12 @@ else test_failed fi - kill $recpid + kill $recpid >/dev/null 2>&1 #Start listening for notifications ${LBNOTIFY} receive -i 10 ${notifid} > $$_notifications.txt & recpid=$! + disown $recpid printf "Logging events resulting in DONE state for both jobs\n" $LB_DONE_SH -j ${jobid} > /dev/null 2> /dev/null @@ -194,7 +196,7 @@ else sleep 10 - kill $recpid + kill $recpid >/dev/null 2>&1 #$SYS_CAT $$_notifications.txt @@ -253,11 +255,12 @@ else fi test_end -} &> $logfile +} +#} &> $logfile -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi +#if [ $flag -ne 1 ]; then +# cat $logfile +# $SYS_RM $logfile +#fi exit $TEST_OK diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh index cf65f14..d1e82dc 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh @@ -145,15 +145,16 @@ else test_done #Start listening for notifications - ${LBNOTIFY} receive -i 5 ${notifid} > $$_notifications.txt & + ${LBNOTIFY} receive -i 10 ${notifid} > $$_notifications.txt & recpid=$! + disown $recpid printf "Logging events resulting in DONE state\n" $LB_DONE_SH -j ${jobid} > /dev/null 2> /dev/null - sleep 10 - - kill $recpid + printf "Receiving notifications " + notif_wait 10 ${jobid} $$_notifications.txt + kill $recpid >/dev/null 2>&1 $SYS_GREP ${jobid} $$_notifications.txt > /dev/null -- 1.8.2.3