From: Ian Jackson Subject: [OSSTEST PATCH 09/10] sg-report-job-history: Introduce report_altchangecolour Date: Thu, 23 Jul 2015 19:19:23 +0100 Message-ID: <1437675564-16602-10-git-send-email-ian.jackson@eu.citrix.com> References: <1437675564-16602-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZIL6G-0007sp-3q for xen-devel@lists.xenproject.org; Thu, 23 Jul 2015 18:20:08 +0000 In-Reply-To: <1437675564-16602-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org No functional change. Signed-off-by: Ian Jackson --- Osstest/Executive.pm | 12 ++++++++++++ sg-report-job-history | 10 +++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm index 998a0d0..79d433a 100644 --- a/Osstest/Executive.pm +++ b/Osstest/Executive.pm @@ -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(); diff --git a/sg-report-job-history b/sg-report-job-history index e8cf50f..11fdaaf 100755 --- a/sg-report-job-history +++ b/sg-report-job-history @@ -231,7 +231,7 @@ END print H "\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 ""; @@ -263,12 +263,8 @@ END "\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 ""; + my $rev_colour = report_altchangecolour(\$alt_revs[$i], $v); + print H ""; if (defined $v) { my $vp= $v; if (defined $lastrev && $v eq $lastrev) { -- 1.7.10.4