diff options
author | David Mitchell <davem@iabyn.com> | 2015-11-25 15:36:26 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2015-11-25 15:36:26 +0000 |
commit | 27a1613c1c30c85a73763ac61826d0c2e5d891f5 (patch) | |
tree | 23418fc75b3b66b06787d805e4711df79b2ea8a2 /lib/Benchmark.t | |
parent | f868229640881c69bc53c5781a48b40738e273cd (diff) | |
download | perl-27a1613c1c30c85a73763ac61826d0c2e5d891f5.tar.gz |
Benchmark.t: add more diag output
2 tests in a particular block of code are consistently failing on a newbsd
smoker.
Make a copy of that block of code but with the result object and
chart object generated separately, then diag dump both if any of the
tests in that new block fail, so we can see better what's going wrong.
Diffstat (limited to 'lib/Benchmark.t')
-rw-r--r-- | lib/Benchmark.t | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/Benchmark.t b/lib/Benchmark.t index 1ba7becd6c..680e50d574 100644 --- a/lib/Benchmark.t +++ b/lib/Benchmark.t @@ -8,7 +8,7 @@ BEGIN { use warnings; use strict; use vars qw($foo $bar $baz $ballast); -use Test::More tests => 195; +use Test::More tests => 213; use Benchmark qw(:all); @@ -487,6 +487,29 @@ sub check_graph { { $foo = $bar = 0; select(OUT); + my $res = timethese( 10, $code_to_test, 'none' ) ; + my $chart = cmpthese($res, 'none' ) ; + select(STDOUT); + ok ($foo > 0, "Foo code was run"); + ok ($bar > 0, "Bar code was run"); + + $got = $out->read(); + # Remove any warnings about having too few iterations. + $got =~ s/\(warning:[^\)]+\)//gs; + $got =~ s/^[ \t\n]+//s; # Remove all the whitespace from the beginning + is ($got, '', "format 'none' should suppress output"); + is (ref $chart, 'ARRAY', "output should be an array ref"); + # Some of these will go bang if the preceding test fails. There will be + # a big clue as to why, from the previous test's diagnostic + is (ref $chart->[0], 'ARRAY', "output should be an array of arrays"); + use Data::Dumper; + check_graph(@$chart) + or diag(Data::Dumper->Dump([$res, $chart], ['$res', '$chart'])); +} + +{ + $foo = $bar = 0; + select(OUT); my $chart = cmpthese( $results ) ; select(STDOUT); is ($foo, 0, "Foo code was not run"); |