From patchwork Tue Dec 13 06:39:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 9471739 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 E0166607F0 for ; Tue, 13 Dec 2016 03:33:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D123E284AA for ; Tue, 13 Dec 2016 03:33:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5CD72074F; Tue, 13 Dec 2016 03:33:04 +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=-1.2 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_03_06, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=no 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 597102074F for ; Tue, 13 Dec 2016 03:33:03 +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 1cGdnT-0004qy-6q; Tue, 13 Dec 2016 03:30:31 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGdnS-0004ql-CJ for xen-devel@lists.xenproject.org; Tue, 13 Dec 2016 03:30:30 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id AD/82-09053-55B6F485; Tue, 13 Dec 2016 03:30:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsUyZ7p8oG5otn+ EwbZ7XBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bZqSfZCybyV3yaOYm1gfEudxcjF4eQwEQm if6PK9ghnN+MEtvmTWOCcDYySvTe+McG4XQzSixtXMbcxcjBwSZgIvFmlWMXIyeHiICtxL3G2 YwgYWaBIokV/+tAwsICThJ9fUuYQGwWAVWJ/Rf3MILYvALuEncbb4PFJQTkJM4f/8kMYnMKeE h8XH6PCWSMEFDNnJlJECWGEqcfbmOcwMi3gJFhFaNGcWpRWWqRrqGlXlJRZnpGSW5iZo6uoYG ZXm5qcXFiempOYlKxXnJ+7iZGYJgwAMEOxh/LAg4xSnIwKYnymsf4RwjxJeWnVGYkFmfEF5Xm pBYfYpTh4FCS4OXLAsoJFqWmp1akZeYAAxYmLcHBoyTC+zEDKM1bXJCYW5yZDpE6xagoJc77L hMoIQCSyCjNg2uDRcklRlkpYV5GoEOEeApSi3IzS1DlXzGKczAqCfNKgWznycwrgZv+CmgxE9 Di5/u8QRaXJCKkpBoYo5iunVw4b8+75RPX+FxbNftqxgbbuxHPtz8rvb2D4e0OC7VLC9ffuCb CqsJTt9X1SlCH8v7Xj/WKrr3wvM4gmvr9R0xpt2YCM6/n9Ncd4fXirR3paeXcr48EmsTN7b8h Unyrbpufer9H1F+1vefmPV/w4aOPcoDj955A9WNHnS4821q1iJvdVomlOCPRUIu5qDgRAPKSC fWNAgAA X-Env-Sender: konrad.wilk@oracle.com X-Msg-Ref: server-14.tower-21.messagelabs.com!1481599827!42150832!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 51832 invoked from network); 13 Dec 2016 03:30:28 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-14.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 13 Dec 2016 03:30:28 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id uBD3UORp028078 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Dec 2016 03:30:25 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id uBD3UOCq007863 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Dec 2016 03:30:24 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id uBD3UOVF004429; Tue, 13 Dec 2016 03:30:24 GMT Received: from osstest.dumpdata.com (/209.6.196.81) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 12 Dec 2016 19:30:24 -0800 From: Konrad Rzeszutek Wilk To: xen-devel@lists.xenproject.org, Ian.Jackson@eu.citrix.com Date: Tue, 13 Dec 2016 01:39:48 -0500 Message-Id: <1481611195-105372-3-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1481611195-105372-1-git-send-email-konrad.wilk@oracle.com> References: <1481611195-105372-1-git-send-email-konrad.wilk@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] Cc: ross.lagerwall@citrix.com, Marcos.Matsunaga@oracle.com, Konrad Rzeszutek Wilk Subject: [Xen-devel] [PATCH v2 2/9] Osstest: Add target_cmd_output_root_status 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Which is similar to target_cmd_root_status except it outputs both return value _and_ output. To make this work we expose the $backstatusok in tcmdout sub-routine and if set - return the value and output. Otherwise the old mechanism is used. Signed-off-by: Konrad Rzeszutek Wilk --- v2: New patch --- Osstest/TestSupport.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 0d105ee..2486320 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -51,7 +51,7 @@ BEGIN { get_runvar_default need_runvars unique_incrementing_runvar next_unique_name - target_cmd_root_status + target_cmd_root_status target_cmd_output_root_status target_cmd_root target_cmd target_cmd_build target_cmd_output_root target_cmd_output target_cmd_inputfh_root sshuho @@ -667,18 +667,21 @@ sub target_cmd_root_status ($$;$$) { tcmd(undef,undef,1, 'root',@_); } sub tcmdout { my $stdout= IO::File::new_tmpfile(); - tcmd(undef,$stdout,0,@_); + my $badstatusok = $_[1]; + my $rc = tcmd(undef,$stdout,@_); $stdout->seek(0,0) or die "$stdout $!"; my $r; { local ($/) = undef; $r= <$stdout>; } die "$stdout $!" if !defined $r or $stdout->error or !close $stdout; chomp($r); + return ($rc, $r) if $badstatusok; return $r; } -sub target_cmd_output ($$;$) { tcmdout('osstest',@_); } -sub target_cmd_output_root ($$;$) { tcmdout('root',@_); } +sub target_cmd_output ($$;$) { tcmdout(0, 'osstest',@_); } +sub target_cmd_output_root ($$;$) { tcmdout(0, 'root',@_); } +sub target_cmd_output_root_status ($$;$$) { tcmdout(1, 'root',@_); } sub target_cmd_inputfh_root ($$$;$$) { my ($tho,$stdinfh,$tcmd,@rest) = @_;