--Apple-Mail-39--397705755 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii
I sent this to perlbugs 2 hours ago but there seems to be a problem. I thought I'd send it here in the mean time.
Test 24 is failing for me on some systems:
# Failed test 'timestr ($diff, "noc")' # at lib/Benchmark.t line 123. # ' 7 wallclock secs ( 7.03 usr + 0.04 sys = 7.07 CPU)' # doesn't match '(?-xism:7 +wallclock secs? +\( *7.03 +usr +\+ +0.04 +sys += +7.08 +CPU\))'
The Test: my $noc = timestr ($diff, 'noc'); like ($noc, qr/$wallclock +wallclock secs? +\( *$usr +usr +\+ +$sys +sys += +$cpu +CPU\)/, 'timestr ($diff, "noc")');
When I dig into this test, It appears that $cpu is generated from the regex by parsing the 'all' output: my $all = timestr ($diff, 'all'); my ($wallclock, $usr, $sys, $cusr, $csys, $cpu) = $all =~ $All_Pattern;
This means that the expectation is that the CPU time for 'all' output will match the CPU time for 'noc' output. CPU time is calculated... for 'all': $tr->cpu_a for' noc': $tr->cpu_p
The code to calculate the CPU for each of these is: sub cpu_p { my($r,$pu,$ps,$cu,$cs) = @{$_[0]}; $pu+$ps ; } sub cpu_a { my($r,$pu,$ps,$cu,$cs) = @{$_[0]}; $pu+$ps+$cu+$cs ; }
What this means: The only way test 24 can succeed is if $cu and $cs are 0. In my case, extra diag messages show that $cu was 0.01 and this caused the test to fail. Suggested Patch: There are no comments in the test file to indicate if we're validating formatting or the math on this. I'm inclined to go with formatting so I suggest the following patch for test 24, which will match what test 25 for 'nop' output is doing.
--- a/lib/Benchmark.t +++ b/lib/Benchmark.t @@ -114,7 +114,7 @@ is ($auto, $default, 'timestr ($diff, "auto") matches timestr ($diff)'); is (timestr ($diff, 'none'), '', "none supresses output"); my $noc = timestr ($diff, 'noc'); - like ($noc, qr/$wallclock +wallclock secs? +\( *$usr +usr +\+ +$sys +sys += +$cpu +CPU\)/, 'timestr ($diff, "noc")'); + like ($noc, qr/$wallclock +wallclock secs? +\( *$usr +usr +\+ +$sys +sys += +\d+\.\d\d +CPU\)/, 'timestr ($diff, "noc")'); my $nop = timestr ($diff, 'nop'); like ($nop, qr/$wallclock +wallclock secs? +\( *$cusr +cusr +\+ +$csys +csys += +\d+\.\d\d +CPU\)/, 'timestr ($diff, "nop")');
--Apple-Mail-39--397705755--
|