[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 11/13] Reporting: In history tables, show multiple failure steps



In report_run_getinfo, used by sg-report-job-history and
sg-report-host-history, make provision for reporting multiple failed
steps.

The failed steps are put side by side (in a single table cell).  The
cell background is set by the job status, but the individual steps may
vary their colour, as seen in this example:
  http://xenbits.xen.org/people/iwj/2015/linux-next.html

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 Osstest/Executive.pm |   32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index ba668bc..9f90f67 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -222,19 +222,31 @@ sub report_run_getinfo ($) {
             WHERE flight=? AND job=?
               AND status!='pass'
          ORDER BY stepno
-            LIMIT 1
 END
         $failstepq->execute($f->{flight}, $f->{job});
-        my $fs= $failstepq->fetchrow_hashref();
-        if (!defined $fs) {
-            return $single->("(unknown)", $yellow);
-        } elsif ($fs->{status} eq 'fail') {
-            return $single->("$fs->{testid}", $failcolour);
-        } elsif ($fs->{status} eq 'broken') {
-            return $single->("$fs->{testid} broken", $yellow);
-        } else {
-            return $single->("$fs->{testid} $fs->{status}", $failcolour);
+       my @content;
+       while (my $fs = $failstepq->fetchrow_hashref()) {
+           my $summary = $fs->{testid};
+           my $colour;
+           if ($fs->{status} eq 'fail') {
+               $colour = $red;
+           } elsif ($fs->{status} eq 'broken') {
+               $summary .= " broken";
+               $colour = $yellow;
+           } else {
+               $summary .= " $fs->{status}";
+               $colour = $failcolour;
+           }
+           push @content, "<span style=\"background-color: $colour\">".
+               encode_entities($summary)."</span>";
         }
+       if (!@content) {
+           return $single->("(unknown)", $yellow);
+       }
+       return {
+           Content => (join " | ", @content),
+           ColourAttr => " bgcolor=\"$failcolour\"",
+       };
     } elsif ($status eq 'blocked') {
         return $single->("blocked", $purple),
     } else {
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.