From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: [PATCH 04/27] Osstest/TestSupport.pm: Introduce target_getfile_[root_]stash() Date: Wed, 10 Dec 2014 19:09:26 +0100 Message-ID: <20141210180926.26400.76982.stgit@Abyss.station> References: <20141210180651.26400.13356.stgit@Abyss.station> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20141210180651.26400.13356.stgit@Abyss.station> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Ian Jackson , Wei Liu , Ian Campbell List-Id: xen-devel@lists.xenproject.org From: Dario Faggioli As an analogue to target_putfilecontents_[root_]stash(). (While at it, fix one whitespace damaged line.) Signed-off-by: Dario Faggioli Cc: Wei Liu Cc: Ian Campbell Cc: Ian Jackson --- Changes from RFCv1: * adding this was requested during review. --- Osstest/TestSupport.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index cdff8d5..67befd0 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -53,7 +53,8 @@ BEGIN { target_getfile target_getfile_root target_putfile target_putfile_root target_putfilecontents_stash - target_putfilecontents_root_stash + target_putfilecontents_root_stash + target_getfile_stash target_getfile_root_stash target_put_guest_image target_editfile target_editfile_root target_file_exists target_run_apt @@ -473,6 +474,20 @@ sub target_putfilecontents_root_stash ($$$$;$) { tpfcs_core(\&target_putfile_root, @_); } +sub tgfs_core { + my ($tgetfilef,$ho,$timeout,$rsrc,$lleaf) = @_; + target_somefile_getleaf(\$lleaf,$rsrc,$ho); + $tgetfilef->($ho, $timeout, $rsrc, "$stash/$lleaf"); +} +sub target_getfile_stash ($$$;$) { + my ($ho,$timeout,$rsrc,$lleaf) = @_; + tgfs_core(\&target_getfile, @_); +} +sub target_getfile_root_stash ($$$;$) { + my ($ho,$timeout,$rsrc,$lleaf) = @_; + tgfs_core(\&target_getfile_root, @_); +} + sub target_file_exists ($$) { my ($ho,$rfile) = @_; my $out= target_cmd_output($ho, "if test -e $rfile; then echo y; fi");