- LD_LIBRARY_PATH=$(abs_top_builddir)/src/.libs \
- LIBGUESTFS_PATH=$(abs_top_builddir)
-
-TESTS = t/guestfs_005_load t/guestfs_010_launch t/guestfs_050_lvcreate
-noinst_DATA += $(TESTS)
-
-t/guestfs_005_load: t/guestfs_005_load.ml
- $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
-
-t/guestfs_010_launch: t/guestfs_010_launch.ml
- $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
-
-t/guestfs_050_lvcreate: t/guestfs_050_lvcreate.ml
- $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
+ LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
+ LIBGUESTFS_PATH=$(top_builddir)/appliance \
+ $(VG)
+
+TESTS = run-bindtests \
+ t/guestfs_005_load t/guestfs_010_launch t/guestfs_050_lvcreate \
+ t/guestfs_060_readdir t/guestfs_070_threads \
+ t/guestfs_400_progress
+noinst_DATA += bindtests \
+ t/guestfs_005_load t/guestfs_010_launch t/guestfs_050_lvcreate \
+ t/guestfs_060_readdir t/guestfs_070_threads \
+ t/guestfs_400_progress
+
+bindtests: bindtests.cmx mlguestfs.cmxa
+ mkdir -p t
+ $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . -package xml-light,unix -linkpkg mlguestfs.cmxa $< -o $@
+
+t/guestfs_005_load: t/guestfs_005_load.cmx mlguestfs.cmxa
+ mkdir -p t
+ $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . -package xml-light,unix -linkpkg mlguestfs.cmxa $< -o $@
+
+t/guestfs_010_launch: t/guestfs_010_launch.cmx mlguestfs.cmxa
+ mkdir -p t
+ $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . -package xml-light,unix -linkpkg mlguestfs.cmxa $< -o $@
+
+t/guestfs_050_lvcreate: t/guestfs_050_lvcreate.cmx mlguestfs.cmxa
+ mkdir -p t
+ $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . -package xml-light,unix -linkpkg mlguestfs.cmxa $< -o $@
+
+t/guestfs_060_readdir: t/guestfs_060_readdir.cmx mlguestfs.cmxa
+ mkdir -p t
+ $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . -package xml-light,unix -linkpkg mlguestfs.cmxa $< -o $@
+
+t/guestfs_070_threads: t/guestfs_070_threads.cmx mlguestfs.cmxa
+ mkdir -p t
+ $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . -package unix,threads -thread -linkpkg mlguestfs.cmxa $< -o $@
+
+t/guestfs_400_progress: t/guestfs_400_progress.cmx mlguestfs.cmxa
+ mkdir -p t
+ $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . -package xml-light,unix -linkpkg mlguestfs.cmxa $< -o $@
+
+# Need to rebuild the tests from source if the main library has
+# changed at all, otherwise we get inconsistent assumptions.
+t/guestfs_070_threads.cmx: t/guestfs_070_threads.ml mlguestfs.cmxa
+ $(OCAMLFIND) ocamlopt -package unix,threads -thread -linkpkg -c $< -o $@
+
+t/%.cmx: t/%.ml mlguestfs.cmxa
+ $(OCAMLFIND) ocamlopt -package xml-light,unix -linkpkg -c $< -o $@