From patchwork Fri Jan 20 12:04:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 9528077 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 096FF6020B for ; Fri, 20 Jan 2017 12:07:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFF27285CD for ; Fri, 20 Jan 2017 12:07:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E45882861F; Fri, 20 Jan 2017 12:07:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2AA94285CD for ; Fri, 20 Jan 2017 12:07:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUXwE-0005pw-5q; Fri, 20 Jan 2017 12:05:02 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUXwD-0005pp-Bh for xen-devel@lists.xenproject.org; Fri, 20 Jan 2017 12:05:01 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id C1/B6-20518-CECF1885; Fri, 20 Jan 2017 12:05:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRWlGSWpSXmKPExsXitHSDve7LP40 RBp+Wslh83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBkHVt5nLLjHUdF+/i1jA+MS9i5GTg4JAX+J D9fmg9lsAroSTVv+snUxcnCICKhI3N5rAGIyC4RK7HhhCWIKCyRJfPhjA1LMIqAq8eD3HmYQm 1fAU+L28wWMEAPlJM4f/8kMUi4koCYxd308RImgxMmZT1hAbGYBCYmDL14wT2DknoUkNQtJag Ej0ypGjeLUorLUIl1DS72kosz0jJLcxMwcXUMDY73c1OLixPTUnMSkYr3k/NxNjMAgqGdgYNz B+Pu43yFGSQ4mJVHe3R8bIoT4kvJTKjMSizPii0pzUosPMcpwcChJ8K743RghJFiUmp5akZaZ AwxHmLQEB4+SCK8kSJq3uCAxtzgzHSJ1ilFRSpx3IkhCACSRUZoH1waLgUuMslLCvIwMDAxCP AWpRbmZJajyrxjFORiVhHkPgEzhycwrgZv+CmgxE9BiK+V6kMUliQgpqQbGC1r776Y4OM40yC qYXrtk6sGehWvPeD6cZn96aczM1a0/sj3s3kXu1ukoPPm6/z57SvjVgnB7lwfv1jd+uXLs/s+ 3d2KzHL2viD/kOPH/3lZBH57AtTwcMtnPStIfXAnbvTlnTsiTWwz+U+U9rz6+fUo5PdLuwpXd eyev6pi98/2pPVo775WGCiixFGckGmoxFxUnAgBJ4L19fAIAAA== X-Env-Sender: prvs=18694997c=Ian.Jackson@citrix.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1484913895!73967813!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8627 invoked from network); 20 Jan 2017 12:04:56 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-16.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 20 Jan 2017 12:04:56 -0000 X-IronPort-AV: E=Sophos;i="5.33,258,1477958400"; d="scan'208";a="409816780" From: Ian Jackson To: Date: Fri, 20 Jan 2017 12:04:35 +0000 Message-ID: <1484913877-16261-1-git-send-email-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Cc: Ian Jackson Subject: [Xen-devel] [OSSTEST PATCH 1/3] timeouts: Refactor target_adjust_timeout to have $adjust->(), and log X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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"); } }