1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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>
This commit is contained in:
Michael Adam 2014-10-27 12:35:12 +01:00
parent 6168ae0b87
commit 062289f0f8

View File

@ -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";
}