summaryrefslogtreecommitdiff
path: root/lib/Benchmark.t
diff options
context:
space:
mode:
authorTodd Rinaldo <toddr@cpanel.net>2010-02-02 09:27:37 -0800
committerJesse Vincent <jesse@bestpractical.com>2010-02-02 09:27:37 -0800
commit8350df422c2af17dc86ea17dcbbe151cbc8fe6d9 (patch)
tree07c5a8cf4538bcd6b6913def99086c1847132ca2 /lib/Benchmark.t
parenteeb92b76fda504cc34bcd98ba2dbc73d933c0208 (diff)
downloadperl-8350df422c2af17dc86ea17dcbbe151cbc8fe6d9.tar.gz
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.
Diffstat (limited to 'lib/Benchmark.t')
-rw-r--r--lib/Benchmark.t5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Benchmark.t b/lib/Benchmark.t
index 3a7a1def85..9b8e2af1d9 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.