X-Git-Url: https://git.exim.org/buildfarm-server.git/blobdiff_plain/ec2bcb4768cc662362eb942ec52af9fe1046afaa..b82a14979c08ae940b8c0b8df8583ae4e79ceea8:/cgi-bin/show_history.pl diff --git a/cgi-bin/show_history.pl b/cgi-bin/show_history.pl index c57a617..50b1bf3 100755 --- a/cgi-bin/show_history.pl +++ b/cgi-bin/show_history.pl @@ -31,7 +31,7 @@ die $DBI::errstr unless $db; my $query = new CGI; my $member = $query->param('nm'); $member =~ s/[^a-zA-Z0-9_ -]//g; -my $branch = $query->param('br'); $branch =~ s/[^a-zA-Z0-9_ -]//g; +my $branch = $query->param('br'); $branch =~ s/[^a-zA-Z0-9+_ .-]//g; my $hm = $query->param('hm'); $hm =~ s/[^a-zA-Z0-9_ -]//g; $hm = '240' unless $hm =~ /^\d+$/; @@ -51,17 +51,19 @@ my $systemdata = q{ }; my $statement = qq{ - with x as + WITH x AS ( select * from build_status_recent_500 where sysname = ? and branch = ? - ) - select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago, - sysname, snapshot, status, stage - from x - order by snapshot desc - limit $hm + ) + SELECT (now() at time zone 'GMT')::timestamp(0) - x.snapshot as when_ago, + x.sysname, x.snapshot, x.status, x.stage, s.log_text + FROM x + LEFT JOIN build_status_log s + ON x.snapshot = s.snapshot AND s.log_stage = 'test-results.log' + ORDER BY x.snapshot desc + LIMIT $hm } ; @@ -81,6 +83,45 @@ while (my $row = $sth->fetchrow_hashref) $row->{os_version} = $latest_personality->[0]; $row->{compiler_version} = $latest_personality->[1]; } + + # convert list of individual testresults to list of ranges of equal results + # for speed of display + if (defined($row->{log_text})) + { # convert to a hash, find ranges, output list of ranges + my $h = { split /\s+/, $row->{log_text} }; + my $i; + my $start; + my @ranges; + + foreach my $k (sort {$a<=>$b} keys %$h) + { + if (defined $start) + { + if ($h->{$k} ne $h->{$start}) + { + push @ranges, sprintf("%s %s %s", $h->{$start}, $start, $i); + $start = $k; + $i = 1; + } + else + { + $i++; + } + } + else + { + $start = $k; + $i = 1; + } + } + if (defined $start) + { + push @ranges, sprintf("%s %s %s", $h->{$start}, $start, $i); + } + + $row->{log_text} = \@ranges; + } + push(@$statrows,$row); }