capture some syslog output
v2 cover capture some syslog output
I discovered that the previous version of this series didn't work because in host examination jobs it started the syslog server before host allocation. This is a bug. It's detected, in a roundabout way, by sg-report-flight:
sg-report-flight requires that the testid rows in its output can be topologically sorted by stepno; this is necessary so that when testids from differnt jobs are combined into output rows, the order of steps within a job is preserved. Otherwise the results would be misleading.
To fix this involved some refactoring of sg-run-job. While I was there I did some other tidying up.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v2 1/15 mg-repro-setup: Use new syntax for cs-adjust-flight
In 497b2c6c933d "Rework runvar-build-set new value handling" we fixed bugs in cs-adjust-flight which would make mg-repro-setup's attempt to adjust build jobs sometimes not match at all, but we also changed the syntax for specifying just a new flight. I forgot to update the one in-tree user of that feature.
--- mg-repro-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mg-repro-setup +1 -1
@@ -199,7 +199,7 @@ if $skipcapture; then adjrunvar skip_testids "capture-logs*"; fi ./cs-adjust-flight $flight \ copy-jobs $example_flight $job \ - runvar-build-set . '/buildjob$' "^$flight\\." $example_flight \ + runvar-build-set . '/buildjob$' "^$flight\\." $example_flight. \ "${adjusts[@]}" progress "executing ..."
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 2/15 TestSupport: Provide controller_ipaddr
In reply to Ian Jackson--- Osstest/TestSupport.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
Osstest/TestSupport.pm +10 -1
@@ -92,7 +92,7 @@ BEGIN { git_massage_url sshopts authorized_keys - cfg_tftp_di_version + cfg_tftp_di_version controller_ipaddr remote_perl_script_open remote_perl_script_done host_reboot target_reboot target_reboot_hard target_choose_vg target_umount_lv target_await_down
@@ -2401,6 +2401,15 @@ sub cfg_tftp_di_version ($) { return $c{"TftpDiVersion_$suite"} // $c{TftpDiVersion}; } +sub controller_ipaddr () { + my $addr = $c{ControllerIpAddress}; + return $addr if defined $addr; + $?=$!=0; my $hn = `hostname -f` // die "$? $!"; + chomp $hn; + my $ip = gethostbyname($hn) // die "$hn ?"; + return inet_ntoa($ip); +} + #---------- webspace for installer ---------- sub await_webspace_fetch_byleaf ($$$$$) {
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 3/15 ts-syslog-server: New test script
In reply to Ian JacksonThis is a "complete implementation of the UDP syslog protocol".
In fact, the UDP syslog protocol is trivial: the UDP packets contain newline-terminated unix text strings. We can simply chomp them and log them (along with the sending address and port).
This script is designed to be run with the new "|" spawn-ts mode: it will keep running until it is reaped.
Currently it is not part of any jobs.
--- ts-syslog-server | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 ts-syslog-server
ts-syslog-server new file +85 -0
@@ -0,0 +1,85 @@ +#!/usr/bin/perl -w +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2009-2013 Citrix Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +use strict; + +unshift @INC, qw(.); +use Osstest; +use Osstest::TestSupport; + +use POSIX; +use Fcntl; +use Socket qw(PF_INET SOCK_DGRAM INADDR_ANY + pack_sockaddr_in unpack_sockaddr_in inet_aton inet_ntoa); + +tsreadconfig(); + +die if @ARGV && $ARGV[0] =~ m/^-/; + +logm("starting syslog server ..."); + +socket S, PF_INET, SOCK_DGRAM, 0 or die $!; + +my $sockname = pack_sockaddr_in(0, inet_aton(controller_ipaddr())); +bind S, $sockname or die $!; +$sockname = getsockname S or die $!; +my ($port,$myaddr) = unpack_sockaddr_in($sockname) or die $!; +$myaddr = inet_ntoa($myaddr); + +store_runvar('syslog_server',"$myaddr:$port"); + +my @fhs = qw(S STDIN); + +foreach my $fh (@fhs) { + my $fl = fcntl($fh, F_GETFL, 0) // die $!; + fcntl($fh, F_SETFL, $fl | O_NONBLOCK) // die $!; +} + +logm("syslog server running on $myaddr:$port"); + +for (;;) { + my $rfds = ''; + foreach my $fh (@fhs) { + vec($rfds, fileno($fh), 1) = 1; + } + my $efds = $rfds; + select($rfds, undef, $efds, undef); + if (vec($rfds, fileno(STDIN), 1)) { + my $d; + my $r = sysread STDIN, $d, 1; + if (defined $r) { + die "read something from stdin!" if $r>0; + last; + } else { + die $! unless $!==EAGAIN || $!==EWOULDBLOCK; + } + } + if (vec($rfds, fileno(S), 1)) { + my $d; + my $sender = recv S, $d, 1024, 0; + if (defined $sender) { + my ($sport,$saddr) = unpack_sockaddr_in($sender) or die $!; + $saddr = inet_ntoa($saddr) // die $!; + chomp $d; + logm("$saddr:$sport $d"); + } else { + die $! unless $!==EAGAIN || $!==EWOULDBLOCK; + } + } +} + +logm("stopping.");
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 4/15 sg-run-job: Document run-ts and spawn-ts argument syntaxes
In reply to Ian Jackson---
v2: More accurate explanation of ! in IFFAIL; and mention $ok.
--- sg-run-job | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+)
sg-run-job +97 -0
@@ -146,6 +146,103 @@ proc testid_matches_globs {testid globs} { #---------- test script handling ---------- +# spwan-ts IFFAIL TESTID SCRIPT-ARGS... +# +# Spawns the test script as a test step, and leaves it running. +# Returns token to pass to reap-ts. +# +# reap-ts TOKEN [WANTSTATUS] +# +# Waits for the test script to finish. +# +# The step status is set to "pass" (if the script exits zero) or +# IFFAIL (otherwise). (But it is not set if the script, +# or something else, already set it to "aborted" or "broken".) +# +# Return value is true if that step status matches the glob +# WANTSTATUS (which defaults to "pass"). Test failures do not +# become Tcl exceptions and do not affect other test execution. +# +# run-ts IFFAIL TESTID SCRIPT-ARGS... +# +# Runs the test script, waiting for it to finish. +# The step status is set as for reap-ts. +# +# If that step status is not "pass", throws a Tcl exception. +# +# Normally (eg, within the recipe), an exception causes the job +# to be stopped as a failure (and proceed to log collection). +# Specifically: +# "ok" is set to "0" (which prevents most other +# general steps from running) +# The job status is set to IFFAIL. +# +# per-host-ts IFFAIL TESTID SCRIPT-ARGS... +# +# Runs the script (as a separate step) for each test host ident. +# The host ident is appended to SCRIPT-ARGS. (SCRIPT-ARGS +# should contain an even number of + items for proper testid +# generation.) +# +# The scripts are run in parallel for all host idents. +# +# If any of the step statuses is not "pass", sets the job +# status to IFFAIL and stops the job as a failure (as above). +# +# per-host-ts does nothing if the job is no longer $ok +# (subject to IFFAIL starting with !, see below) +# +# IFFAIL can be +# +# [-][!]. +# [-][!]STATUS +# +# where STATUS is the job/step status to be used if the step +# status is not as expected, and the special meanings are: +# +# - Only for run-ts; suprresses exception on failure. +# ! Run this even if the job is being truncated. +# (for per-host-ts, even if the job is no longer $ok) +# . Shorthand for "fail" +# +# TESTID specifies the unique ID for this test step. +# +# The testid must be unique within the job; but for steps which +# actual tests (ie, which might be subject to regression +# analsysis, or bisection) must be stable - ie, it must not +# change due to races nor due to future osstest changes. +# Normally this is acheived by computing it from the +# SCRIPT-ARGS by specifying something involving "=" or "/@". +# +# TESTID is processed with some substitutions (in this order): +# +# = at the start is replaced with "SCRIPTBASIS/@" +# where SCRIPTBASIS is the first entry in SCRIPT-ARGS +# with ts- removed. +# +# * as the whole TESTID is replaced with "SCRIPTBASIS/@(*)" +# +# /@ anywhere is replaced with "/ARG/ARG..." +# (ie, "/ARG" for each ARG in SCRIPT-ARGS after the +# script name, but see note about "+" in SCRIPT-ARGS, +# below.) +# +# (*) at the end is replaced by (STEPNO) +# where STEPNO is the step number within the job (which +# is unique within the job, but not stable). +# +# SCRIPT-ARGS is the script name and its arguments, but is also +# subject to some special processing: +# +# The script name should not include the ./ which is necessary +# to find the script in the current directory. This will be +# added implicitly. +# +# An argument which is precisely "+" toggles whether the +# subsequent items in SCRIPT-ARGS are added to the expansion of +# /@ in TESTID. (The "+" itself is not added to the arguments +# or the testid.) + proc run-ts {iffail args} { set wantstatus pass if {[regsub {^-} $iffail {} iffail]} { set wantstatus * }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 5/15 sg-run-job: Support scripts which need to be told when to quit
In reply to Ian JacksonWe give them a pipe on stdin, whose writing end we close when we want to reap them.
--- sg-run-job | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
sg-run-job +17 -2
@@ -238,6 +238,11 @@ proc testid_matches_globs {testid globs} { # to find the script in the current directory. This will be # added implicitly. # +# If the very first item is "|" (before the script name), the +# script will get a pipe as its standard input rather than +# /dev/null; this pipe will give EOF when sg-run-job wants to +# end the script (ie, when reap-ts is called). +# # An argument which is precisely "+" toggles whether the # subsequent items in SCRIPT-ARGS are added to the expansion of # /@ in TESTID. (The "+" itself is not added to the arguments
@@ -293,6 +298,12 @@ proc spawn-ts {iffail testid args} { set real_args {} set adding 1 set testid_args {} + set child_pipe_mode r + + if {![string compare | [lindex $args 0]]} { + set child_pipe_mode w + lshift args + } foreach arg $args { if {![string compare + $arg]} { set adding [expr {!$adding}]
@@ -339,12 +350,16 @@ proc spawn-ts {iffail testid args} { if {[var-or-default env(OSSTEST_SIMULATE) 0]} { set xprefix echo } set log [jobdb::step-log-filename $flight $jobinfo(job) $stepno $ts] - set redirects {< /dev/null} + set redirects {} if {[string length $log]} { lappend redirects 2> $log } else { lappend redirects 2>@ stderr } + switch -exact $child_pipe_mode { + r { lappend redirects < /dev/null } + w { lappend redirects >@ stderr } + } set cmd [concat \ [list sh -xc "
@@ -357,7 +372,7 @@ proc spawn-ts {iffail testid args} { exit \$rc " x $testid ./$ts] \ $real_args $redirects] - set fh [open |$cmd r] + set fh [open |$cmd $child_pipe_mode] return [list fh $fh $details] }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 6/15 sg-run-job: Execute prep-job/RECIPE if it exists
In reply to Ian JacksonThis allows a job to do its own host allocation, for example.
---
v2: New patch
--- sg-run-job | 3 +++ 1 file changed, 3 insertions(+)
sg-run-job +3 -0
@@ -73,6 +73,9 @@ proc run-job {job} { if {$ok} { setstatus running } + if {$ok && ![catch { info args prep-job/$jobinfo(recipe) }]} \ + { catching-otherwise fail prep-job/$jobinfo(recipe) } + per-host-ts broken host-install/@(*) ts-host-install-twice per-host-prep
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 7/15 sg-run-job: examination: Style improvement
In reply to Ian JacksonThis is going to make things a bit clearer.
Whitespace change only.
--- sg-run-job | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
sg-run-job +2 -6
@@ -647,14 +647,10 @@ proc examine-host-examine {install} { } proc need-hosts/host-examine-xen {} { return {} } -proc run-job/host-examine-xen {} { - examine-host-examine xen -} +proc run-job/host-examine-xen {} { examine-host-examine xen } proc need-hosts/host-examine-linux {} { return {} } -proc need-hosts/host-examine-linux {} { - examine-host-examine debian -} +proc need-hosts/host-examine-linux {} { examine-host-examine debian } #---------- builds ----------
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 8/15 sg-run-job: examination: Run host install in prep
In reply to Ian JacksonWe want to run this in prep, so that we can start the syslogd after this.
--- sg-run-job | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sg-run-job +5 -1
@@ -622,8 +622,10 @@ if {[file exists sg-run-job-adhoc]} { #---------- host examination recipes ---------- -proc examine-host-install-debian {} { +proc examine-host-prep {} { run-ts broken = ts-hosts-allocate + host +} +proc examine-host-install-debian {} { run-ts broken host-install ts-host-install-twice + host } proc examine-host-install-xen {} {
@@ -647,9 +649,11 @@ proc examine-host-examine {install} { } proc need-hosts/host-examine-xen {} { return {} } +proc prep-job/host-examine-xen {} { examine-host-prep } proc run-job/host-examine-xen {} { examine-host-examine xen } proc need-hosts/host-examine-linux {} { return {} } +proc prep-job/host-examine-xen {} { examine-host-prep } proc need-hosts/host-examine-linux {} { examine-host-examine debian } #---------- builds ----------
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 9/15 sg-run-job: Break out allocate-build-host, and reorder
In reply to Ian JacksonWe're going to want to start the syslog server after host allocation but before installation, so we need to split these steps up.
A side effect is that a build job becomes `running' when it starts its host install, not when it starts the actual build.
---
v2: New patch
--- sg-run-job | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sg-run-job +8 -2
@@ -69,13 +69,16 @@ proc run-job {job} { eval run-ts broken = ts-hosts-allocate + $need_xen_hosts } - if {$need_build_host} { catching-otherwise broken prepare-build-host } + if {$need_build_host} { catching-otherwise broken allocate-build-host } if {$ok} { setstatus running } if {$ok && ![catch { info args prep-job/$jobinfo(recipe) }]} \ { catching-otherwise fail prep-job/$jobinfo(recipe) } + if {$ok && $need_build_host} \ + { catching-otherwise broken prepare-build-host } + per-host-ts broken host-install/@(*) ts-host-install-twice per-host-prep
@@ -689,9 +692,12 @@ proc run-job/build-xtf {} { run-ts . = ts-xtf-build } -proc prepare-build-host {} { +proc allocate-build-host {} { global jobinfo run-ts broken = ts-hosts-allocate + host +} +proc prepare-build-host {} { + global jobinfo run-ts broken host-install(*) ts-host-install-twice run-ts . host-build-prep ts-xen-build-prep }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 10/15 sg-run-job: Spawn ts-syslog-server
In reply to Ian JacksonEvery job now gets a syslog server, which starts up after host allocation.
The server's address and port are recorded by ts-syslog-server in a runvar and can be used by subsequent test steps.
---
v2: Change mistaken TESTID .' to ='. .' means literally .'.
Do not start ts-syslog-server if !$ok.
Do not start ts-syslog-server if job is being truncated now. Use new | (stdin pipe) spawn-ts feature; avoids total failure.
--- sg-run-job | 6 ++++++ 1 file changed, 6 insertions(+)
sg-run-job +6 -0
@@ -76,6 +76,8 @@ proc run-job {job} { if {$ok && ![catch { info args prep-job/$jobinfo(recipe) }]} \ { catching-otherwise fail prep-job/$jobinfo(recipe) } + if {$ok} { set syslog [spawn-ts broken = | ts-syslog-server] } + if {$ok && $need_build_host} \ { catching-otherwise broken prepare-build-host }
@@ -99,6 +101,10 @@ proc run-job {job} { run-ts !broken capture-logs ts-logs-capture + host } + if {[info exists syslog]} { + reap-ts $syslog + } + if {$ok} { if {[jobdb::job-check-escaped-steps $flight $job]} { set ok 0
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 11/15 sg-run-job: Make catching-otherwise honour $ok
In reply to Ian JacksonThis is more regular and abolishes a number of explicit $ok tests in run-job.
Of the call sites:
* "catching-otherwise blocked check-not-blocked" near the top of run-job is soon after $ok is set, so NFC.
* The other call sites in run-job all test $ok explicitly, so NFC.
* The one call site outside run-job (in examine-host-examine) contains only calls to run-ts, and to examine-host-install-* which itself only contains similar calls. These all therefore honour $ok already. So NFC.
While we are here:
* Add a doc comment.
* Do some slight whitespace fixups.
Overall, no functional change.
--- sg-run-job | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
sg-run-job +12 -6
@@ -62,7 +62,7 @@ proc run-job {job} { } set nested_layers_hosts {} - catching-otherwise blocked check-not-blocked + catching-otherwise blocked check-not-blocked if {!$ok} return if {[llength $need_xen_hosts]} {
@@ -73,19 +73,18 @@ proc run-job {job} { if {$ok} { setstatus running } - if {$ok && ![catch { info args prep-job/$jobinfo(recipe) }]} \ - { catching-otherwise fail prep-job/$jobinfo(recipe) } + if {![catch { info args prep-job/$jobinfo(recipe) }]} \ + { catching-otherwise fail prep-job/$jobinfo(recipe) } if {$ok} { set syslog [spawn-ts broken = | ts-syslog-server] } - if {$ok && $need_build_host} \ - { catching-otherwise broken prepare-build-host } + if {$need_build_host} { catching-otherwise broken prepare-build-host } per-host-ts broken host-install/@(*) ts-host-install-twice per-host-prep - if {$ok} { catching-otherwise fail run-job/$jobinfo(recipe) } + catching-otherwise fail run-job/$jobinfo(recipe) while 1 { per-host-finish
@@ -126,8 +125,15 @@ proc run-job {job} { } proc catching-otherwise {failst script} { + # Executes $script. + # If job is already a failure (ie not $ok), skips it (ie does nothing). + # If any Tcl exception is thrown, declares the job a failure. + # (ie sets job status to $failst, and sets anyfailed to 1 and ok to 0) + global anyfailed flight jobinfo ok + if {!$ok} return + if {[catch { uplevel 1 $script } emsg]} {
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 12/15 sg-run-job: Abolish `anyfailed'
In reply to Ian JacksonThis is very similar to !$ok.
anyfailed is set to 1 only by catching-otherwise, which also then sets ok to 0. The differences are solely some sites which set ok to 0 without setting anyfailed to 1:
(i) In run-job, if there are escaped steps
(ii) In run-job, if any steps were not run due to the skip_testids
or truncate_testids runvars
job is being truncated due to
(iii) If a per-host-ts step fails
The only places where anyfailed was used were:
* To decide whether to do log capture in build jobs. This happens before (i) and (ii); and (iii) is not applicable because it only applies if $need_xen_hosts is nonempty which is never true if $need_build_host is false. We can simply use $ok instead, without any functional change.
* In printing a message to stdout at the end of the job. We update this use site to use $ok and change the message accordingly.
So overall, no functional change other than to a message in the transcript.
--- sg-run-job | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
sg-run-job +6 -8
@@ -40,13 +40,12 @@ proc per-host-finish {} { } proc run-job {job} { - global jobinfo builds flight ok truncate need_xen_hosts anyfailed + global jobinfo builds flight ok truncate need_xen_hosts global nested_layers_hosts truncate_globs skip_globs anyskipped set ok 1 set truncate 0 set anyskipped 0 - set anyfailed 0 jobdb::prepare $job set truncate_globs [jobdb::read-runvar $flight $job truncate_testids]
@@ -96,7 +95,7 @@ proc run-job {job} { set need_xen_hosts [lunappend nested_layers_hosts] } - if {$need_build_host && $anyfailed} { + if {$need_build_host && !$ok} { run-ts !broken capture-logs ts-logs-capture + host }
@@ -119,8 +118,8 @@ proc run-job {job} { if {$need_build_host && $ok} { jobdb::preserve-task 90 } - if {$anyfailed} { - jobdb::logputs stdout "at least one test failed" + if {!$ok} { + jobdb::logputs stdout "job not ok" } }
@@ -128,9 +127,9 @@ proc catching-otherwise {failst script} { # Executes $script. # If job is already a failure (ie not $ok), skips it (ie does nothing). # If any Tcl exception is thrown, declares the job a failure. - # (ie sets job status to $failst, and sets anyfailed to 1 and ok to 0) + # (ie sets job status to $failst, and sets ok to 0) - global anyfailed flight jobinfo ok + global flight jobinfo ok if {!$ok} return
@@ -139,7 +138,6 @@ proc catching-otherwise {failst script} { } emsg]} { jobdb::logputs stderr "$flight.$jobinfo(job) $script failed: $emsg" set ok 0 - set anyfailed 1 setstatus $failst } }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 13/15 Debian: Pass sylog server details to debian-installer
In reply to Ian JacksonThis logs the installer output, even during a failed install.
--- Osstest/Debian.pm | 5 +++++ 1 file changed, 5 insertions(+)
Osstest/Debian.pm +5 -0
@@ -690,6 +690,11 @@ sub di_installcmdline_core ($$;@) { if defined $debconf_priority; push @cl, "rescue/enable=true" if $xopts{RescueMode}; + if ($r{syslog_server}) { + $r{syslog_server} =~ m/:(\d+)$/ or die "$r{syslog_server} ?"; + push @cl, "log_host=$`", "log_port=$1"; + } + return @cl; }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 14/15 sg-report-flight: Make logfile list into table, with more info
In reply to Ian JacksonAlso print the mtime and the size.
---
v2: New patch.
--- sg-report-flight | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
sg-report-flight +18 -3
@@ -1026,7 +1026,13 @@ END <p> <h2>Logfiles etc.</h2> For main test script logfiles, see entries in steps table. -<ul> +<p> +<table> +<tr> +<th>modified/fetched</th> +<th align="right">size</th> +<th align="left">filename</th> +</tr> END opendir LOGS, "$htmldir/$job" or die "$htmldir/$job $!"; my @dents= sort readdir LOGS;
@@ -1035,14 +1041,23 @@ END next if $dent eq "$htmlleaf.new" or $dent eq $htmlleaf or $dent eq '..' or $dent eq '.' or $issteplog{$dent}; stat("$htmldir/$job/$dent") or die "$dent $!"; - print H "<li><a href=\"".encode_entities(uri_escape($dent))."\">". + printf H "<tr><td>%s</td>", show_abs_time((stat _)[9]); + if (-f _) { + my $size = (stat _)[7]; + printf H "<td align=\"right\"> %s</td>", $size; + } else { + print H "<td align=\"right\">dir</td>"; + } + print H "<td>"; + print H "<a href=\"".encode_entities(uri_escape($dent))."\">". encode_entities($dent).(-d _ ? "/" : "")."</a>\n"; if ($dent eq 'build') { print H " (outputs from build)"; } + print H "</td></tr>\n"; } print H <<END; -</ul> +</table> <h2>Test control variables</h2> <table rules=all><tr><th>Name</th><th>Value</th><th>Source</th></tr> END
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 15/15 sg-run-job: Logfiles: Suppress links to 0-length files
In reply to Ian JacksonThese are not really helpful. Making them not be links makes them easier to skip by eye.
---
v2: New patch.
--- sg-report-flight | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sg-report-flight +6 -2
@@ -1042,15 +1042,19 @@ END or $dent eq '..' or $dent eq '.' or $issteplog{$dent}; stat("$htmldir/$job/$dent") or die "$dent $!"; printf H "<tr><td>%s</td>", show_abs_time((stat _)[9]); + my $nolink = 0; if (-f _) { my $size = (stat _)[7]; printf H "<td align=\"right\"> %s</td>", $size; + $nolink = !$size; } else { print H "<td align=\"right\">dir</td>"; } print H "<td>"; - print H "<a href=\"".encode_entities(uri_escape($dent))."\">". - encode_entities($dent).(-d _ ? "/" : "")."</a>\n"; + print H "<a href=\"".encode_entities(uri_escape($dent))."\">" + unless $nolink; + print H encode_entities($dent).(-d _ ? "/" : ""); + print H "</a>" unless $nolink; if ($dent eq 'build') { print H " (outputs from build)"; }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel