summaryrefslogtreecommitdiffstats
path: root/ocaml
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-05-28 20:15:51 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-05-28 20:15:51 +0100
commitbabc0846cc911b01a58a7385d30ad25889b7175a (patch)
treee8f67f7fc096185e0febbad35396ba3972eaa432 /ocaml
parentc41fe04a652437c920acb0e820762c53bf44a139 (diff)
downloadlibguestfs-babc0846cc911b01a58a7385d30ad25889b7175a.tar.gz
libguestfs-babc0846cc911b01a58a7385d30ad25889b7175a.tar.xz
libguestfs-babc0846cc911b01a58a7385d30ad25889b7175a.zip
Add tests for bindings parameters, fix several broken bindings.
Diffstat (limited to 'ocaml')
-rw-r--r--ocaml/.depend2
-rw-r--r--ocaml/Makefile.am11
-rw-r--r--ocaml/bindtests.ml37
-rw-r--r--ocaml/run-bindtests23
4 files changed, 71 insertions, 2 deletions
diff --git a/ocaml/.depend b/ocaml/.depend
index 084f4f68..50746674 100644
--- a/ocaml/.depend
+++ b/ocaml/.depend
@@ -1,3 +1,5 @@
guestfs.cmi:
+bindtests.cmo: guestfs.cmi
+bindtests.cmx: guestfs.cmx
guestfs.cmo: guestfs.cmi
guestfs.cmx: guestfs.cmi
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index b43049aa..739e542d 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -19,6 +19,8 @@ EXTRA_DIST = \
guestfs.mli guestfs.ml \
guestfs_c.c guestfs_c.h guestfs_c_actions.c \
.depend META.in \
+ bindtests.ml \
+ run-bindtests \
t/*.ml
SUBDIRS = examples
@@ -47,8 +49,13 @@ TESTS_ENVIRONMENT = \
LIBGUESTFS_PATH=$(top_builddir)/appliance \
$(VG)
-TESTS = t/guestfs_005_load t/guestfs_010_launch t/guestfs_050_lvcreate
-noinst_DATA += $(TESTS)
+TESTS = run-bindtests \
+ t/guestfs_005_load t/guestfs_010_launch t/guestfs_050_lvcreate
+noinst_DATA += bindtests \
+ t/guestfs_005_load t/guestfs_010_launch t/guestfs_050_lvcreate
+
+bindtests: bindtests.ml mlguestfs.cmxa
+ $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
t/guestfs_005_load: t/guestfs_005_load.ml mlguestfs.cmxa
$(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
diff --git a/ocaml/bindtests.ml b/ocaml/bindtests.ml
new file mode 100644
index 00000000..2f39bfca
--- /dev/null
+++ b/ocaml/bindtests.ml
@@ -0,0 +1,37 @@
+(* libguestfs generated file
+ * WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'.
+ * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+ *
+ * Copyright (C) 2009 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+let () =
+ let g = Guestfs.create () in
+ Guestfs.test0 g "abc" (Some "def") [||] false 0 "123" "456";
+ Guestfs.test0 g "abc" None [||] false 0 "123" "456";
+ Guestfs.test0 g "" (Some "def") [||] false 0 "123" "456";
+ Guestfs.test0 g "" (Some "") [||] false 0 "123" "456";
+ Guestfs.test0 g "abc" (Some "def") [|"1"|] false 0 "123" "456";
+ Guestfs.test0 g "abc" (Some "def") [|"1";"2"|] false 0 "123" "456";
+ Guestfs.test0 g "abc" (Some "def") [|"1"|] true 0 "123" "456";
+ Guestfs.test0 g "abc" (Some "def") [|"1"|] false (-1) "123" "456";
+ Guestfs.test0 g "abc" (Some "def") [|"1"|] false (-2) "123" "456";
+ Guestfs.test0 g "abc" (Some "def") [|"1"|] false 1 "123" "456";
+ Guestfs.test0 g "abc" (Some "def") [|"1"|] false 2 "123" "456";
+ Guestfs.test0 g "abc" (Some "def") [|"1"|] false 4095 "123" "456";
+ Guestfs.test0 g "abc" (Some "def") [|"1"|] false 0 "" "";
+print_endline "EOF"
diff --git a/ocaml/run-bindtests b/ocaml/run-bindtests
new file mode 100644
index 00000000..a9162c9f
--- /dev/null
+++ b/ocaml/run-bindtests
@@ -0,0 +1,23 @@
+#!/bin/sh -
+# libguestfs OCaml bindings
+# Copyright (C) 2009 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+set -e
+
+./bindtests > bindtests.tmp
+diff -u ../bindtests bindtests.tmp
+