Trivial reporting improvements
cover Trivial reporting improvements
Six tiny patches to make the html output from sg-report-flight better, prompted by looking at the output critically following recent questions.
1/6 show_abs_time: break out from sg-report-flight 2/6 TestSupport: logm: use show_abs_time 3/6 sg-report-flight: mkdir the per-job directories 4/6 sg-report-flight: show the job recipe and 5/6 sg-report-flight: Add some flight information 6/6 sg-report-flight: report when flight finished
I intend to push these when the push gate has a quiet moment, unless anyone objects.
PATCH 1/6 show_abs_time: break out from sg-report-flight
No functional change.
--- Osstest.pm | 7 ++++++- sg-report-flight | 4 +--- 2 files changed, 7 insertions(+), 4 deletions(-)
Osstest.pm +6 -1
@@ -35,7 +35,7 @@ BEGIN { $dbh_tests db_retry db_retry_retry db_retry_abort db_begin_work ensuredir get_filecontents_core_quiet system_checked - nonempty visible_undef + nonempty visible_undef show_abs_time ); %EXPORT_TAGS = ( );
@@ -286,4 +286,9 @@ sub visible_undef ($) { return defined $v ? $v : '<undef>'; } +sub show_abs_time ($) { + my ($timet) = @_; + return strftime "%Y-%m-%d %H:%M:%S Z", gmtime $timet; +} + 1;
sg-report-flight +1 -3
@@ -808,9 +808,7 @@ END encode_entities($st); $issteplog{$logfilename}= 1; - printf H "<td>%s</td>", - encode_entities(strftime "%Y-%m-%d %H:%M:%S Z", - gmtime $step->{started}); + printf H "<td>%s</td>", show_abs_time $step->{started}; if (defined $step->{finished} && defined $step->{started}) { printf H "<td align=right>%d</td>\n",
Signature · 1 line
1.7.10.4
PATCH 2/6 TestSupport: logm: use show_abs_time
In reply to Ian Jackson--- Osstest/TestSupport.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Osstest/TestSupport.pm +1 -3
@@ -175,9 +175,7 @@ sub ts_get_host_guest { # pass this @ARGV sub logm ($) { my ($m) = @_; my @t = gmtime; - my $fm = sprintf "%04d-%02d-%02d %02d:%02d:%02d Z %s\n", - $t[5]+1900,$t[4]+1,$t[3], $t[2],$t[1],$t[0], - $m; + my $fm = (show_abs_time time)." $m\n"; foreach my $h ((ref($logm_handle) eq 'ARRAY') ? @$logm_handle : $logm_handle) { print $h $fm or die $!;
Signature · 1 line
1.7.10.4
PATCH 3/6 sg-report-flight: mkdir the per-job directories
In reply to Ian JacksonThis makes sure the per-job pages always get created.
--- sg-report-flight | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
sg-report-flight +7 -5
@@ -27,6 +27,7 @@ use URI::Escape; use POSIX; use IPC::Open2; use Data::Dumper; +use File::Path; use Osstest; use Osstest::Executive;
@@ -757,11 +758,12 @@ sub htmloutjob ($$) { my ($fi,$job) = @_; return unless defined $htmldir; - my $htmlfile= "$htmldir/$job/$htmlleaf"; - if (!open H, "> $htmlfile.new") { - return if $!==&ENOENT; - die "$htmlfile.new $!"; - } + my $jobhtmldir = "$htmldir/$job"; + mkpath $jobhtmldir; + + my $htmlfile= "$jobhtmldir/$htmlleaf"; + open H, "> $htmlfile.new" or die "$htmlfile.new $!"; + my $title= "Info on flight $fi->{Flight} job $job"; my $branch= $fi->{FlightInfo}{branch};
Signature · 1 line
1.7.10.4
PATCH 4/6 sg-report-flight: show the job recipe and overall status
In reply to Ian Jackson--- sg-report-flight | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sg-report-flight +13 -0
@@ -767,6 +767,13 @@ sub htmloutjob ($$) { my $title= "Info on flight $fi->{Flight} job $job"; my $branch= $fi->{FlightInfo}{branch}; + our $htmlout_jobq ||= $dbh_tests->prepare(<<END); + SELECT * FROM jobs WHERE flight = ? AND job = ? +END + $htmlout_jobq->execute($fi->{Flight}, $job); + my $ji = $htmlout_jobq->fetchrow_hashref(); + die unless $ji; + print H <<END; <html><head><title>$title</title><head> <body>
@@ -822,6 +829,12 @@ END print H <<END; </table> +<h2>Job</h2> +<table> +<tr><td>Recipe:</td><td>$ji->{recipe}</td></tr> +<tr><td>Status:</td><td>$ji->{status}</td></tr> +</table> +<p> <h2>Logfiles etc.</h2> For main test script logfiles, see entries in steps table. <ul>
Signature · 1 line
1.7.10.4
PATCH 5/6 sg-report-flight: Add some flight information
In reply to Ian Jackson--- sg-report-flight | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
sg-report-flight +26 -1
@@ -994,7 +994,7 @@ END } my @vercols= sort keys %vercols; if (@vercols) { - print H "<h2>targeted versions</h2>\n"; + print H "<h2>Targeted versions</h2>\n"; print H "<table rules=all>"; print H "<tr><td></td>"; print H "<th>".encode_entities($_)."</th>" foreach @vercols;
@@ -1012,6 +1012,31 @@ END } print H "</table>"; } + my $started_str = show_abs_time $fi->{FlightInfo}{started}; + + print H <<END; +<h2>Flight information</h2> +<table> +<tr> +<td>"Branch":</td><td>$fi->{FlightInfo}{branch}</td></tr> +<td>Intended blessing:</td><td>$fi->{FlightInfo}{intended}</td></tr> +<td>Blessing:</td><td>$fi->{FlightInfo}{blessing}</td></tr> +<td>Started:</td><td>$started_str</td></tr> +<td>Test harness revision(s):</td><td> +END + + our $htmlout_touchedq ||= $dbh_tests->prepare(<<END); + SELECT harness FROM flights_harness_touched WHERE flight=? +END + $htmlout_touchedq->execute($fi->{Flight}); + while (my ($touched) = $htmlout_touchedq->fetchrow_array()) { + print H $touched, "\n"; + } + + print H <<END; +</td></tr> +</table> +END print H "</body></html>"; H->error and die $!; close H or die $!;
Signature · 1 line
1.7.10.4
PATCH 6/6 sg-report-flight: report when flight finished
In reply to Ian Jackson--- sg-report-flight | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sg-report-flight +13 -0
@@ -1014,6 +1014,18 @@ END } my $started_str = show_abs_time $fi->{FlightInfo}{started}; + our $htmlout_finishedq ||= $dbh_tests->prepare(<<END); + SELECT + (SELECT max(finished) FROM steps WHERE flight=?) max, + (SELECT count(*) FROM steps WHERE finished IS NULL AND flight=?) unfinished +END + $htmlout_finishedq->execute($fi->{Flight}, $fi->{Flight}); + my $frow = $htmlout_finishedq->fetchrow_hashref(); + my $finished_str = + $frow->{unfinished} ? "($frow->{unfinished} unfinished steps)" : + !$frow->{max} ? "(no steps)" : + show_abs_time($frow->{max}); + print H <<END; <h2>Flight information</h2> <table>
@@ -1022,6 +1034,7 @@ END <td>Intended blessing:</td><td>$fi->{FlightInfo}{intended}</td></tr> <td>Blessing:</td><td>$fi->{FlightInfo}{blessing}</td></tr> <td>Started:</td><td>$started_str</td></tr> +<td>Finished:</td><td>$finished_str</td></tr> <td>Test harness revision(s):</td><td> END
Signature · 1 line
1.7.10.4
Quoted 11 lines · Ian Jackson
Six tiny patches to make the html output from sg-report-flight better, prompted by looking at the output critically following recent questions.
1/6
show_abs_time: break out from sg-report-flight 2/6 TestSupport: logm: useshow_abs_time3/6 sg-report-flight: mkdir the per-job directories 4/6 sg-report-flight: show the job recipe and 5/6 sg-report-flight: Add some flight information 6/6 sg-report-flight: report when flight finished
Quoted 2 lines
I intend to push these when the push gate has a quiet moment, unless anyone objects.
Looks good to me.
One small query: #5/6 reports "Test harness revision(s)" -- can there really be multiple for a given flight? I thought the per-branch repo was only updated at the start of the flight?
Ian.
Ian Campbell writes ("Re: [OSSTEST PATCH 0/6] Trivial reporting improvements"):
Quoted 3 lines
One small query: #5/6 reports "Test harness revision(s)" -- can there really be multiple for a given flight? I thought the per-branch repo was only updated at the start of the flight?
There's not supposed to be for production flights.
But that database table is updated (when using Osstest::JobDB::Executive) by dbfl_check, which is called numerous times including from tsreadconfig(), at the start of each ts-* script.
To avoid having to record lies in the database when running tests by hand etc., the database table (flights_harness_touched) can record multiple versions of osstest.git which have touched the flight. ("+" is appended if the working tree is dirty.)
It's obviously better that sg-report-flight should report such situations accurately, even if they are abnormal.
Ian.
Quoted 11 lines · Ian Jackson
Ian Campbell writes ("Re: [OSSTEST PATCH 0/6] Trivial reporting improvements"):
Quoted 3 lines
One small query: #5/6 reports "Test harness revision(s)" -- can there really be multiple for a given flight? I thought the per-branch repo was only updated at the start of the flight?
There's not supposed to be for production flights.
But that database table is updated (when using
Osstest::JobDB::Executive) bydbfl_check, which is called numerous times including fromtsreadconfig(), at the start of each ts-* script.
Quoted 7 lines
To avoid having to record lies in the database when running tests by hand etc., the database table (
flights_harness_touched) can record multiple versions of osstest.git which have touched the flight. ("+" is appended if the working tree is dirty.)It's obviously better that sg-report-flight should report such situations accurately, even if they are abnormal.
Makes sense! Thanks.