Pino Toscano
2015-Feb-05  17:20 UTC
[Libguestfs] [PATCH] perl: tests: reenable set_path tests
guestfs_set_path now does a copy of the passed string, so bindings don't
need to take care of the lifetime of strings parameters for it.
---
 perl/t/060-handle-properties.t | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/perl/t/060-handle-properties.t b/perl/t/060-handle-properties.t
index 0057503..6b1ee42 100644
--- a/perl/t/060-handle-properties.t
+++ b/perl/t/060-handle-properties.t
@@ -17,7 +17,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 7;
+use Test::More tests => 9;
 
 use Sys::Guestfs;
 
@@ -33,13 +33,10 @@ ok ($g->get_autosync () == 1, "autosync not
true");
 $g->set_autosync (0);
 ok ($g->get_autosync () == 0, "autosync not false");
 
-# This probably doesn't work at the moment because
-# the binding for set_path does not ensure the string
-# remains around for the lifetime of the handle.
-#$g->set_path (".");
-#ok ($g->get_path () eq ".", "path not dot");
-#$g->set_path (undef);
-#ok ($g->get_path () ne "", "path is empty");
+$g->set_path (".");
+ok ($g->get_path () eq ".", "path not dot");
+$g->set_path (undef);
+ok ($g->get_path () ne "", "path is empty");
 
 $g->add_drive ("/dev/null");
 ok (1, "add drive");
-- 
1.9.3
Richard W.M. Jones
2015-Feb-05  20:29 UTC
Re: [Libguestfs] [PATCH] perl: tests: reenable set_path tests
On Thu, Feb 05, 2015 at 06:20:31PM +0100, Pino Toscano wrote:> guestfs_set_path now does a copy of the passed string, so bindings don't > need to take care of the lifetime of strings parameters for it. > --- > perl/t/060-handle-properties.t | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/perl/t/060-handle-properties.t b/perl/t/060-handle-properties.t > index 0057503..6b1ee42 100644 > --- a/perl/t/060-handle-properties.t > +++ b/perl/t/060-handle-properties.t > @@ -17,7 +17,7 @@ > > use strict; > use warnings; > -use Test::More tests => 7; > +use Test::More tests => 9; > > use Sys::Guestfs; > > @@ -33,13 +33,10 @@ ok ($g->get_autosync () == 1, "autosync not true"); > $g->set_autosync (0); > ok ($g->get_autosync () == 0, "autosync not false"); > > -# This probably doesn't work at the moment because > -# the binding for set_path does not ensure the string > -# remains around for the lifetime of the handle. > -#$g->set_path ("."); > -#ok ($g->get_path () eq ".", "path not dot"); > -#$g->set_path (undef); > -#ok ($g->get_path () ne "", "path is empty"); > +$g->set_path ("."); > +ok ($g->get_path () eq ".", "path not dot"); > +$g->set_path (undef); > +ok ($g->get_path () ne "", "path is empty"); > > $g->add_drive ("/dev/null"); > ok (1, "add drive");Looks good, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org