From patchwork Tue Jul 25 11:57:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 9861907 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 4F711602B1 for ; Tue, 25 Jul 2017 12:18:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46AC427E63 for ; Tue, 25 Jul 2017 12:18:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B6D927F60; Tue, 25 Jul 2017 12:18:51 +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 EB0CC27E63 for ; Tue, 25 Jul 2017 12:18:50 +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 1dZylO-0004qw-4M; Tue, 25 Jul 2017 12:16:34 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZylM-0004oQ-Ma for xen-devel@lists.xenproject.org; Tue, 25 Jul 2017 12:16:32 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id C7/B9-03612-0A637795; Tue, 25 Jul 2017 12:16:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeJIrShJLcpLzFFi42JxWrrBXne+WXm kwd+/6hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aUxytYCy5zV+x69YO5gfE3RxcjJ4eEgL/E 0m/72UFsNgEDiRXTrzJ2MXJwiAioSNzeawASZhaIkHhxYxUbSFhYwEfi7CF5EJNFQFXibScrS AWvgL3Ey6d7WSEGyktM7J3GCGJzAsV/7r8ONlxIwE5i884NULaaxI2Fy1ggegUlTs58wgKxSU Li4IsXzBMYeWchSc1CklrAyLSKUaM4tagstUjX0EIvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NSc xqVgvOT93EyMwbBiAYAfjzY0BhxglOZiURHm/6ZZHCvEl5adUZiQWZ8QXleakFh9ilOHgUJLg fW4KlBMsSk1PrUjLzAEGMExagoNHSYT3nAlQmre4IDG3ODMdInWKUZfj1YT/35iEWPLy81Klx HnngcwQACnKKM2DGwGLpkuMslLCvIxARwnxFKQW5WaWoMq/YhTnYFQS5vUBmcKTmVcCt+kV0B FMQEfMmVEKckRJIkJKqoFx4o6ZS2P+Hvv73/runvRFq2cv5vhZdF2cU3ydh+S+P25dK/0aHZ6 6R7YrJe3dfuW8x76thlurbwWdnt9cNumz1bW5z926vWozGRWll5qqWP95HT+L4eJ7cfOMtI0H 037LnfVXd31yKu+NMb/B6qAZipFtXZOCuwUWaTZc992oWPTd8OnsO6+7lViKMxINtZiLihMB9 aDrf6ECAAA= X-Env-Sender: prvs=372f2a2d8=anthony.perard@citrix.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1500984981!74878560!5 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.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28102 invoked from network); 25 Jul 2017 12:16:31 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-7.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 25 Jul 2017 12:16:31 -0000 X-IronPort-AV: E=Sophos;i="5.40,411,1496102400"; d="scan'208";a="441196230" From: Anthony PERARD To: Date: Tue, 25 Jul 2017 12:57:53 +0100 Message-ID: <20170725115759.21895-19-anthony.perard@citrix.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170725115759.21895-1-anthony.perard@citrix.com> References: <20170725115759.21895-1-anthony.perard@citrix.com> MIME-Version: 1.0 Cc: Anthony PERARD , Ian Jackson Subject: [Xen-devel] [OSSTEST PATCH v13 18/24] TestSupport: Introduce target_cmd_stashed 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 This works like target_cmd, but takes a ref to a filename as argument and stash the output of the command then return a path to the stashed output. Signed-off-by: Anthony PERARD --- Osstest/TestSupport.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 7215156..135289b 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -55,6 +55,7 @@ BEGIN { target_cmd_root_status target_cmd_output_root_status target_cmd_root target_cmd target_cmd_build + target_cmd_stashed target_cmd_output_root target_cmd_output target_cmd_inputfh_root sshuho target_getfile target_getfile_root @@ -764,6 +765,16 @@ sub target_cmd_inputfh_root ($$$;$$) { tcmd($stdinfh,undef,0,'root',$tho,$tcmd,@rest); } +# Like target_cmd, but stash cmd stdout and return a path to it. +sub target_cmd_stashed ($$$;$$) { + my ($tho,$leafref,$tcmd,$timeout,$extrasshopts) = @_; + my $stdout = open_unique_stashfile($leafref); + my $rc = tcmd(undef, $stdout, 0, 'osstest', $tho, $tcmd, $timeout, + $extrasshopts); + die "$stdout $!" if $stdout->error or !close $stdout; + return "$stash/$$leafref"; +} + sub poll_loop ($$$&) { my ($maxwait, $interval, $what, $code) = @_; # $code should return undef when all is well