+ { # convert to a hash, find ranges, output list of ranges
+ my $h = { split /\s+/, $row->{log_text} };
+ my ($i, $start, $last);
+ my @ranges;
+
+ foreach my $k (sort {$a<=>$b} keys %$h)
+ {
+ if (defined $start)
+ {
+ if ($h->{$k} ne $h->{$start} || $k != $last + 1)
+ {
+ # The result (skiped, Passed, Failed) for this testcase number
+ # is different to the start one of the range,
+ # or the range became non-contiguous.
+ # Add text for the range to list of ranges
+ # (these three elements get used by "status.tt" BLOCK colourbar)
+ # Reset the start and the count, for a new range.
+
+ push @ranges, sprintf("%s %s %s", $h->{$start}, $start, $i);
+ $start = $k;
+ $i = 1;
+ }
+ else
+ {
+ # bump the size of this range
+ $i++;
+ }
+ }
+ else
+ {
+ # First ever range for this row
+ $start = $k;
+ $i = 1;
+ }
+ $last = $k;
+ }
+ if (defined $start)
+ {
+ # close out the final range
+ push @ranges, sprintf("%s %s %s", $h->{$start}, $start, $i);
+ }
+
+ $row->{log_text} = \@ranges;