Jürgen Hötzel
2023-May-27 13:32 UTC
[Libguestfs] [PATCH libguestfs 1/2] ocaml/implicit_close test: collect all currently unreachable blocks
Fixes failing implice_close test on OCaml 5. --- ocaml/t/guestfs_065_implicit_close.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ocaml/t/guestfs_065_implicit_close.ml b/ocaml/t/guestfs_065_implicit_close.ml index 567e550b4..5e00c21ac 100644 --- a/ocaml/t/guestfs_065_implicit_close.ml +++ b/ocaml/t/guestfs_065_implicit_close.ml @@ -30,8 +30,8 @@ let () *) (* This should cause the GC to close the handle. *) -let () = Gc.compact () +let () = Gc.full_major () let () = assert (!close_invoked = 1) -let () = Gc.compact () +let () = Gc.full_major () -- 2.40.1
Laszlo Ersek
2023-May-30 11:29 UTC
[Libguestfs] [PATCH libguestfs 1/2] ocaml/implicit_close test: collect all currently unreachable blocks
On 5/27/23 15:32, J?rgen H?tzel wrote:> Fixes failing implice_close test on OCaml 5. > --- > ocaml/t/guestfs_065_implicit_close.ml | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/ocaml/t/guestfs_065_implicit_close.ml b/ocaml/t/guestfs_065_implicit_close.ml > index 567e550b4..5e00c21ac 100644 > --- a/ocaml/t/guestfs_065_implicit_close.ml > +++ b/ocaml/t/guestfs_065_implicit_close.ml > @@ -30,8 +30,8 @@ let () > *) > > (* This should cause the GC to close the handle. *) > -let () = Gc.compact () > +let () = Gc.full_major () > > let () = assert (!close_invoked = 1) > > -let () = Gc.compact () > +let () = Gc.full_major ()I can vaguely support this patch, as the documentation at <https://v2.ocaml.org/api/Gc.html#VALfull_major> writes, "This will collect all currently unreachable blocks" *and* none of the other functions documented on that page are classified similarly. Acked-by: Laszlo Ersek <lersek at redhat.com>
Eric Blake
2023-May-30 16:26 UTC
[Libguestfs] [PATCH libguestfs 1/2] ocaml/implicit_close test: collect all currently unreachable blocks
On Sat, May 27, 2023 at 03:32:36PM +0200, J?rgen H?tzel wrote:> Fixes failing implice_close test on OCaml 5.s/implice/implicit/> --- > ocaml/t/guestfs_065_implicit_close.ml | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/ocaml/t/guestfs_065_implicit_close.ml b/ocaml/t/guestfs_065_implicit_close.ml > index 567e550b4..5e00c21ac 100644 > --- a/ocaml/t/guestfs_065_implicit_close.ml > +++ b/ocaml/t/guestfs_065_implicit_close.ml > @@ -30,8 +30,8 @@ let () > *) > > (* This should cause the GC to close the handle. *) > -let () = Gc.compact () > +let () = Gc.full_major () > > let () = assert (!close_invoked = 1) > > -let () = Gc.compact () > +let () = Gc.full_major ()Will libnbd need a similar patch? (I'm assuming that Rich modeled libnbd's OCaml bindings after libguestfs and therefore it likely shares an implicit close feature worth testing, although there is not currently a 'ocaml/tests/*_implicit_close.ml' file in that project) -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Richard W.M. Jones
2023-May-31 09:12 UTC
[Libguestfs] [PATCH libguestfs 1/2] ocaml/implicit_close test: collect all currently unreachable blocks
On Sat, May 27, 2023 at 03:32:36PM +0200, J?rgen H?tzel wrote:> Fixes failing implice_close test on OCaml 5. > --- > ocaml/t/guestfs_065_implicit_close.ml | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/ocaml/t/guestfs_065_implicit_close.ml b/ocaml/t/guestfs_065_implicit_close.ml > index 567e550b4..5e00c21ac 100644 > --- a/ocaml/t/guestfs_065_implicit_close.ml > +++ b/ocaml/t/guestfs_065_implicit_close.ml > @@ -30,8 +30,8 @@ let () > *) > > (* This should cause the GC to close the handle. *) > -let () = Gc.compact () > +let () = Gc.full_major () > > let () = assert (!close_invoked = 1) > > -let () = Gc.compact () > +let () = Gc.full_major ()I don't understand this patch at all. If there a test failing we need to diagnose why it is failing, not paper over the symptoms. What is the exact failure? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Richard W.M. Jones
2023-Jun-06 14:58 UTC
[Libguestfs] [PATCH libguestfs 1/2] ocaml/implicit_close test: collect all currently unreachable blocks
On Sat, May 27, 2023 at 03:32:36PM +0200, J?rgen H?tzel wrote:> Fixes failing implice_close test on OCaml 5. > --- > ocaml/t/guestfs_065_implicit_close.ml | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/ocaml/t/guestfs_065_implicit_close.ml b/ocaml/t/guestfs_065_implicit_close.ml > index 567e550b4..5e00c21ac 100644 > --- a/ocaml/t/guestfs_065_implicit_close.ml > +++ b/ocaml/t/guestfs_065_implicit_close.ml > @@ -30,8 +30,8 @@ let () > *) > > (* This should cause the GC to close the handle. *) > -let () = Gc.compact () > +let () = Gc.full_major ()I pushed this hunk upstream, but not the second change below. That should be sufficient to fix it on OCaml 5 while maintaining the ability to compact the heap to check for integrity. See: https://github.com/libguestfs/libguestfs/commit/1274452d225da71f115e0cb8ad435e02670dc4fb> let () = assert (!close_invoked = 1) > > -let () = Gc.compact () > +let () = Gc.full_major ()Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html