On Tue, 05 Feb 2013 01:06:25 +0000, Steven Chamberlain wrote:

> The testsuite may hang forever during build depending on the time of
> day.  Some infinite 'while true' loops rely on an incorrectly calculated
> timeout, which fails if the current minute wraps around past 59 at the
> start of a new hour.

Nice catch!
 
> Please see the attached patch, which replaces the timeouts (based on a
> clock 'MM:SS' calculation), with simple loops limited by the number of
> iterations (since each iteration sleeps for a fixed duration already).

Yup, should work.

Another approach, if the timeout should be kept, would be to fix the
calculation of the times by calculating with seconds.

Cf. the attached patch (which only changes one of the many occurances
to demonstrate the idea).
 

Cheers,
gregor

-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Madredeus: Brasil
--- a/appsrc/ODS-Addressbook/make_vad.sh
+++ b/appsrc/ODS-Addressbook/make_vad.sh
@@ -91,8 +91,7 @@
   echo "Starting $SERVER"
   echo $BUILD
   ddate=`date`
-  starth=`date | cut -f 2 -d :`
-  starts=`date | cut -f 3 -d :|cut -f 1 -d " "`
+  starttime=`date +%s`
   timeout=60
   $myrm -f *.lck
   if [ "z$HOST_OS" != "z" ] 
@@ -113,12 +112,8 @@
       LOG "PASSED: $SERVER successfully started on port $PORT"
       return 0
     fi
-    nowh=`date | cut -f 2 -d :`
-    nows=`date | cut -f 3 -d : | cut -f 1 -d " "`
-    nowh=`expr $nowh - $starth`
-    nows=`expr $nows - $starts`
-    nows=`expr $nows + $nowh \*  60`
-    if test $nows -ge $timeout
+    nowtime=`date +%s`
+    if test `expr $nowtime - $starttime` -ge $timeout
     then
       LOG "***WARNING: Could not start $SERVER within $timeout seconds"
       return 1

Attachment: signature.asc
Description: Digital signature

Reply via email to