From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [OSSTEST PATCH 1/3] timeouts: Refactor target_adjust_timeout to have $adjust->(), and log
Date: Fri, 20 Jan 2017 12:04:35 +0000 [thread overview]
Message-ID: <1484913877-16261-1-git-send-email-ian.jackson@eu.citrix.com> (raw)
If a timeout is adjusted, print a log message. We are going to want
to reuse this logic in a moment.
Do the defaulting in $adjust->() rather than passing 1 as a default
to the lookup functions, which is slightly neater.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
Osstest/TestSupport.pm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 888f0ac..5a10cae 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -334,9 +334,17 @@ END
sub target_adjust_timeout ($$) {
my ($ho,$timeoutref) = @_; # $ho might be a $gho
+ my $adjust = sub {
+ my ($factor, $what) = @_;
+ return unless defined $factor;
+ return if $factor==1;
+ logm("(adjusting timeout by factor $factor, from $what)");
+ $$timeoutref *= $factor;
+ };
if ($ho->{Guest}) {
my $context = $ho->{TimeoutContext} // 'general';
- $$timeoutref *= guest_var($ho,"${context}_timeoutfactor",1);
+ my $guest_var = "${context}_timeoutfactor";
+ $adjust->(guest_var($ho,$guest_var), "guest variable $guest_var");
}
}
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2017-01-20 12:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-20 12:04 Ian Jackson [this message]
2017-01-20 12:04 ` [OSSTEST PATCH 2/3] timeouts: Call target_adjust_timeout for all build commands Ian Jackson
2017-01-20 12:04 ` [OSSTEST PATCH 3/3] timeouts: Honour TimeoutFactor host property Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1484913877-16261-1-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).