[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 09/12] reporting: Move report_run_getinfo and some colours into Executive.pm
This is to support a forthcoming sg-report-host-history. No functional change. Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- Osstest/Executive.pm | 45 +++++++++++++++++++++++++++++++++++++++++++++ sg-report-job-history | 48 ++++-------------------------------------------- 2 files changed, 49 insertions(+), 44 deletions(-) diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm index 118a91a..90c615a 100644 --- a/Osstest/Executive.pm +++ b/Osstest/Executive.pm @@ -45,6 +45,7 @@ BEGIN { @ISA = qw(Exporter); @EXPORT = qw(get_harness_rev grabrepolock_reexec findtask @all_lock_tables + report_run_getinfo report_altcolour tcpconnect_queuedaemon plan_search alloc_resources alloc_resources_rollback_begin_work resource_check_allocated resource_shared_mark_ready @@ -188,6 +189,50 @@ sub opendb ($) { return $dbh; } +#---------- history reporting ---------- + +our $green= '#008800'; +our $red= '#ff8888'; +our $yellow= '#ffff00'; +our $purple= '#ff00ff'; + +sub report_run_getinfo ($) { + # $f is a joined flight/job row, must contain at least + # flight job status + my ($f) = @_; + my $status= $f->{status}; + if ($status eq 'pass') { + return { Summary => "($status)", Colour => $green }; + } elsif ($status eq 'fail') { + our $failstepq //= db_prepare(<<END); + SELECT * FROM steps + 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 { Summary => "(unknown)", Colour => $yellow }; + } elsif ($fs->{status} eq 'fail') { + return { Summary => "$fs->{testid}", Colour => $red }; + } else { + return { Summary => "$fs->{testid} $fs->{status}", + Colour => $red }; + } + } elsif ($status eq 'blocked') { + return { Summary => "blocked", Colour => $purple }, + } else { + return { Summary => "($f->{status})", Colour => $yellow }; + } +} + +sub report_altcolour ($) { + my ($bool) = @_; + return "bgcolor=\"#".(qw(d0d0d0 ffffff))[$bool]."\""; +} + #---------- host (and other resource) allocation ---------- our $taskid; diff --git a/sg-report-job-history b/sg-report-job-history index bbb85fd..18821b3 100755 --- a/sg-report-job-history +++ b/sg-report-job-history @@ -25,6 +25,7 @@ use IO::Handle; use HTML::Entities; use Osstest::TestSupport; +use Osstest::Executive; our (@blessings,@branches); our $limit= 500; @@ -84,42 +85,6 @@ if (defined($flight)) { push @jobs, $job; } -our $failstepq= db_prepare(<<END); - SELECT * FROM steps - WHERE flight=? AND job=? - AND status!='pass' - ORDER BY stepno - LIMIT 1 -END - -our $green= '#008800'; -our $red= '#ff8888'; -our $yellow= '#ffff00'; -our $purple= '#ff00ff'; - -sub run_getinfo ($) { - my ($f) = @_; - my $status= $f->{status}; - if ($status eq 'pass') { - return { Summary => "($status)", Colour => $green }; - } elsif ($status eq 'fail') { - $failstepq->execute($f->{flight}, $f->{job}); - my $fs= $failstepq->fetchrow_hashref(); - if (!defined $fs) { - return { Summary => "(unknown)", Colour => $yellow }; - } elsif ($fs->{status} eq 'fail') { - return { Summary => "$fs->{testid}", Colour => $red }; - } else { - return { Summary => "$fs->{testid} $fs->{status}", - Colour => $red }; - } - } elsif ($status eq 'blocked') { - return { Summary => "blocked", Colour => $purple }, - } else { - return { Summary => "($f->{status})", Colour => $yellow }; - } -} - our $revisionsq= db_prepare(<<END); SELECT * FROM runvars WHERE flight=? AND job=? @@ -142,11 +107,6 @@ our $buildsq= db_prepare(<<END); AND name LIKE E'\%buildjob' END -sub altcolour ($) { - my ($bool) = @_; - return "bgcolor=\"#".(qw(d0d0d0 ffffff))[$bool]."\""; -} - sub processjobbranch ($$) { my ($j,$bra) = @_; @@ -201,7 +161,7 @@ END END while (my $f= $flightsq->fetchrow_hashref()) { - my $ri= run_getinfo($f); + my $ri= report_run_getinfo($f); $ri->{Hosts} = [ ]; foreach my $hostvar (@hostvarcols) { @@ -263,7 +223,7 @@ END my @alt_revs= ('0')x $#rev_grid_cols; foreach my $r (@test_rows) { my $colour= "bgcolor=\"$r->{Colour}\""; - my $altcolour= altcolour($alternate); + my $altcolour= report_altcolour($alternate); print H "<tr $altcolour>"; my $started = $r->{Flight}{started}; print H "<td>"; @@ -286,7 +246,7 @@ END !defined($v) ? 0 : $last_revs[$i] eq $v; $alt_revs[$i] ^= !$same; - print H "<td ".altcolour($alt_revs[$i]).">"; + print H "<td ".report_altcolour($alt_revs[$i]).">"; if (defined $v) { my $vp= $v; if (defined $lastrev && $v eq $lastrev) { -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |