diff options
author | Michael Adam <obnox@samba.org> | 2014-10-27 12:35:12 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2014-10-30 20:25:04 +0100 |
commit | 062289f0f896af85671adad09a9a2afc027be570 (patch) | |
tree | b6dd7f8d16f361fbf896042716dbc8c2b580f4f3 /script/show_testsuite_time | |
parent | 6168ae0b870e847417af39f3e007dc583315ffdf (diff) | |
download | samba-062289f0f896af85671adad09a9a2afc027be570.tar.gz |
script: fix display of ten slowest tests if < 10 tests are run.
Note: $#array is the biggest index in an array in perl.
@array evaluated in scalar context is the number of elements.
Hence scalar(@array) = 1 + $#array
Or equivalently: 0 + @array = 1 + $#array
... :-)
Apart from this off-by-one error, the "unless" clause to trigger
the capping of the number of tests listed was wrong. Hence if
less then 10 tests were run, a number of blank lines were appended.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'script/show_testsuite_time')
-rwxr-xr-x | script/show_testsuite_time | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/script/show_testsuite_time b/script/show_testsuite_time index d4379f4597e..fb9ea2f94f4 100755 --- a/script/show_testsuite_time +++ b/script/show_testsuite_time @@ -43,7 +43,7 @@ while(<$fh>) } } my @sorted = sort { $hash{$b}<=>$hash{$a} } keys(%hash); -$max = $#sorted unless $max or ($max < $#sorted); +$max = @sorted if (($max <= 0) or ($max > @sorted)); for my $l (@sorted[0..($max - 1)]) { print $l."\n"; } |