From: Todd Rinaldo Date: Tue, 2 Feb 2010 17:27:37 +0000 (-0800) Subject: Diagnostic improvements to better understand why lib/Benchark.t test 13 has been... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8350df422c2af17dc86ea17dcbbe151cbc8fe6d9;p=p5sagit%2Fp5-mst-13.2.git Diagnostic improvements to better understand why lib/Benchark.t test 13 has been failing smoke randomly. Fix 1: Original code tests for less than but not =. I think that if these values are the same, the test should pass. I don't know the code well enough to be 100% sure. D Fix 2: convert ok() to cmp_ok() for better diagnostic messages from smoke tests when they happen. Fix 3: convert print to diag() so it will properly print through harness. --- diff --git a/lib/Benchmark.t b/lib/Benchmark.t index 3a7a1de..9b8e2af 100644 --- a/lib/Benchmark.t +++ b/lib/Benchmark.t @@ -77,9 +77,8 @@ ok ($in_onesec > 0, "iters returned positive iterations"); { my $difference = $in_onesec - $estimate; my $actual = abs ($difference / $in_onesec); - ok ($actual < $delta, "is $in_onesec within $delta of estimate ($estimate)"); - print "# $in_onesec is between " . ($delta / 2) . - " and $delta of estimate. Not that safe.\n" if $actual > $delta/2; + cmp_ok($actual, '<=', $delta, "is $in_onesec within $delta of estimate ($estimate)") + or diag("# $in_onesec is between " . ($delta / 2) . " and $delta of estimate. Not that safe."); } # I found that the eval'ed version was 3 times faster than the coderef.