]> xenbits.xensource.com Git - people/dariof/osstest.git/commitdiff
sg-report-flight: Add a succcess/failure column header.
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 2 Oct 2014 11:56:06 +0000 (12:56 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 3 Oct 2014 15:18:14 +0000 (16:18 +0100)
There are so many rows and columns that scrolling around trying to find the
column associated with a failure is getting pretty tricky. Finding all failing
columns is even harder.

Add a clue near the top: replicate the worst or most interesting step
result box contents and colour.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
sg-report-flight

index 4760656e1f2776169c49f2cd23f5c5ac78ee0bc3..c8d88e81885c31c7add31c9222a226ad1979b032 100755 (executable)
@@ -822,7 +822,7 @@ END
         my $st= $step->{status};
         my $logfilename= "$step->{stepno}.$step->{step}.log";
         printf H "<td bgcolor='%s'><a href='%s'>%s</a></td>",
-            html_status2colour($st),
+           (html_status2_colour_priority($st))[0],
             encode_entities(uri_escape($logfilename)),
             encode_entities($st);
         $issteplog{$logfilename}= 1;
@@ -886,11 +886,11 @@ END
     rename "$htmlfile.new", $htmlfile or die $!;
 }
 
-sub html_status2colour ($) {
+sub html_status2_colour_priority ($) {
     my ($st) = @_;
-    return ($st eq 'pass' ? '#008800' :
-            $st eq 'fail' ? '#ff8888' :
-            '#ffff00');
+    return ($st eq 'pass' ? ('#008800',100) :
+            $st eq 'fail' ? ('#ff8888',200) :
+            ('#ffff00',300));
 }
 
 sub htmlout ($) {
@@ -923,6 +923,56 @@ END
         print H "</th>";
     }
     print H "\n";
+    print H "<tr><th>";
+    print H "Worst/last";
+    print H "</th>";
+
+    my $cell_html = sub {
+       my ($ei) = @_;
+       # => ($h, $priority);
+       my $s= $ei->{Step};
+       my $sum_core= $ei->{SummaryCore};
+       $sum_core= $ei->{Summary} if !defined $sum_core;
+       my $sum_flight= $ei->{SummaryRefFlight};
+       my $bgc;
+       my $priority;
+       if (!defined $sum_core || !length $sum_core) {
+           $sum_core= $s->{status};
+           ($bgc,$priority)= html_status2_colour_priority($s->{status});
+       } else {
+           ($bgc,$priority) =
+               $ei->{Blocker} eq 'regression'
+               ? ('#ff8888',400)
+               : ('#ffff00',250);
+       }
+       my $h = " bgcolor=\"$bgc\">";
+       $h .= "<a href=\"".encode_entities($s->{job}).
+           "/$s->{stepno}.".encode_entities($s->{step}).".log\">";
+       #print H "[$s->{stepno}] ";
+       $h .= encode_entities($sum_core);
+       $h .= "</a>";
+       if (defined $sum_flight) {
+           $h .= " <a href=\"../$sum_flight/\">".
+               displayflightnum($sum_flight)."</a>";
+       }
+       return ($h,$priority);
+    };
+
+    foreach my $col (@cols) {
+       my @worst=(' bgcolor="#444444">',0);
+       foreach my $rowix (0..$#{ $fi->{GridRows} }) {
+            my $ei= $fi->{GridGrid}{$col}[$rowix];
+           next unless $ei;
+           my @this = $cell_html->($ei);
+           next if $this[1] < $worst[1];
+           @worst=@this;
+       }
+        print H "<td ",$worst[0],"</td>";
+    }
+    print H "\n";
+    # Create a gutter row after the headers.
+    print H "<tr><td>&nbsp;</td></tr>\n";
+
     foreach my $rowix (0..$#{ $fi->{GridRows} }) {
         next unless $fi->{GridRows}[$rowix];
         my $rowdesc= encode_entities($fi->{GridRows}[$rowix]);
@@ -962,30 +1012,9 @@ END
             my $ei= $fi->{GridGrid}{$col}[$rowix];
             if ($ei) {
                 $deferred_cells->(1);
-                print H "<td";
                 my $s= $ei->{Step};
-                my $sum_core= $ei->{SummaryCore};
-                my $sum_flight= $ei->{SummaryRefFlight};
-                $sum_core= $ei->{Summary} if !defined $sum_core;
-                my $bgc;
-                if (!defined $sum_core || !length $sum_core) {
-                    $sum_core= $s->{status};
-                    $bgc= html_status2colour($s->{status});
-                } else {
-                    $bgc= $ei->{Blocker} eq 'regression'
-                        ? '#ff8888' : '#ffff00';
-                }
-                print H " bgcolor=\"$bgc\">";
-                print H "<a href=\"".encode_entities($col).
-                    "/$s->{stepno}.".encode_entities($s->{step}).".log\">";
-                #print H "[$s->{stepno}] ";
-                print H encode_entities($sum_core);
-                print H "</a>";
-                if (defined $sum_flight) {
-                    print H " <a href=\"../$sum_flight/\">".
-                       displayflightnum($sum_flight)."</a>";
-                }
-                print H "</td>";
+               my ($h,$priority) = $cell_html->($ei);
+                print H "<td", $h, "</td>";
             } else {
                 $ndeferred++;
             }