Author: timbo
Date: Thu Mar 13 07:49:51 2008
New Revision: 10917

Modified:
   dbi/trunk/t/40profile.t

Log:
Try to avoid spurious test failures on slow/overloaded systems, like
http://www.nntp.perl.org/group/perl.cpan.testers/2008/03/msg1132399.html


Modified: dbi/trunk/t/40profile.t
==============================================================================
--- dbi/trunk/t/40profile.t     (original)
+++ dbi/trunk/t/40profile.t     Thu Mar 13 07:49:51 2008
@@ -286,6 +286,9 @@
 $dbh->{Profile}->{Path} = [ '!Time', "!Time~$factor", '!MethodName' ];
 $dbh->{Profile}->{Data} = undef;
 
+# give up a timeslice in the hope that the following few lines
+# run in well under a second even of slow/overloaded systems
+sleep 1;
 $t1 = int(dbi_time())+1; 1 while int(dbi_time()-0.01) < $t1; # spin till just 
after second starts
 $t2 = int($t1/$factor)*$factor;
 
@@ -295,7 +298,7 @@
 is_deeply $tmp, {
     $t1 => { $t2 => { prepare => [ 1, 0, 0, 0, 0, 0, 0 ] }}
 }, "!Time and !Time~$factor should work"
-  or print Dumper($tmp);
+  or warn Dumper([$t1, $t2, $tmp]);
 
 
 print "testing &norm_std_n3 in Path\n";

Reply via email to