]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
Reporting: In history tables, show multiple failure steps
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 29 Jun 2015 15:46:36 +0000 (16:46 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 30 Jun 2015 11:26:43 +0000 (12:26 +0100)
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@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: Remove unnecessary space in ColourAttr

Osstest/Executive.pm

index b757618b0060c28eeb8eb22a93775cdd2774b29e..87f2e982d75c1058dac73f7177051e959e27bcaa 100644 (file)
@@ -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 {