Skip to contentSkip to conversation

Linux 4.1, and reporting improvements

PATCH In review Ian Jackson 2 participants 20 messages Jun 30, 2015

lore
Share & tools
lore
#0 lore raw

v2 cover Linux 4.1, and reporting improvements

Most of this series is improvements to html and email output. It includes the push gate age query library function I offered to Ian Campbell.

Also thrown in is a patch to test the Linux 4.1 stable branch and a related cleanup.

Most of these patches are already acked.

I have reordered the series since v1 to bring the --max-flight related changes together.

Thanks,
Ian.

#1 lore raw

PATCH v2 1/14 ts-leak-check: Report leaked loop block devices

These show up as leaked processes `[loop1]' etc. too, but that is an implementation detail, and it is clearer to show them separately.

---
 ts-leak-check |    9 +++++++++
 1 file changed, 9 insertions(+)
ts-leak-check +9 -0
index fdade36..8a97971 100755
@@ -153,10 +153,19 @@ sub inventory_domains () {
     }
 }
 
+sub inventory_losetup () {
+    my $loops= target_cmd_output_root($ho, "losetup -a");
+    foreach (split /\n/, $loops) {
+	m,(/dev/loop\d+): , or die "$_ ?";
+	item('loop-device', $1, $_, 1);
+    }
+}
+
 sub inventory () {
     inventory_domains();
     inventory_processes();
     inventory_xenstore();
+    inventory_losetup();
     inventory_files('/tmp /var/run /var/tmp /var/lib/xen /var/core');
 }
 
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v2 2/14 Test Linux 4.1

In reply to Ian Jackson

The kernel.org stable git branch layout is the same for 4.1 as for 3.x, so simply extend the pattern, and add the branch to BRANCHES.

We move the linux-stable.git pattern to the end, and extend it to linux-[3-9].[0-9]*, to provide a bit more future-proofing. (There is no particular reason other than shell glob convenience to stop at linux-9.x.)

DEPLOYMENT NOTE: After this patch is acked, but just before it is pushed to pretest, run (this version of)
./mg-branch-setup linux-4.1 bisect b953c0d234bc72e8489d3bf51a276c5c4ec85345
to create the working trees on the osstest VM and push the base of v4.1 to the tested output branch.

---
v2: Extend glob pattern in ap-common and move to the end.

---
 ap-common       |    8 ++++----
 cr-for-branches |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
ap-common +4 -4
index de7bb1d..7ddeb9a 100644
@@ -116,10 +116,6 @@ info_linux_tree () {
 		: ${TREE_LINUX_THIS:=git://kernel.ubuntu.com/ubuntu/linux.git}
 		: ${TAG_LINUX_THIS:=$1.y}
 		;;
-	linux-3.*)
-		: ${TREE_LINUX_THIS:=${KERNEL_SCM}/stable/linux-stable.git}
-		: ${TAG_LINUX_THIS:=$1.y}
-		;;
 	linux-mingo-tip-master)
 		: ${TREE_LINUX_THIS:=${KERNEL_SCM}/tip/tip.git}
 		: ${GITFORCEFLAG_TREE_LINUX_THIS:=-f}
@@ -129,6 +125,10 @@ info_linux_tree () {
 		: ${TREE_LINUX_THIS:=${KERNEL_SCM}/next/linux-next.git}
 		: ${GITFORCEFLAG_TREE_LINUX_THIS:=-f}
 		;;
+	linux-[3-9].[0-9]*)
+		: ${TREE_LINUX_THIS:=${KERNEL_SCM}/stable/linux-stable.git}
+		: ${TAG_LINUX_THIS:=$1.y}
+		;;
 
 	*)
 		return 1
cr-for-branches +1 -1
index fd2b9c0..07650c1 100755
@@ -31,7 +31,7 @@ scriptoptions="$1"; shift
 LOGFILE=tmp/cr-for-branches.log
 export LOGFILE
 
-: ${BRANCHES:=osstest xen-4.0-testing xen-4.1-testing xen-4.2-testing xen-4.3-testing xen-4.4-testing xen-4.5-testing xen-unstable qemu-mainline qemu-upstream-unstable qemu-upstream-4.2-testing qemu-upstream-4.3-testing qemu-upstream-4.4-testing qemu-upstream-4.5-testing linux-3.18 linux-3.16 linux-3.14 linux-3.10 linux-3.4 linux-arm-xen seabios ovmf ${EXTRA_BRANCHES}}
+: ${BRANCHES:=osstest xen-4.0-testing xen-4.1-testing xen-4.2-testing xen-4.3-testing xen-4.4-testing xen-4.5-testing xen-unstable qemu-mainline qemu-upstream-unstable qemu-upstream-4.2-testing qemu-upstream-4.3-testing qemu-upstream-4.4-testing qemu-upstream-4.5-testing linux-4.1 linux-3.18 linux-3.16 linux-3.14 linux-3.10 linux-3.4 linux-arm-xen seabios ovmf ${EXTRA_BRANCHES}}
 export BRANCHES
 
 fetchwlem=$wlem
Signature · 1 line
1.7.10.4
Acked-by on v2 2/14
#3 lore raw

Re: [OSSTEST PATCH 02/14] Test Linux 4.1

Quoted 8 lines · Ian Jackson

The kernel.org stable git branch layout is the same for 4.1 as for 3.x, so simply extend the pattern, and add the branch to BRANCHES.

We move the linux-stable.git pattern to the end, and extend it to linux-[3-9].[0-9]*, to provide a bit more future-proofing. (There is no particular reason other than shell glob convenience to stop at linux-9.x.)

Quoted 7 lines

DEPLOYMENT NOTE: After this patch is acked, but just before it is pushed to pretest, run (this version of)
./mg-branch-setup linux-4.1 bisect b953c0d234bc72e8489d3bf51a276c5c4ec85345
to create the working trees on the osstest VM and push the base of v4.1 to the tested output branch.

Quoted 2 lines

---
v2: Extend glob pattern in ap-common and move to the end.

Did you discover a reason why 3.0 is special?

#4 lore raw

PATCH v2 3/14 ap-common: Abolish linux-3.0 special case

In reply to Ian Jackson

This is identical to the effect of the linux-[3-9] etc. glob.

---
v2: New patch in this version of the series.

---
 ap-common |    4 ----
 1 file changed, 4 deletions(-)
ap-common +0 -4
index 7ddeb9a..dfeab9e 100644
@@ -101,10 +101,6 @@ info_linux_tree () {
 	linux-linus)
 		: ${TREE_LINUX_THIS:=${KERNEL_SCM}/torvalds/linux-2.6.git}
 		;;
-	linux-3.0)
-		: ${TREE_LINUX_THIS:=${KERNEL_SCM}/stable/linux-stable.git}
-		: ${TAG_LINUX_THIS:=linux-3.0.y}
-		;;
 	linux-arm-xen)
 		: ${TREE_LINUX_THIS:=${KERNEL_SCM}/sstabellini/xen.git}
 		: ${TREE_LINUX_ARM_THIS:=${KERNEL_SCM}/sstabellini/xen.git}
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH v2 4/14 Reporting: sg-report-flight: Fix undefined value in $worstrow[]

In reply to Ian Jackson

The fallback entry in the worstrow search, used when a job has not been run at all, was wrong. Also, fix the doc comment which induced the mistake, and add a comment about the contents of @worst.

---
v2: Added the comment about @worst.

---
 sg-report-flight |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
sg-report-flight +4 -2
index 6481521..ebb9281 100755
@@ -965,7 +965,7 @@ END
 
     my $cell_html = sub {
 	my ($ei, $core_only) = @_;
-	# => ($h, $priority);
+	# => ($h, $priority, $ch);
 	my $s= $ei->{Step};
 	my $sum_core= $ei->{SummaryCore};
 	$sum_core= $ei->{Summary} if !defined $sum_core;
@@ -998,7 +998,9 @@ END
     my @worstrow1;
     my @worstrow2;
     foreach my $col (@cols) {
-	my @worst=(' bgcolor="#444444">',0);
+	# @worst = ( $cell_html->(stuff), $failing_stepid_html ) =
+	# ($step_cell_html, $priority, $colour_attr, $failing_stepid_html)
+	my @worst=('',0,'bgcolor="#444444"','');
 	foreach my $rowix (0..$#{ $fi->{GridRows} }) {
             my $ei= $fi->{GridGrid}{$col}[$rowix];
 	    next unless $ei;
Signature · 1 line
1.7.10.4
Acked-by on v2 4/14
#7 lore raw

Re: [OSSTEST PATCH 04/14] Reporting: sg-report-flight: Fix undefined value in $worstrow[]

Quoted 5 lines · Ian Jackson

The fallback entry in the worstrow search, used when a job has not been run at all, was wrong. Also, fix the doc comment which induced the mistake, and add a comment about the contents of @worst.

#8 lore raw

PATCH v2 5/14 Reporting: sg-report-job-history: Honour --limit

In reply to Ian Jackson

The global $limit was erroneously shadowed by a local in processjobbranch. Fix this, and move the erroneously hardcoded value to the global default.

No functional change if --limit was not specified, which it is not for any of our runs with the in-tree configs.

---
 sg-report-job-history |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sg-report-job-history +1 -2
index 900d998..51cb5b6 100755
@@ -28,7 +28,7 @@ use Osstest::TestSupport;
 use Osstest::Executive;
 
 our (@blessings,@branches);
-our $limit= 500;
+our $limit= 100;
 our $htmlout;
 
 open DEBUG, ">/dev/null";
@@ -123,7 +123,6 @@ sub processjobbranch ($$) {
         $cond .= " AND branch = ?";
         push @params, $bra;
     }
-    my $limit= 100;
     my $offset= $limit-1;
 
     my $fromstuff= <<END;
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH v2 6/14 Reporting: sg-report-job-history: support --max-flight

In reply to Ian Jackson

Using report_blessingscond instead of the open-coded map.

---
 sg-report-job-history |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
sg-report-job-history +5 -2
index 51cb5b6..3d02e3f 100755
@@ -30,6 +30,7 @@ use Osstest::Executive;
 our (@blessings,@branches);
 our $limit= 100;
 our $htmlout;
+our $maxflight;
 
 open DEBUG, ">/dev/null";
 
@@ -40,6 +41,8 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
         $$1= $2;
     } elsif (m/^--(limit)\=([1-9]\d*)$/) {
         $$1= $2;
+    } elsif (m/^--max-flight\=([1-9]\d*)$/) {
+	$maxflight= $1;
     } elsif (m/^--html-dir=(.*)$/) {
         $htmlout= $1;
     } elsif (m/^--branches?=(.*)$/) {
@@ -116,9 +119,9 @@ sub processjobbranch ($$) {
     my @rev_grid_cols;
     my @test_rows;
 
-    my $blessingscond= '('.join(' OR ', map { "blessing=?" } @blessings).')';
+    my $blessingscond= report_blessingscond(\@blessings, $maxflight);
     my $cond = "job = ? AND $blessingscond";
-    my (@params) = ($j, @blessings);
+    my (@params) = ($j);
     if (defined $bra) {
         $cond .= " AND branch = ?";
         push @params, $bra;
Signature · 1 line
1.7.10.4
#10 lore raw

PATCH v2 7/14 Reporting: sg-report-host-history: Support --max-flight

In reply to Ian Jackson

We can't use report_blessingscond because we handle blessings differently in sg-report-host-history (since we want the history of even adhoc etc. flights).

---
 sg-report-host-history |    6 ++++++
 1 file changed, 6 insertions(+)
sg-report-host-history +6 -0
index f4e73e9..208da55 100755
@@ -31,6 +31,7 @@ our $limit= 200;
 our $flightlimit;
 our $htmlout = ".";
 our @blessings;
+our $maxflight;
 
 open DEBUG, ">/dev/null";
 
@@ -44,6 +45,8 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
         $$1= $2;
     } elsif (m/^--flight-limit\=([1-9]\d*)$/) {
 	$flightlimit= $1;
+    } elsif (m/^--max-flight\=([1-9]\d*)$/) {
+	$maxflight= $1;
     } elsif (m/^--blessings?=(.*)$/) {
         push @blessings, split ',', $1;
     } elsif (m/^--html-dir=(.*)$/) {
@@ -59,6 +62,7 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
 
 @ARGV or die $!;
 
+our $maxflightcond = defined($maxflight) ? "flight <= $maxflight" : "TRUE";
 our $flightcond;
 
 sub computeflightsrange () {
@@ -85,6 +89,7 @@ END
 	  FROM (
 	    SELECT flight
 	      FROM flights
+             WHERE $maxflightcond
 	     ORDER BY flight DESC
 	     LIMIT $flightlimit
 	  ) f
@@ -116,6 +121,7 @@ sub mainquery () {
 	 WHERE $namecond
 	   AND ($valcond)
 	   AND $flightcond
+           AND $maxflightcond
 	 ORDER BY flight DESC
 	 LIMIT ($limit * 3 + 100) * ?
 END
Signature · 1 line
1.7.10.4
#11 lore raw

PATCH v2 8/14 Reporting: In report_run_getinfo, abstract code for returning

In reply to Ian Jackson

This will allow us to change the function's API in one place (plus all the call sites).

No functional change in this patch.

---
 Osstest/Executive.pm |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
Osstest/Executive.pm +13 -8
index 6c16fdd..2389eb2 100644
@@ -202,8 +202,14 @@ sub report_run_getinfo ($) {
     #    flight job status
     my ($f) = @_;
     my $status= $f->{status};
+
+    my $single = sub {
+	my ($summary, $colour) = @_;
+	return { Summary => $summary, Colour => $colour };
+    };
+
     if ($status eq 'pass') {
-        return { Summary => "($status)", Colour => $green };
+        return $single->("($status)", $green);
     } elsif ($status eq 'fail' or $status eq 'broken') {
 	my $failcolour = $status eq 'fail' ? $red : $yellow;
 	our $failstepq //= db_prepare(<<END);
@@ -216,19 +222,18 @@ END
         $failstepq->execute($f->{flight}, $f->{job});
         my $fs= $failstepq->fetchrow_hashref();
         if (!defined $fs) {
-            return { Summary => "(unknown)", Colour => $yellow };
+            return $single->("(unknown)", $yellow);
         } elsif ($fs->{status} eq 'fail') {
-            return { Summary => "$fs->{testid}", Colour => $failcolour };
+            return $single->("$fs->{testid}", $failcolour);
         } elsif ($fs->{status} eq 'broken') {
-            return { Summary => "$fs->{testid} broken", Colour => $yellow };
+            return $single->("$fs->{testid} broken", $yellow);
         } else {
-            return { Summary => "$fs->{testid} $fs->{status}",
-                     Colour => $failcolour };
+            return $single->("$fs->{testid} $fs->{status}", $failcolour);
         }
     } elsif ($status eq 'blocked') {
-        return { Summary => "blocked", Colour => $purple },
+        return $single->("blocked", $purple),
     } else {
-        return { Summary => "($f->{status})", Colour => $yellow };
+        return $single->("($f->{status})", $yellow);
     }
 }
 
Signature · 1 line
1.7.10.4
#12 lore raw

PATCH v2 9/14 Reporting: report_run_getinfo produces ColourAttr

In reply to Ian Jackson

This includes the bgcolour attribute name and the quotes. This will make it possible for this function to sometimes not set a background for the whole table cell in the future (which will be part of putting multiple step results in each cell).

No functional change.

---
v2: Remove an unneeded space in ColourAttr

---
 Osstest/Executive.pm   |    5 ++++-
 sg-report-host-history |    2 +-
 sg-report-job-history  |    3 +--
 3 files changed, 6 insertions(+), 4 deletions(-)
Osstest/Executive.pm +4 -1
index 2389eb2..a45ec59 100644
@@ -205,7 +205,10 @@ sub report_run_getinfo ($) {
 
     my $single = sub {
 	my ($summary, $colour) = @_;
-	return { Summary => $summary, Colour => $colour };
+	return {
+	    Summary => $summary,
+	    ColourAttr => "bgcolor=\"$colour\"",
+	};
     };
 
     if ($status eq 'pass') {
sg-report-host-history +1 -1
index 208da55..dc150af 100755
@@ -248,7 +248,7 @@ END
 	print H "<td><a href=\"$url\">$jr->{job}</td>\n";
 
 	my $ri = report_run_getinfo({ %$jr, %$ir });
-	print H "<td bgcolor=\"$ri->{Colour}\">$ri->{Summary}</td>\n";
+	print H "<td $ri->{ColourAttr}>$ri->{Summary}</td>\n";
 
 	print H "</tr>\n\n";
 	$alternate ^= 1;
sg-report-job-history +1 -2
index 3d02e3f..3aec6a0 100755
@@ -226,7 +226,6 @@ END
         my @last_revs;
         my @alt_revs= ('0')x $#rev_grid_cols;
         foreach my $r (@test_rows) {
-            my $colour= "bgcolor=\"$r->{Colour}\"";
             my $altcolour= report_altcolour($alternate);
             print H "<tr $altcolour>";
 	    my $started = $r->{Flight}{started};
@@ -238,7 +237,7 @@ END
             print H "<td><a href=\"$url\">$flt</a></td>\n";
             print H "<td>".encode_entities($r->{Flight}{branch})."</td>\n";
             $url= "$c{ReportHtmlPubBaseUrl}/$flt/".encode_entities($j)."/";
-            print H "<td $colour><a href=\"$url\">".
+            print H "<td $r->{ColourAttr}><a href=\"$url\">".
                 encode_entities($r->{Summary})."</a></td>\n";
             my $lastrev;
             my $hosts = join ", ", map { $_ // "-" } @{ $r->{Hosts} };
Signature · 1 line
1.7.10.4
#13 lore raw

PATCH v2 10/14 Reporting: report_run_getinfo produces Content

In reply to Ian Jackson

Previously we produced Summary, and the call sites were confused about whether it had already been html-escaped. Now we produce something which is explicitly already html.

No functional change except that some sg-report-host-history output is escaped as it ought to have been (but this is only relevant if the database contains strange things which none of ours do).

---
 Osstest/Executive.pm   |    3 ++-
 sg-report-host-history |    2 +-
 sg-report-job-history  |    2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)
Osstest/Executive.pm +2 -1
index a45ec59..eb01fd1 100644
@@ -32,6 +32,7 @@ use IO::Handle;
 use JSON;
 use File::Basename;
 use IO::Socket::INET;
+use HTML::Entities;
 #use Data::Dumper;
 
 use Osstest;
@@ -206,7 +207,7 @@ sub report_run_getinfo ($) {
     my $single = sub {
 	my ($summary, $colour) = @_;
 	return {
-	    Summary => $summary,
+	    Content => encode_entities($summary),
 	    ColourAttr => "bgcolor=\"$colour\"",
 	};
     };
sg-report-host-history +1 -1
index dc150af..f33fafa 100755
@@ -248,7 +248,7 @@ END
 	print H "<td><a href=\"$url\">$jr->{job}</td>\n";
 
 	my $ri = report_run_getinfo({ %$jr, %$ir });
-	print H "<td $ri->{ColourAttr}>$ri->{Summary}</td>\n";
+	print H "<td $ri->{ColourAttr}>$ri->{Content}</td>\n";
 
 	print H "</tr>\n\n";
 	$alternate ^= 1;
sg-report-job-history +1 -1
index 3aec6a0..31b8d37 100755
@@ -238,7 +238,7 @@ END
             print H "<td>".encode_entities($r->{Flight}{branch})."</td>\n";
             $url= "$c{ReportHtmlPubBaseUrl}/$flt/".encode_entities($j)."/";
             print H "<td $r->{ColourAttr}><a href=\"$url\">".
-                encode_entities($r->{Summary})."</a></td>\n";
+                $r->{Content}."</a></td>\n";
             my $lastrev;
             my $hosts = join ", ", map { $_ // "-" } @{ $r->{Hosts} };
             print H "<td>".encode_entities($hosts)."</td>\n";
Signature · 1 line
1.7.10.4
#14 lore raw

PATCH v2 11/14 Reporting: Break out report_blessingscond

In reply to Ian Jackson

The returned SQL is a self-contained expression, and does not require additional bind parameters. To spot SQL quoting problems, we die if a blessing is not reasonable.

The use sites of the $blessingcond in sg-report-flight are adjusted to no longer pass @blessings to execute.

No overall functional change with reasonable blessings.

---
 Osstest/Executive.pm |   13 +++++++++++++
 sg-report-flight     |   10 +++-------
 2 files changed, 16 insertions(+), 7 deletions(-)
Osstest/Executive.pm +13 -0
index eb01fd1..b757618 100644
@@ -47,6 +47,7 @@ BEGIN {
     @EXPORT      = qw(get_harness_rev grabrepolock_reexec
                       findtask @all_lock_tables
                       report_run_getinfo report_altcolour
+                      report_blessingscond
                       tcpconnect_queuedaemon plan_search
                       alloc_resources alloc_resources_rollback_begin_work
                       resource_check_allocated resource_shared_mark_ready
@@ -246,6 +247,18 @@ sub report_altcolour ($) {
     return "bgcolor=\"#".(qw(d0d0d0 ffffff))[$bool]."\"";
 }
 
+sub report_blessingscond ($$) {
+    my ($blessings, $maxflight) = @_;
+    my $blessingscond= '('.join(' OR ', map {
+	die if m/[^-_.0-9a-z]/;
+	"blessing='$_'"
+				} @$blessings).')';
+    if (defined $maxflight) {
+	$blessingscond= "( flight <= $maxflight AND $blessingscond )";
+    }
+    return $blessingscond;
+}
+
 #---------- host (and other resource) allocation ----------
 
 our $taskid;
sg-report-flight +3 -7
index ebb9281..3c360e5 100755
@@ -127,11 +127,7 @@ our $cw= 79;
 our $tl= 20;
 our $htmlleaf= "info.html";
 
-our $blessingscond= '('.join(' OR ', map { "blessing=?" } @blessings).')';
-
-if (defined $maxflight) {
-    $blessingscond= "( flight <= $maxflight AND $blessingscond )";
-}
+our $blessingscond= report_blessingscond(\@blessings, $maxflight);
 
 sub displayflightnum ($) {
     my ($flight) = @_;
@@ -202,7 +198,7 @@ END
       ORDER BY blessing ASC, flight DESC
 END
     $flightsq= db_prepare($flightsq);
-    $flightsq->execute(@flightsq_params, @blessings);
+    $flightsq->execute(@flightsq_params);
 
     my $buildflightsq= db_prepare(<<END);
         SELECT val FROM runvars
@@ -691,7 +687,7 @@ END
             next;
         }
 
-        $anypassq->execute($j->{job}, $s->{testid}, @blessings);
+        $anypassq->execute($j->{job}, $s->{testid});
         if (!$anypassq->fetchrow_hashref()) {
             print MRO "never-passed $j->{job} $s->{testid} $st\n";
             print DEBUG " never passed\n";
Signature · 1 line
1.7.10.4
#15 lore raw

PATCH v2 12/14 Reporting: In history tables, show multiple failure steps

In reply to Ian Jackson

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

---
v2: Remove unnecessary space in ColourAttr

---
 Osstest/Executive.pm |   32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)
Osstest/Executive.pm +22 -10
index b757618..87f2e98 100644
@@ -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 {
Signature · 1 line
1.7.10.4
#16 lore raw

PATCH v2 13/14 Reporting: Provide report_find_push_age_info

In reply to Ian Jackson

This utility function provides information about how far behind the push gate is right now.

I have tested it with this rune in the Cambridge instance:

perl -we 'use Osstest::Executive; use Osstest; use Data::Dumper; open DEBUG, ">&STDERR" or die $!; csreadconfig(); print Dumper report_find_push_age_info([qw(real)], undef, [qw(osstest linux-next)], "osstest", "280a18b2b2612174e473a1c1a137ddd47c49aab9", "cc8b79ce9586d2b0fbddbd4260e876eab1d408d4")'

Currently it produces this output:

$VAR1 = {
          'CountTip' => '4',
          'FirstTip' => {
                          'flight' => 37635,
                          'intended' => 'real',
                          'blessing' => 'real',
                          'started' => 1435460756,
                          'branch' => 'osstest'
                        },
          'LastTip' => {
                         'flight' => 37638,
                         'intended' => 'real',
                         'blessing' => 'real',
                         'started' => 1435538150,
                         'branch' => 'osstest'
                       },
          'Basis' => {
                       'flight' => 37629,
                       'intended' => 'real',
                       'blessing' => 'real',
                       'started' => 1435181770,
                       'branch' => 'osstest'
                     },
          'FirstAfterBasis' => {
                                 'flight' => 37630,
                                 'intended' => 'real',
                                 'blessing' => 'real',
                                 'started' => 1435314944,
                                 'branch' => 'osstest'
                               },
          'CountAfterBasis' => '9'
        };
---
 Osstest/Executive.pm |  142 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 141 insertions(+), 1 deletion(-)
Osstest/Executive.pm +141 -1
index 87f2e98..4c470bd 100644
@@ -47,7 +47,7 @@ BEGIN {
     @EXPORT      = qw(get_harness_rev grabrepolock_reexec
                       findtask @all_lock_tables
                       report_run_getinfo report_altcolour
-                      report_blessingscond
+                      report_blessingscond report_find_push_age_info
                       tcpconnect_queuedaemon plan_search
                       alloc_resources alloc_resources_rollback_begin_work
                       resource_check_allocated resource_shared_mark_ready
@@ -271,6 +271,146 @@ sub report_blessingscond ($$) {
     return $blessingscond;
 }
 
+sub report__find_test ($$$$$$$$) {
+    my ($blessings, $maxflight, $branches, $tree,
+	$revision, $selection, $extracond, $sortlimit) = @_;
+    # Reports information about a flight which tried to test $revision
+    # of $tree.  ($revision may be undef);
+
+    my @params;
+
+    my $querytext = <<END;
+        SELECT $selection
+	 FROM flights f
+	WHERE
+END
+
+    if (defined $revision) {
+	if ($tree eq 'osstest') {
+	    $querytext .= <<END;
+		EXISTS (
+		   SELECT 1
+		    FROM flights_harness_touched t
+		   WHERE t.harness=?
+		     AND t.flight=f.flight
+		 )
+END
+            push @params, $revision;
+	} else {
+	    $querytext .= <<END;
+		EXISTS (
+		   SELECT 1
+		    FROM runvars
+		   WHERE name=?
+		     AND val=?
+		     AND r.flight=f.flight
+		 )
+END
+            push @params, "revision_$tree", $revision;
+        }
+    } else {
+	$querytext .= <<END;
+	    TRUE
+END
+    }
+
+    my $blessingscond = report_blessingscond($blessings,$maxflight);
+    $querytext .= <<END;
+	  AND $blessingscond
+END
+
+    my $branchescond = join ' OR ', map { "branch=?" } @$branches;
+    $querytext .= <<END;
+	  AND ($branchescond)
+END
+    push @params, @$branches;
+
+    $querytext .= $extracond;
+    $querytext .= $sortlimit;
+
+    my $query = db_prepare($querytext);
+    $query->execute(@params);
+
+    my $row = $query->fetchrow_hashref();
+    $query->finish();
+    return $row;
+}
+
+sub report_find_push_age_info ($$$$$$) {
+    my ($blessings, $maxflight, $branches, $tree,
+	$basis_revision, $tip_revision) = @_;
+    # Reports information about tests of $tree.
+    # (Subject to @$blessings, $maxflight, @$branches)
+    # Returns {
+    #    Basis           =>  row for last test of basis
+    #    FirstAfterBasis =>  row for first test after basis
+    #    FirstTip        =>  row for first test of tip (after Basis)
+    #    LastTip         =>  row for last test of tip (after Basis)
+    #    CountAfterBasis =>  count of runs strictly after Basis
+    #    CountTip        =>  count of runs on Tip
+    #  }
+    # where
+    #  row for ... is from fetchrow_hashref of SELECT * FROM flights
+    #                 (or undef if no such thing exists)
+    #  Count       is a scalar integer.
+    #
+    # Only flights which specified the exact revision specified
+    # are considered (not ones which specified a tag, for example).
+
+    my $findtest = sub {
+	my ($revision,$selection,$extracond,$sortlimit) = @_;
+	report__find_test($blessings,$maxflight,$branches,$tree,
+			 $revision,$selection,$extracond,$sortlimit);
+    };
+
+    my $findcount = sub {
+	my ($revision,$extracond,$sortlimit) = @_;
+	my $row = $findtest->($revision, 'COUNT(*) AS count',
+			      $extracond, $sortlimit);
+	return $row->{count} // die "$revision $extracond $sortlimit ?";
+    };
+
+    my $out = { };
+    $out->{Basis} = $findtest->($basis_revision, '*', '', <<END);
+        ORDER BY flight DESC
+        LIMIT 1
+END
+
+    my $afterbasis = $out->{Basis} ? <<END : '';
+        AND flight > $out->{Basis}{flight}
+END
+
+    $out->{FirstAfterBasis} = $findtest->(undef, '*', $afterbasis, <<END)
+        ORDER BY flight ASC
+	LIMIT 1
+END
+        if $afterbasis;
+
+    $out->{FirstTip} = $findtest->($tip_revision, '*', $afterbasis, <<END);
+        ORDER BY flight ASC
+        LIMIT 1
+END
+
+    my $likelytip = $out->{FirstTip} ? <<END : '';
+        AND flight >= $out->{FirstTip}{flight}
+END
+
+    $out->{LastTip} = $findtest->($tip_revision, '*', $likelytip, <<END)
+        ORDER BY flight DESC
+        LIMIT 1
+END
+        if $out->{FirstTip};
+
+    $out->{CountAfterBasis} = $findcount->(undef, $afterbasis, '')
+        if $afterbasis;
+
+    $out->{CountTip} =
+	$out->{FirstTip} ? $findcount->($tip_revision, $likelytip, '')
+	: 0;
+
+    return $out;
+}
+
 #---------- host (and other resource) allocation ----------
 
 our $taskid;
Signature · 1 line
1.7.10.4
#17 lore raw

PATCH v2 14/14 Reporting: sg-report-flight: Put overall pushgate stats in email

In reply to Ian Jackson

This adds something like this (would have appeared in 37638):

  Last test of basis    37629  2015-06-24 21:36:10 Z    4 days
  Failing since         37630  2015-06-26 10:35:44 Z    3 days    9 attempts
  Testing same since    37635  2015-06-28 03:05:56 Z    1 days    4 attempts

or this (would have appeared in 37629):

  Last test of basis    37617  2015-06-20 04:06:01 Z    9 days
  Testing same since    37628  2015-06-24 13:35:23 Z    5 days    2 attempts

(Both examples from the Cambridge instance.)

This is added just after the versions are reported.

---
v2: Swap order of Failing since' and Testing same since' output lines

---
 sg-report-flight |   41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
sg-report-flight +41 -0
index 3c360e5..22a82ff 100755
@@ -499,6 +499,45 @@ sub printversions ($) {
     }
 }
 
+sub print_pushgate_summary () {
+    my @thistree = sort keys %{ $specver{'this'} };
+    my @thattree = sort keys %{ $specver{'that'} };
+    if (!(@thistree==1 && @thattree==1 && $thistree[0] eq $thattree[0])) {
+	print DEBUG "NO PUSHGATE SUMMARY (@thistree) != (@thattree)";
+    }
+    my $tree = $thistree[0];
+
+    my $info = report_find_push_age_info(
+	[ $blessings[0] ], $maxflight, [ $branch ],
+	$tree, $specver{that}{$tree}, $specver{this}{$tree}
+	);
+    print "\n";
+    my $now = time;
+    my $pinfo = sub {
+	my ($what, $flightkey, $countkey) = @_;
+	my $f = $info->{$flightkey};
+	my $count = $info->{$countkey};
+	printf "%-20s", $what;
+	if ($f) {
+	    printf(" %6d  %s %4d days",
+		   $f->{flight},
+		   show_abs_time($f->{started}),
+		   floor(($now - $f->{started}) / 86400));
+	} else {
+	    printf(" %34s     ","(not found)");
+	}
+	if (defined $count) {
+	    printf(" %4d attempts", $count);
+	}
+	print "\n";
+    };
+    $pinfo->('Last test of basis', "Basis",'');
+    $pinfo->('Failing since', "FirstAfterBasis","CountAfterBasis")
+        unless ($info->{FirstAfterBasis}{flight} // 'NONE')
+	    eq ($info->{FirstTip}{flight}        // 'NONE');
+    $pinfo->('Testing same since', "FirstTip","CountTip");
+}
+
 sub printout {
     my ($r, @failures) = @_;
     print <<END or die $!;
@@ -579,6 +618,8 @@ END
         printversions('that');
     }
 
+    print_pushgate_summary();
+
     if (@includefiles) {
         print "\n","-"x60, "\n" or die $!;
     }
Signature · 1 line
1.7.10.4
Acked-by on v2 14/14
#18 lore raw

Re: [OSSTEST PATCH 14/14] Reporting: sg-report-flight: Put overall pushgate stats in email

Quoted 8 lines · Ian Jackson

This adds something like this (would have appeared in 37638):

  Last test of basis    37629  2015-06-24 21:36:10 Z    4 days
  Failing since         37630  2015-06-26 10:35:44 Z    3 days    9 attempts
  Testing same since    37635  2015-06-28 03:05:56 Z    1 days    4 attempts

or this (would have appeared in 37629):

Quoted 8 lines
  Last test of basis    37617  2015-06-20 04:06:01 Z    9 days
  Testing same since    37628  2015-06-24 13:35:23 Z    5 days    2 attempts

(Both examples from the Cambridge instance.)

This is added just after the versions are reported.

#19 lore raw

Re: [OSSTEST PATCH 14/14] Reporting: sg-report-flight: Put overall pushgate stats in email

In reply to Ian Jackson

Ian Jackson writes ("[OSSTEST PATCH 14/14] Reporting: sg-report-flight: Put overall pushgate stats in email"):

Quoted 1 line

This adds something like this (would have appeared in 37638):

...

BTW I found a bug in this:

sg-report-flight sub printversions ($) { · line 507

Quoted 6 lines
sg-report-flight +6 -0
+sub print_pushgate_summary () {
+    my @thistree = sort keys %{ $specver{'this'} };
+    my @thattree = sort keys %{ $specver{'that'} };
+    if (!(@thistree==1 && @thattree==1 && $thistree[0] eq $thattree[0])) {
+	print DEBUG "NO PUSHGATE SUMMARY (@thistree) != (@thattree)";
+    }

Missing `return' after the print. I will fix it.

Ian.