*.lo
*.o
*~
+*.cmi
+*.cmo
+*.cmx
+*.cma
+*.cmxa
+*.a
+*.so
Makefile.in
Makefile
aclocal.m4
m4/ltversion.m4
m4/lt~obsolete.m4
ocaml/META
-ocaml/*.cmi
-ocaml/*.cmo
-ocaml/*.cmx
-ocaml/*.cma
-ocaml/*.cmxa
-ocaml/*.a
-ocaml/*.so
-ocaml/examples/*.cmi
-ocaml/examples/*.cmo
-ocaml/examples/*.cmx
ocaml/examples/lvs
+ocaml/t/guestfs_005_load
+ocaml/t/guestfs_010_launch
+ocaml/t/guestfs_050_lvcreate
perl/Guestfs.c
perl/Guestfs.bs
perl/Makefile-pl
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%description python
%{name}-python contains Python bindings for %{name}.
%files devel
%defattr(-,root,root,-)
%doc HACKING TODO README ex html/guestfs.3.html html/pod.css
+%doc src/generator.ml
%{_libdir}/libguestfs.so
%{_mandir}/man3/guestfs.3*
%{_includedir}/guestfs.h
EXTRA_DIST = \
guestfs.mli guestfs.ml \
guestfs_c.c guestfs_c.h guestfs_c_actions.c \
- .depend META.in
+ .depend META.in \
+ t/*.ml
SUBDIRS = examples
CLEANFILES = *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so
+CLEANFILES += t/*~ t/*.cmi t/*.cmo t/*.o t/*.a t/*.so
if HAVE_OCAML
guestfs_c_actions.o: guestfs_c_actions.c
$(CC) $(CFLAGS) -I$(OCAMLLIB) -I$(top_builddir)/src -fPIC -Wall -c $<
+TESTS_ENVIRONMENT = \
+ 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 $@
+
.mli.cmi:
$(OCAMLFIND) ocamlc -c $<
.ml.cmo:
guestfs \
META *.so *.a *.cma *.cmx *.cmxa *.cmi *.mli
+CLEANFILES += $(noinst_DATA)
+
endif
\ No newline at end of file
--- /dev/null
+(* 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.
+ *)
+
+let _ = Guestfs.create
--- /dev/null
+(* 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.
+ *)
+
+open Unix
+
+let () =
+ let g = Guestfs.create () in
+
+ let fd = openfile "test.img" [O_WRONLY;O_CREAT;O_NOCTTY;O_TRUNC] 0o666 in
+ ftruncate fd (500 * 1024 * 1024);
+ close fd;
+
+ Guestfs.add_drive g "test.img";
+ Guestfs.launch g;
+ Guestfs.wait_ready g;
+
+ unlink "test.img"
--- /dev/null
+(* 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.
+ *)
+
+open Unix
+
+let () =
+ let g = Guestfs.create () in
+
+ let fd = openfile "test.img" [O_WRONLY;O_CREAT;O_NOCTTY;O_TRUNC] 0o666 in
+ ftruncate fd (500 * 1024 * 1024);
+ close fd;
+
+ Guestfs.add_drive g "test.img";
+ Guestfs.launch g;
+ Guestfs.wait_ready g;
+
+ Guestfs.pvcreate g "/dev/sda";
+ Guestfs.vgcreate g "VG" [|"/dev/sda"|];
+ Guestfs.lvcreate g "LV1" "VG" 200;
+ Guestfs.lvcreate g "LV2" "VG" 200;
+
+ let lvs = Guestfs.lvs g in
+ if lvs <> [|"/dev/VG/LV1"; "/dev/VG/LV2"|] then
+ failwith "Guestfs.lvs returned incorrect result";
+
+ Guestfs.sync g;
+ Guestfs.close g;
+ unlink "test.img"
undef $h;
ok (1);
-#unlink ("test.img");
+unlink ("test.img");
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+import os
import guestfs
g = guestfs.guestfs()
g.add_drive ("test.img")
g.launch ()
g.wait_ready ()
+
+os.unlink ("test.img")
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+import os
import guestfs
g = guestfs.guestfs()
g.sync ()
del g
-import os
os.unlink ("test.img")