Skip to content

Commit 76f3b69

Browse files
ttaylorrgitster
authored andcommitted
t/perf/aggregate.perl: tolerate leading spaces
When using `test_size` with `wc -c`, users on certain platforms can run into issues when `wc` emits leading space characters in its output, which confuses get_times. Callers could switch to use test_file_size instead of `wc -c` (the former never prints leading space characters, so will always work with test_size regardless of platform), but this is an easy enough spot to miss that we should teach get_times to be more tolerant of the input it accepts. Teach get_times to do just that by stripping any leading space characters. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 225bc32 commit 76f3b69

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

t/perf/aggregate.perl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ sub get_times {
1717
my $rt = ((defined $1 ? $1 : 0.0)*60+$2)*60+$3;
1818
return ($rt, $4, $5);
1919
# size
20-
} elsif ($line =~ /^\d+$/) {
21-
return $&;
20+
} elsif ($line =~ /^\s*(\d+)$/) {
21+
return $1;
2222
} else {
2323
die "bad input line: $line";
2424
}

0 commit comments

Comments
 (0)