]> xenbits.xensource.com Git - osstest.git/commitdiff
sg-report-job-history: Introduce report_altchangecolour
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 23 Jul 2015 18:10:43 +0000 (19:10 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 28 Jul 2015 14:30:21 +0000 (15:30 +0100)
No functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Osstest/Executive.pm
sg-report-job-history

index 998a0d045deaca7b1e9963702e947b1e8302e662..79d433a8e3ec6f6fe28cfbf7e29b4d693550293e 100644 (file)
@@ -48,6 +48,7 @@ BEGIN {
                       findtask @all_lock_tables
                       restrictflight_arg restrictflight_cond
                       report_run_getinfo report_altcolour
+                      report_altchangecolour
                       report_blessingscond report_find_push_age_info
                       tcpconnect_queuedaemon plan_search
                       alloc_resources alloc_resources_rollback_begin_work
@@ -280,6 +281,17 @@ sub report_altcolour ($) {
     return "bgcolor=\"#".(qw(d0d0d0 ffffff))[$bool]."\"";
 }
 
+sub report_altchangecolour ($$) {
+    my ($stateref, $thisvalue) = @_;
+    my $state = $$stateref //= { Bool => 0 };
+    my $same =
+       !!defined($thisvalue) == !!defined($state->{LastValue}) &&
+       (!defined $thisvalue || $thisvalue eq $state->{LastValue});
+    $state->{Bool} ^= !$same;
+    $state->{LastValue} = $thisvalue;
+    return report_altcolour($state->{Bool});
+}
+
 sub report_blessingscond ($) {
     my ($blessings) = @_;
     my $flightcond= restrictflight_cond();
index e8cf50fbd19640428b689c45cb36a53e55bd434e..11fdaafe76d3e77a7c3d931e18f7e60509486161 100755 (executable)
@@ -231,7 +231,7 @@ END
         print H "</tr>\n";
         my $alternate= 0;
         my @last_revs;
-        my @alt_revs= ('0')x $#rev_grid_cols;
+        my @alt_revs;
         foreach my $r (@test_rows) {
             my $altcolour= report_altcolour($alternate);
             print H "<tr $altcolour>";
@@ -263,12 +263,8 @@ END
                 "</td>\n";
             foreach my $i (0..$#rev_grid_cols) {
                 my $v= $r->{Revisions}[$i];
-                my $same=
-                    !defined($last_revs[$i]) ? !defined($v) :
-                    !defined($v) ? 0 :
-                    $last_revs[$i] eq $v;
-                $alt_revs[$i] ^= !$same;
-                print H "<td ".report_altcolour($alt_revs[$i]).">";
+               my $rev_colour = report_altchangecolour(\$alt_revs[$i], $v);
+                print H "<td $rev_colour>";
                 if (defined $v) {
                     my $vp= $v;
                     if (defined $lastrev && $v eq $lastrev) {