From: Ian Jackson Subject: [OSSTEST PATCH 4/7] logm: Introduce $logm_prefix, and annotate nested guest messages Date: Mon, 16 Nov 2015 17:54:22 +0000 Message-ID: <1447696465-24978-5-git-send-email-ian.jackson@eu.citrix.com> References: <1447696465-24978-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 1ZyNzC-0000Fl-Hl for xen-devel@lists.xenproject.org; Mon, 16 Nov 2015 17:54:38 +0000 In-Reply-To: <1447696465-24978-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: Robert Ho , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org This allows code elsewhere to annotate log messages which might otherwise be confusing. The variable should be localised, and the value should always start with a space, if not empty. Use this to annotate the calls to selecthost and selectguest from within selecthost-for-an-L1. Otherwise some of the log messages can be very confusing. Signed-off-by: Ian Jackson --- Osstest/TestSupport.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index d0acdc6..6c08c6d 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -41,7 +41,8 @@ BEGIN { tsreadconfig %r $flight $job $stash ts_get_host_guest - fail broken logm $logm_handle get_filecontents + fail broken logm $logm_handle $logm_prefix + get_filecontents report_once store_runvar get_runvar get_runvar_maybe @@ -132,6 +133,7 @@ our %timeout= qw(RebootDown 100 HardRebootUp 600); our $logm_handle= new IO::File ">& STDERR" or die $!; +our $logm_prefix= ''; #---------- test script startup ---------- @@ -194,7 +196,7 @@ sub ts_get_host_guest { # pass this @ARGV sub logm ($) { my ($m) = @_; my @t = gmtime; - my $fm = (show_abs_time time)." $m\n"; + my $fm = (show_abs_time time)."$logm_prefix $m \n"; foreach my $h ((ref($logm_handle) eq 'ARRAY') ? @$logm_handle : $logm_handle) { print $h $fm or die $!; @@ -866,6 +868,7 @@ sub selecthost ($) { if ($name =~ s/^(.*)://) { my $parentname = $1; + local $logm_prefix = $logm_prefix." [host $ident]"; my $parent = selecthost($parentname); my $child = selectguest($name,$parent); $child->{Ident} = $ho->{Ident}; -- 1.7.10.4