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
+}
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
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
#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
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
sleep 10
- kill $recpid
+ kill $recpid >/dev/null 2>&1
#$SYS_CAT $$_notifications.txt
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
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