[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 3/9] OssTest: Add target_dir_exists



We have target_file_exists but not an equivalant one for directories.
This adds it in and is used in the "ts-xen-build: Make {xen|}dist.tar.gz
only if $builddir/install/{$xen|}install" patch.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
v2: New patch.
---
 Osstest/TestSupport.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 2486320..9377af1 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -62,6 +62,7 @@ BEGIN {
                       target_put_guest_image target_editfile
                       target_editfile_cancel target_fetchurl
                       target_editfile_root target_file_exists
+                      target_dir_exists
                       target_editfile_kvp_replace
                       target_run_apt
                       target_install_packages target_install_packages_norec
@@ -518,6 +519,14 @@ sub target_file_exists ($$) {
     die "$rfile $out ?";
 }
 
+sub target_dir_exists ($$) {
+    my ($ho,$rfile) = @_;
+    my $out= target_cmd_output($ho, "if test -d $rfile; then echo y; fi");
+    return 1 if $out =~ m/^y$/;
+    return 0 if $out !~ m/\S/;
+    die "$rfile $out ?";
+}
+
 sub next_unique_name ($) {
     my ($fnref) = @_;
     my $num = $$fnref =~ s/\+([1-9]\d*)$// ? $1 : 0;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.