From: Jeremy Harris Date: Thu, 1 Dec 2016 20:19:24 +0000 (+0000) Subject: Detail on the per-animal history page X-Git-Url: https://git.exim.org/buildfarm-server.git/commitdiff_plain/554b708b5cbc2b058fac45f3083eafea2b124c11 Detail on the per-animal history page --- diff --git a/cgi-bin/show_history.pl b/cgi-bin/show_history.pl index c57a617..49ce767 100755 --- a/cgi-bin/show_history.pl +++ b/cgi-bin/show_history.pl @@ -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,42 @@ while (my $row = $sth->fetchrow_hashref) $row->{os_version} = $latest_personality->[0]; $row->{compiler_version} = $latest_personality->[1]; } + 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); } diff --git a/templates/history.tt b/templates/history.tt index a54bce4..2281a3f 100644 --- a/templates/history.tt +++ b/templates/history.tt @@ -37,6 +37,16 @@ See accompanying License file for license details [% END %]

Branch: [% branch %][% IF statrows.size >= hm %] (last [% hm %] entries shown)[% END %]

+[% + res_imgs = { + P = '/img/t_good.gif', + F => '/img/t_fail.gif', + '.' => '/img/t_notdone.gif', + } +-%] +[%# The IF-backstop is ugly and I'm not understanding why the res_img lookup does not for for '.' -%] +[%- BLOCK colour ; IF res_imgs.$c.defined ; res_imgs.$c ; ELSE %]/img/t_notdone.gif [% END; END %] +[%- BLOCK colourbar %][% c %][%- END -%] [% BLOCK stdet %] [%- row.when_ago | replace('\s',' ') %] ago  @@ -45,19 +55,11 @@ See accompanying License file for license details [%- row.sysname %]&dt= [%- row.snapshot | uri %]"> [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%] - + [% FOREACH range IN row.log_text ; + r = range.split(' '); c = r.0; st = r.1; w = r.2; PROCESS colourbar; END %] [% END %] - - [% FOREACH offset IN [0,1,2] %][% low = offset * statrows.size / 3 ; high = -1 + (offset + 1) * statrows.size / 3 %] - [% TRY %][% PERL %] - use POSIX qw(floor); - $stash->set(low => floor($stash->get('low'))); - $stash->set(high => floor($stash->get('high'))); - [% END %][% CATCH %] [% END %] - [% END %] -
- [% FOREACH xrow IN statrows.slice(low,high) %][% PROCESS stdet row=xrow %][% END %] + [% FOREACH xrow IN statrows %][% PROCESS stdet row=xrow %][% END %]
[% END %]