tools/ocaml: Gitlab CI test for bindings

... as building and interpreting Ocaml objects in C is rather fragile.

For C producing objects for Ocaml to consume, one trick to check validity is
Gc.compact() which forces a major sweep, walking all objects.  If this doesn't
segfault, then we at least got the pointer <-> integer aspects right.

For now, start with a very simple version call.  (Re)introduce
tools/ocaml/tests and add test-ocaml-bindings which is installed into
$(DESTDIR)$(LIBEXEC)/tests to be picked up automatically with the other dom0
tests.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Andrii Sultanov <andriy.sultanov@vates.tech>
This commit is contained in:
Andrew Cooper committed 2026-10-26 18:36:52 +00:00
1 parent 7f18907452
commit d97847e858
5 files changed
+63

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
open Printf
let xch = Xenctrl.interface_open ()
let test_xenversion () =
let ver = Xenctrl.version xch in
printf "Xen version: %d.%d%s\n" ver.major ver.minor ver.extra
let () =
printf "Test Ocaml Bindings\n%!";
test_xenversion ();
printf "Starting GC.compact()\n%!";
Gc.compact ();
printf "GC done\n";
()
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.