This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
cpan/Time-HiRes/t/itimer.t: better diagnostics
authorDavid Mitchell <davem@iabyn.com>
Mon, 21 Jul 2014 15:02:23 +0000 (16:02 +0100)
committerDavid Mitchell <davem@iabyn.com>
Mon, 21 Jul 2014 15:02:23 +0000 (16:02 +0100)
This test is failing some smokes. Add better diagnostics to see what's
going on.

Since this is a CPAN-first module, this commit either needs backing out at
some point, or merging upstream.

cpan/Time-HiRes/t/itimer.t

index a9ef80d..24374cd 100644 (file)
@@ -43,7 +43,8 @@ note "setitimer: ", join(" ",
 
 # Assume interval timer granularity of $limit * 0.5 seconds.  Too bold?
 my $virt = Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL);
-ok defined $virt && abs($virt / 0.5) - 1 < $limit;
+ok defined $virt && abs($virt / 0.5) - 1 < $limit
+   or diag "virt=" . (defined $virt ? $virt : 'undef');
 
 note "getitimer: ", join(" ",
     Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL));
@@ -57,7 +58,8 @@ note "getitimer: ", join(" ",
     Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL));
 
 $virt = Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL);
-ok defined $virt && $virt == 0;
+note "at end, i=$i";
+is($virt, 0, "time left should be zero");
 
 $SIG{VTALRM} = 'DEFAULT';