From patchwork Fri Jul 28 13:56:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 9868933 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 A7BE76037D for ; Fri, 28 Jul 2017 14:18:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A13EB286A2 for ; Fri, 28 Jul 2017 14:18:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 965C0287C3; Fri, 28 Jul 2017 14:18:32 +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 4EFE6286A2 for ; Fri, 28 Jul 2017 14:18:32 +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 1db645-0003g9-O3; Fri, 28 Jul 2017 14:16:29 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1db644-0003Zo-07 for xen-devel@lists.xenproject.org; Fri, 28 Jul 2017 14:16:28 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 92/1F-27137-B374B795; Fri, 28 Jul 2017 14:16:27 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrrBXtfavTr S4Pd0UYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNePh73tsBdt5KrqPL2BtYDzO2cXIySEh4C/x 4OcGNhCbTcBAYsX0q4xdjBwcIgIqErf3GoCEmQUiJF7cWAVWIizgIzHtyF9WEJtFQFXiccNsV pByXgF7iUs/nSEmyktM7J3GCGJzAoX//vsO1iokYCdx6ddjJghbTeLGwmUsIDavgKDEyZlPWC BWSUgcfPGCeQIj7ywkqVlIUgsYmVYxahSnFpWlFukamuklFWWmZ5TkJmbm6BoamOnlphYXJ6a n5iQmFesl5+duYgQGDgMQ7GC8vzHgEKMkB5OSKO9Ns+pIIb6k/JTKjMTijPii0pzU4kOMMhwc ShK8y1yBcoJFqempFWmZOcAQhklLcPAoifC+AEnzFhck5hZnpkOkTjHqcrya8P8bkxBLXn5eq pQ4r7EbUJEASFFGaR7cCFg8XWKUlRLmZQQ6SoinILUoN7MEVf4VozgHo5IwrxXIFJ7MvBK4Ta +AjmACOmJiUyXIESWJCCmpBkZLtmerEvw4Xx/zdtHQLl6RKCa8LtEkUPF9Iovy7/n6264qd98 7cGLfupibmxrWHvQ6H/P+HHNs1AWTi/Zxf/heuWa7X3+Sd//osZcv/M3Nznh/+ywlvCb1UPax +X8OCuX71lj+M+lw+ibbM1tZv+JUoUmid2FQ440LlgaFDnu3K6g/XFd5tU2JpTgj0VCLuag4E QC5f9S5ogIAAA== X-Env-Sender: prvs=3753e7f57=anthony.perard@citrix.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1501251384!71977345!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.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40878 invoked from network); 28 Jul 2017 14:16:26 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-3.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 28 Jul 2017 14:16:26 -0000 X-IronPort-AV: E=Sophos;i="5.40,425,1496102400"; d="scan'208";a="441753630" From: Anthony PERARD To: Date: Fri, 28 Jul 2017 14:56:19 +0100 Message-ID: <20170728135625.30263-19-anthony.perard@citrix.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170728135625.30263-1-anthony.perard@citrix.com> References: <20170728135625.30263-1-anthony.perard@citrix.com> MIME-Version: 1.0 Cc: Anthony PERARD , Ian Jackson Subject: [Xen-devel] [OSSTEST PATCH v14 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 Acked-by: Ian Jackson --- Notes: Changes in V14: - Use filename for error message instead of file handle. Osstest/TestSupport.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 7215156..c5790da 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 "$stash/$$leafref: $!" 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