Notification tests updates:
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Mon, 5 Sep 2011 16:32:48 +0000 (16:32 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Mon, 5 Sep 2011 16:32:48 +0000 (16:32 +0000)
- 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
org.glite.testsuites.ctb/LB/tests/lb-test-notif-recovery.sh
org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh
org.glite.testsuites.ctb/LB/tests/lb-test-notif-switch.sh
org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh

index 2db7474..09ee9d0 100755 (executable)
@@ -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
+}
index 0a84dc2..fe9ca46 100755 (executable)
@@ -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
 
index 9f2ef77..82a17be 100755 (executable)
@@ -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
index e6040c7..9c65952 100755 (executable)
@@ -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
 
index cf65f14..d1e82dc 100755 (executable)
@@ -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