[Libguestfs] [PATCH 4/4] ocaml: The implicit close patch only works on native code.

Richard W.M. Jones rjones at redhat.com
Tue Oct 6 16:55:14 UTC 2015


On Tue, Oct 06, 2015 at 04:05:47PM +0100, Richard W.M. Jones wrote:
> ---
>  ocaml/Makefile.am | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
> index ea41377..10a38f7 100644
> --- a/ocaml/Makefile.am
> +++ b/ocaml/Makefile.am
> @@ -111,10 +111,11 @@ test_progs_bc = \
>  	t/guestfs_040_create_multiple.bc \
>  	t/guestfs_050_handle_properties.bc \
>  	t/guestfs_060_explicit_close.bc \
> -	t/guestfs_065_implicit_close.bc \
>  	t/guestfs_070_optargs.bc \
>  	t/guestfs_410_close_event.bc \
>  	t/guestfs_420_log_messages.bc
> +# Broken on bytecode, works on native:
> +#	t/guestfs_065_implicit_close.bc

The reason the test failed on bytecode was just a mistake in the test
which I fixed by modifying it as below.  So this patch is no longer
required.

let () =
  let g = new Guestfs.guestfs () in
  ignore (g#set_event_callback close [Guestfs.EVENT_CLOSE]);
  assert (!close_invoked = 0)
(* Allow the 'g' handle to go out of scope here, to ensure there is no
 * reference held on the stack.
 *)

(* This should cause the GC to close the handle. *)
let () = Gc.compact ()

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




More information about the Libguestfs mailing list