*.class
*.jar
*.hi
+bindtests.tmp
ChangeLog
Makefile.in
Makefile
m4/ltversion.m4
m4/lt~obsolete.m4
ocaml/META
+ocaml/bindtests
ocaml/examples/lvs
ocaml/t/guestfs_005_load
ocaml/t/guestfs_010_launch
--- /dev/null
+abc
+def
+[]
+false
+0
+123
+456
+abc
+null
+[]
+false
+0
+123
+456
+
+def
+[]
+false
+0
+123
+456
+
+
+[]
+false
+0
+123
+456
+abc
+def
+["1"]
+false
+0
+123
+456
+abc
+def
+["1", "2"]
+false
+0
+123
+456
+abc
+def
+["1"]
+true
+0
+123
+456
+abc
+def
+["1"]
+false
+-1
+123
+456
+abc
+def
+["1"]
+false
+-2
+123
+456
+abc
+def
+["1"]
+false
+1
+123
+456
+abc
+def
+["1"]
+false
+2
+123
+456
+abc
+def
+["1"]
+false
+4095
+123
+456
+abc
+def
+["1"]
+false
+0
+
+
+EOF
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-AC_INIT([libguestfs],[1.0.34])
+AC_INIT([libguestfs],[1.0.35])
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])
--- /dev/null
+/* 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.
+ */
+
+import com.redhat.et.libguestfs.*;
+
+public class Bindtests {
+ public static void main (String[] argv)
+ {
+ try {
+ GuestFS g = new GuestFS ();
+ g.test0 ("abc", "def", new String[]{}, false, 0, "123", "456");
+ g.test0 ("abc", null, new String[]{}, false, 0, "123", "456");
+ g.test0 ("", "def", new String[]{}, false, 0, "123", "456");
+ g.test0 ("", "", new String[]{}, false, 0, "123", "456");
+ g.test0 ("abc", "def", new String[]{"1"}, false, 0, "123", "456");
+ g.test0 ("abc", "def", new String[]{"1","2"}, false, 0, "123", "456");
+ g.test0 ("abc", "def", new String[]{"1"}, true, 0, "123", "456");
+ g.test0 ("abc", "def", new String[]{"1"}, false, -1, "123", "456");
+ g.test0 ("abc", "def", new String[]{"1"}, false, -2, "123", "456");
+ g.test0 ("abc", "def", new String[]{"1"}, false, 1, "123", "456");
+ g.test0 ("abc", "def", new String[]{"1"}, false, 2, "123", "456");
+ g.test0 ("abc", "def", new String[]{"1"}, false, 4095, "123", "456");
+ g.test0 ("abc", "def", new String[]{"1"}, false, 0, "", "");
+
+ System.out.println ("EOF");
+ }
+ catch (Exception exn) {
+ System.err.println (exn);
+ System.exit (1);
+ }
+ }
+}
$(CPTH)/GuestFS.java
java_tests = \
+ Bindtests.java \
t/GuestFS005Load.java \
t/GuestFS010Launch.java \
t/GuestFS050LVCreate.java
EXTRA_DIST = \
$(java_sources) \
$(java_tests) \
- run-java-test
+ run-bindtests \
+ run-java-tests
CLEANFILES = doc-stamp
# Tests (not comprehensive).
-TESTS = $(java_tests:.java=.class)
+TESTS = run-bindtests run-java-tests
TESTS_ENVIRONMENT = \
JAVA=$(JAVA) \
- CLASSPATH=t:libguestfs-$(VERSION).jar \
- LIBGUESTFS_PATH=$(top_builddir)/appliance \
- ./run-java-test
+ CLASSPATH=.:t:libguestfs-$(VERSION).jar \
+ LIBGUESTFS_PATH=$(top_builddir)/appliance
+
+noinst_DATA = Bindtests.class $(java_tests:.java=.class)
t/%.class: t/%.java
$(JAVAC) $(JAVAC_FLAGS) -classpath libguestfs-$(VERSION).jar $<
+Bindtests.class: Bindtests.java
+ $(JAVAC) $(JAVAC_FLAGS) -classpath libguestfs-$(VERSION).jar $<
+
endif
# Tell version 3.79 and up of GNU make to not build goals in this
int i;
str = (*env)->GetStringUTFChars (env, jstr, NULL);
- optstr = (*env)->GetStringUTFChars (env, joptstr, NULL);
+ optstr = joptstr ? (*env)->GetStringUTFChars (env, joptstr, NULL) : NULL;
strlist_len = (*env)->GetArrayLength (env, jstrlist);
strlist = guestfs_safe_malloc (g, sizeof (char *) * (strlist_len+1));
for (i = 0; i < strlist_len; ++i) {
fileout = (*env)->GetStringUTFChars (env, jfileout, NULL);
r = guestfs_test0 (g, str, optstr, strlist, b, integer, filein, fileout);
(*env)->ReleaseStringUTFChars (env, jstr, str);
- (*env)->ReleaseStringUTFChars (env, joptstr, optstr);
+ if (joptstr)
+ (*env)->ReleaseStringUTFChars (env, joptstr, optstr);
for (i = 0; i < strlist_len; ++i) {
jobject o = (*env)->GetObjectArrayElement (env, jstrlist, i);
(*env)->ReleaseStringUTFChars (env, o, strlist[i]);
const char *qemuvalue;
qemuparam = (*env)->GetStringUTFChars (env, jqemuparam, NULL);
- qemuvalue = (*env)->GetStringUTFChars (env, jqemuvalue, NULL);
+ qemuvalue = jqemuvalue ? (*env)->GetStringUTFChars (env, jqemuvalue, NULL) : NULL;
r = guestfs_config (g, qemuparam, qemuvalue);
(*env)->ReleaseStringUTFChars (env, jqemuparam, qemuparam);
- (*env)->ReleaseStringUTFChars (env, jqemuvalue, qemuvalue);
+ if (jqemuvalue)
+ (*env)->ReleaseStringUTFChars (env, jqemuvalue, qemuvalue);
if (r == -1) {
throw_exception (env, guestfs_last_error (g));
return ;
const char *expr;
name = (*env)->GetStringUTFChars (env, jname, NULL);
- expr = (*env)->GetStringUTFChars (env, jexpr, NULL);
+ expr = jexpr ? (*env)->GetStringUTFChars (env, jexpr, NULL) : NULL;
r = guestfs_aug_defvar (g, name, expr);
(*env)->ReleaseStringUTFChars (env, jname, name);
- (*env)->ReleaseStringUTFChars (env, jexpr, expr);
+ if (jexpr)
+ (*env)->ReleaseStringUTFChars (env, jexpr, expr);
if (r == -1) {
throw_exception (env, guestfs_last_error (g));
return 0;
--- /dev/null
+#!/bin/sh -
+# libguestfs Perl 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
+
+$JAVA -Djava.library.path=.libs Bindtests > bindtests.tmp
+diff -u ../bindtests bindtests.tmp
--- /dev/null
+#!/bin/sh -
+# libguestfs Perl 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
+
+for f in t/*.class; do
+ classname=$(basename $f .class)
+ $JAVA -Djava.library.path=.libs $classname
+done
\ No newline at end of file
guestfs.cmi:
+bindtests.cmo: guestfs.cmi
+bindtests.cmx: guestfs.cmx
guestfs.cmo: guestfs.cmi
guestfs.cmx: guestfs.cmi
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
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 $@
--- /dev/null
+(* 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"
#!/bin/sh -
-# libguestfs Java bindings
+# libguestfs OCaml bindings
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-cmd=$(echo $1 | sed -e 's,^./t/,,' -e 's,.class$,,')
+set -e
+
+./bindtests > bindtests.tmp
+diff -u ../bindtests bindtests.tmp
-$JAVA -Djava.library.path=.libs $cmd
test0 (g, str, optstr, strlist, b, integer, filein, fileout)
guestfs_h *g;
char *str;
- char *optstr;
+ char *optstr = SvOK(ST(2)) ? SvPV_nolen(ST(2)) : NULL;
char **strlist;
int b;
int integer;
config (g, qemuparam, qemuvalue)
guestfs_h *g;
char *qemuparam;
- char *qemuvalue;
+ char *qemuvalue = SvOK(ST(2)) ? SvPV_nolen(ST(2)) : NULL;
PREINIT:
int r;
PPCODE:
aug_defvar (g, name, expr)
guestfs_h *g;
char *name;
- char *expr;
+ char *expr = SvOK(ST(2)) ? SvPV_nolen(ST(2)) : NULL;
PREINIT:
int nrnodes;
CODE:
examples/LICENSE \
examples/*.pl \
lib/Sys/Guestfs.pm \
+ run-bindtests \
run-perl-tests \
t/*.t \
typemap
# Interfacing automake and ExtUtils::MakeMaker known to be
# a nightmare, news at 11.
-TESTS = run-perl-tests
+TESTS = run-bindtests run-perl-tests
+
+TESTS_ENVIRONMENT = \
+ LD_LIBRARY_PATH=../src/.libs \
+ LIBGUESTFS_PATH=../appliance
INSTALLDIRS = site
--- /dev/null
+#!/usr/bin/perl -w
+# 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.
+
+use strict;
+
+use Sys::Guestfs;
+
+my $g = Sys::Guestfs->new ();
+$g->test0 ("abc", "def", [], 0, 0, "123", "456");
+$g->test0 ("abc", undef, [], 0, 0, "123", "456");
+$g->test0 ("", "def", [], 0, 0, "123", "456");
+$g->test0 ("", "", [], 0, 0, "123", "456");
+$g->test0 ("abc", "def", ["1"], 0, 0, "123", "456");
+$g->test0 ("abc", "def", ["1","2"], 0, 0, "123", "456");
+$g->test0 ("abc", "def", ["1"], 1, 0, "123", "456");
+$g->test0 ("abc", "def", ["1"], 0, -1, "123", "456");
+$g->test0 ("abc", "def", ["1"], 0, -2, "123", "456");
+$g->test0 ("abc", "def", ["1"], 0, 1, "123", "456");
+$g->test0 ("abc", "def", ["1"], 0, 2, "123", "456");
+$g->test0 ("abc", "def", ["1"], 0, 4095, "123", "456");
+$g->test0 ("abc", "def", ["1"], 0, 0, "", "");
+print "EOF\n"
--- /dev/null
+#!/bin/sh -
+# libguestfs Perl 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
+
+export PERL5LIB=$(pwd)/blib/lib:$(pwd)/blib/arch
+perl bindtests.pl > bindtests.tmp
+diff -u ../bindtests bindtests.tmp
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-export LD_LIBRARY_PATH=../src/.libs
-export LIBGUESTFS_PATH=../appliance
+set -e
+
make -f Makefile-pl test "$@"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?"
"component=libguestfs&product=Virtualization+Tools\n"
-"POT-Creation-Date: 2009-05-27 17:12+0100\n"
+"POT-Creation-Date: 2009-05-28 20:04+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "guestfs_create: failed to create handle\n"
msgstr ""
-#: fish/fish.c:214
+#: fish/fish.c:215
#, c-format
msgid "guestfish: unexpected command line option 0x%x\n"
msgstr ""
-#: fish/fish.c:341
+#: fish/fish.c:342
#, c-format
msgid ""
"\n"
"\n"
msgstr ""
-#: fish/fish.c:418
+#: fish/fish.c:419
#, c-format
msgid "guestfish: unterminated double quote\n"
msgstr ""
-#: fish/fish.c:423 fish/fish.c:438
+#: fish/fish.c:424 fish/fish.c:439
#, c-format
msgid "guestfish: command arguments not separated by whitespace\n"
msgstr ""
-#: fish/fish.c:433
+#: fish/fish.c:434
#, c-format
msgid "guestfish: unterminated single quote\n"
msgstr ""
-#: fish/fish.c:474
+#: fish/fish.c:475
#, c-format
msgid "guestfish: internal error parsing string at '%s'\n"
msgstr ""
-#: fish/fish.c:487
+#: fish/fish.c:488
#, c-format
msgid "guestfish: too many arguments\n"
msgstr ""
-#: fish/fish.c:514
+#: fish/fish.c:515
#, c-format
msgid "guestfish: empty command on command line\n"
msgstr ""
-#: fish/fish.c:571
+#: fish/fish.c:572
msgid "display a list of commands or help on a command"
msgstr ""
-#: fish/fish.c:573
+#: fish/fish.c:574
msgid "quit guestfish"
msgstr ""
-#: fish/fish.c:576
+#: fish/fish.c:577
msgid "allocate an image"
msgstr ""
-#: fish/fish.c:578
+#: fish/fish.c:579
msgid "display a line of text"
msgstr ""
-#: fish/fish.c:580
+#: fish/fish.c:581
msgid "edit a file in the image"
msgstr ""
-#: fish/fish.c:592
+#: fish/fish.c:593
#, c-format
msgid ""
"alloc - allocate an image\n"
" <nn>sects number of 512 byte sectors\n"
msgstr ""
-#: fish/fish.c:608
+#: fish/fish.c:609
#, c-format
msgid ""
"echo - display a line of text\n"
" This echos the parameters to the terminal.\n"
msgstr ""
-#: fish/fish.c:615
+#: fish/fish.c:616
#, c-format
msgid ""
"edit - edit a file in the image\n"
" (> 2 MB) or binary files containing \\0 bytes.\n"
msgstr ""
-#: fish/fish.c:629
+#: fish/fish.c:630
#, c-format
msgid ""
"help - display a list of commands or help on a command\n"
" help\n"
msgstr ""
-#: fish/fish.c:635
+#: fish/fish.c:636
#, c-format
msgid ""
"quit - quit guestfish\n"
" quit\n"
msgstr ""
-#: fish/fish.c:638
+#: fish/fish.c:639
#, c-format
msgid "%s: command not known, use -h to list all commands\n"
msgstr ""
"Project-Id-Version: libguestfs 1.0.31\n"
"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?"
"component=libguestfs&product=Virtualization+Tools\n"
-"POT-Creation-Date: 2009-05-27 17:12+0100\n"
+"POT-Creation-Date: 2009-05-28 20:04+0100\n"
"PO-Revision-Date: 2009-05-26 00:50+0200\n"
"Last-Translator: Piotr DrÄ…g <piotrdrag@gmail.com>\n"
"Language-Team: Polish <pl@li.org>\n"
msgid "guestfs_create: failed to create handle\n"
msgstr "guestfs_create: utworzenie programu obsługi nie powiodło się\n"
-#: fish/fish.c:214
+#: fish/fish.c:215
#, c-format
msgid "guestfish: unexpected command line option 0x%x\n"
msgstr "guestfish: nieoczekiwane polecenie wiersza poleceń 0x%x\n"
-#: fish/fish.c:341
+#: fish/fish.c:342
#, c-format
msgid ""
"\n"
" \"quit\", aby zakończyć powłokę\n"
"\n"
-#: fish/fish.c:418
+#: fish/fish.c:419
#, c-format
msgid "guestfish: unterminated double quote\n"
msgstr "guestfish: niezakończony podwójny cudzysłów\n"
-#: fish/fish.c:423 fish/fish.c:438
+#: fish/fish.c:424 fish/fish.c:439
#, c-format
msgid "guestfish: command arguments not separated by whitespace\n"
msgstr "guestfish: parametry poleceń nie są oddzielone spacjami\n"
-#: fish/fish.c:433
+#: fish/fish.c:434
#, c-format
msgid "guestfish: unterminated single quote\n"
msgstr "guestfish: niezakończony pojedynczy cudzysłów\n"
-#: fish/fish.c:474
+#: fish/fish.c:475
#, c-format
msgid "guestfish: internal error parsing string at '%s'\n"
msgstr "guestfish: wewnętrzny błąd analizowania łańcucha \"%s\"\n"
-#: fish/fish.c:487
+#: fish/fish.c:488
#, c-format
msgid "guestfish: too many arguments\n"
msgstr "guestfish: za dużo parametrów\n"
-#: fish/fish.c:514
+#: fish/fish.c:515
#, c-format
msgid "guestfish: empty command on command line\n"
msgstr "guestfish: puste polecenie wiersza poleceń\n"
-#: fish/fish.c:571
+#: fish/fish.c:572
msgid "display a list of commands or help on a command"
msgstr "wyświetla listę poleceń lub pomoc polecenia"
-#: fish/fish.c:573
+#: fish/fish.c:574
msgid "quit guestfish"
msgstr "kończy pracę guestfish"
-#: fish/fish.c:576
+#: fish/fish.c:577
msgid "allocate an image"
msgstr "przydziela obraz"
-#: fish/fish.c:578
+#: fish/fish.c:579
msgid "display a line of text"
msgstr "wyświetla wiersz tekstu"
-#: fish/fish.c:580
+#: fish/fish.c:581
msgid "edit a file in the image"
msgstr "modyfikuje plik w obrazie"
-#: fish/fish.c:592
+#: fish/fish.c:593
#, c-format
msgid ""
"alloc - allocate an image\n"
" <nn>G lub <nn>GB liczba gigabajtów\n"
" <nn>sektory liczba 512 bajtowych sektorów\n"
-#: fish/fish.c:608
+#: fish/fish.c:609
#, c-format
msgid ""
"echo - display a line of text\n"
"\n"
" Wyświetla ostatnie parametry w terminalu.\n"
-#: fish/fish.c:615
+#: fish/fish.c:616
#, c-format
msgid ""
"edit - edit a file in the image\n"
" UWAGA: nie będzie działało poprawnie dla dużych plików\n"
" (> 2 MB) lub plików binarnych zawierających \\0 bajtów.\n"
-#: fish/fish.c:629
+#: fish/fish.c:630
#, c-format
msgid ""
"help - display a list of commands or help on a command\n"
" help polecenie\n"
" help\n"
-#: fish/fish.c:635
+#: fish/fish.c:636
#, c-format
msgid ""
"quit - quit guestfish\n"
"quit - kończy pracę guestfish\n"
" quit\n"
-#: fish/fish.c:638
+#: fish/fish.c:639
#, c-format
msgid "%s: command not known, use -h to list all commands\n"
msgstr ""
EXTRA_DIST = \
guestfs.py \
guestfs-py.c \
+ bindtests.py \
+ run-bindtests \
+ run-python-tests \
t/*.py
if HAVE_PYTHON
TESTS_ENVIRONMENT = \
LIBGUESTFS_PATH=$(top_builddir)/appliance \
- PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs \
- $(PYTHON)
-TESTS = t/005-import.py t/010-launch.py t/050-lvcreate.py
+ PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs
+
+TESTS = run-bindtests run-python-tests
endif
--- /dev/null
+# 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.
+
+import guestfs
+
+g = guestfs.GuestFS ()
+g.test0 ("abc", "def", [], 0, 0, "123", "456")
+g.test0 ("abc", None, [], 0, 0, "123", "456")
+g.test0 ("", "def", [], 0, 0, "123", "456")
+g.test0 ("", "", [], 0, 0, "123", "456")
+g.test0 ("abc", "def", ["1"], 0, 0, "123", "456")
+g.test0 ("abc", "def", ["1","2"], 0, 0, "123", "456")
+g.test0 ("abc", "def", ["1"], 1, 0, "123", "456")
+g.test0 ("abc", "def", ["1"], 0, -1, "123", "456")
+g.test0 ("abc", "def", ["1"], 0, -2, "123", "456")
+g.test0 ("abc", "def", ["1"], 0, 1, "123", "456")
+g.test0 ("abc", "def", ["1"], 0, 2, "123", "456")
+g.test0 ("abc", "def", ["1"], 0, 4095, "123", "456")
+g.test0 ("abc", "def", ["1"], 0, 0, "", "")
+print "EOF"
--- /dev/null
+#!/bin/sh -
+# libguestfs Perl 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
+
+python bindtests.py > bindtests.tmp
+diff -u ../bindtests bindtests.tmp
--- /dev/null
+#!/bin/sh -
+# libguestfs Perl 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
+
+for f in t/*.py; do
+ python $f
+done
+
ext/guestfs/_guestfs.c \
ext/guestfs/extconf.rb \
lib/guestfs.rb \
+ run-bindtests \
run-ruby-tests \
tests/tc_*.rb
if HAVE_RUBY
-TESTS = run-ruby-tests
+TESTS = run-bindtests run-ruby-tests
+
+TESTS_ENVIRONMENT = \
+ LD_LIBRARY_PATH=../src/.libs \
+ LIBGUESTFS_PATH=../appliance
all:
rake build
--- /dev/null
+# 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.
+
+require 'guestfs'
+
+g = Guestfs::create()
+g.test0("abc", "def", [], false, 0, "123", "456")
+g.test0("abc", nil, [], false, 0, "123", "456")
+g.test0("", "def", [], false, 0, "123", "456")
+g.test0("", "", [], false, 0, "123", "456")
+g.test0("abc", "def", ["1"], false, 0, "123", "456")
+g.test0("abc", "def", ["1","2"], false, 0, "123", "456")
+g.test0("abc", "def", ["1"], true, 0, "123", "456")
+g.test0("abc", "def", ["1"], false, -1, "123", "456")
+g.test0("abc", "def", ["1"], false, -2, "123", "456")
+g.test0("abc", "def", ["1"], false, 1, "123", "456")
+g.test0("abc", "def", ["1"], false, 2, "123", "456")
+g.test0("abc", "def", ["1"], false, 4095, "123", "456")
+g.test0("abc", "def", ["1"], false, 0, "", "")
+print "EOF\n"
if (!str)
rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
"str", "test0");
- const char *optstr = StringValueCStr (optstrv);
+ const char *optstr = !NIL_P (optstrv) ? StringValueCStr (optstrv) : NULL;
char **strlist; {
int i, len;
len = RARRAY_LEN (strlistv);
}
strlist[len] = NULL;
}
- int b = NUM2INT (bv);
+ int b = RTEST (bv);
int integer = NUM2INT (integerv);
const char *filein = StringValueCStr (fileinv);
if (!filein)
if (!qemuparam)
rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
"qemuparam", "config");
- const char *qemuvalue = StringValueCStr (qemuvaluev);
+ const char *qemuvalue = !NIL_P (qemuvaluev) ? StringValueCStr (qemuvaluev) : NULL;
int r;
if (!g)
rb_raise (rb_eArgError, "%s: used handle after closing it", "set_autosync");
- int autosync = NUM2INT (autosyncv);
+ int autosync = RTEST (autosyncv);
int r;
if (!g)
rb_raise (rb_eArgError, "%s: used handle after closing it", "set_verbose");
- int verbose = NUM2INT (verbosev);
+ int verbose = RTEST (verbosev);
int r;
if (!name)
rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
"name", "aug_defvar");
- const char *expr = StringValueCStr (exprv);
+ const char *expr = !NIL_P (exprv) ? StringValueCStr (exprv) : NULL;
int r;
if (!label)
rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
"label", "aug_insert");
- int before = NUM2INT (beforev);
+ int before = RTEST (beforev);
int r;
if (!g)
rb_raise (rb_eArgError, "%s: used handle after closing it", "vg_activate_all");
- int activate = NUM2INT (activatev);
+ int activate = RTEST (activatev);
int r;
if (!g)
rb_raise (rb_eArgError, "%s: used handle after closing it", "vg_activate");
- int activate = NUM2INT (activatev);
+ int activate = RTEST (activatev);
char **volgroups; {
int i, len;
len = RARRAY_LEN (volgroupsv);
--- /dev/null
+#!/bin/sh -
+# libguestfs Ruby 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
+
+ruby -Ilib -Iext/guestfs bindtests.rb > bindtests.tmp
+diff -u ../bindtests bindtests.tmp
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-export LD_LIBRARY_PATH=../src/.libs
-export LIBGUESTFS_PATH=../appliance
+set -e
+
rake test "$@"
"namemax", `Int;
]
+(* Used for testing language bindings. *)
+type callt =
+ | CallString of string
+ | CallOptString of string option
+ | CallStringList of string list
+ | CallInt of int
+ | CallBool of bool
+
(* Useful functions.
* Note we don't want to use any external OCaml libraries which
* makes this a bit harder than it should be.
generate_call_args ~handle:"g" (snd style);
pr "\n";
pr " guestfs_h *g;\n";
- List.iter (
- function
- | String n | FileIn n | FileOut n -> pr " char *%s;\n" n
- | OptString n -> pr " char *%s;\n" n
- | StringList n -> pr " char **%s;\n" n
- | Bool n -> pr " int %s;\n" n
- | Int n -> pr " int %s;\n" n
+ iteri (
+ fun i ->
+ function
+ | String n | FileIn n | FileOut n -> pr " char *%s;\n" n
+ | OptString n ->
+ (* http://www.perlmonks.org/?node_id=554277
+ * Note that the implicit handle argument means we have
+ * to add 1 to the ST(x) operator.
+ *)
+ pr " char *%s = SvOK(ST(%d)) ? SvPV_nolen(ST(%d)) : NULL;\n" n (i+1) (i+1)
+ | StringList n -> pr " char **%s;\n" n
+ | Bool n -> pr " int %s;\n" n
+ | Int n -> pr " int %s;\n" n
) (snd style);
let do_cleanups () =
pr " rb_raise (rb_eTypeError, \"expected string for parameter %%s of %%s\",\n";
pr " \"%s\", \"%s\");\n" n name
| OptString n ->
- pr " const char *%s = StringValueCStr (%sv);\n" n n
+ pr " const char *%s = !NIL_P (%sv) ? StringValueCStr (%sv) : NULL;\n" n n n
| StringList n ->
pr " char **%s;" n;
pr " {\n";
pr " }\n";
pr " %s[len] = NULL;\n" n;
pr " }\n";
- | Bool n
+ | Bool n ->
+ pr " int %s = RTEST (%sv);\n" n n
| Int n ->
pr " int %s = NUM2INT (%sv);\n" n n
) (snd style);
List.iter (
function
| String n
- | OptString n
| FileIn n
| FileOut n ->
pr " %s = (*env)->GetStringUTFChars (env, j%s, NULL);\n" n n
+ | OptString n ->
+ (* This is completely undocumented, but Java null becomes
+ * a NULL parameter.
+ *)
+ pr " %s = j%s ? (*env)->GetStringUTFChars (env, j%s, NULL) : NULL;\n" n n n
| StringList n ->
pr " %s_len = (*env)->GetArrayLength (env, j%s);\n" n n;
pr " %s = guestfs_safe_malloc (g, sizeof (char *) * (%s_len+1));\n" n n;
List.iter (
function
| String n
- | OptString n
| FileIn n
| FileOut n ->
pr " (*env)->ReleaseStringUTFChars (env, j%s, %s);\n" n n
+ | OptString n ->
+ pr " if (j%s)\n" n;
+ pr " (*env)->ReleaseStringUTFChars (env, j%s, %s);\n" n n
| StringList n ->
pr " for (i = 0; i < %s_len; ++i) {\n" n;
pr " jobject o = (*env)->GetObjectArrayElement (env, j%s, i);\n"
| Bool n -> pr " printf (\"%%s\\n\", %s ? \"true\" : \"false\");\n" n
| Int n -> pr " printf (\"%%d\\n\", %s);\n" n
) (snd style);
+ pr " /* Java changes stdout line buffering so we need this: */\n";
+ pr " fflush (stdout);\n";
pr " return 0;\n";
pr "}\n";
pr "\n" in
)
) tests
+and generate_ocaml_bindtests () =
+ generate_header OCamlStyle GPLv2;
+
+ pr "\
+let () =
+ let g = Guestfs.create () in
+";
+
+ let mkargs args =
+ String.concat " " (
+ List.map (
+ function
+ | CallString s -> "\"" ^ s ^ "\""
+ | CallOptString None -> "None"
+ | CallOptString (Some s) -> sprintf "(Some \"%s\")" s
+ | CallStringList xs ->
+ "[|" ^ String.concat ";" (List.map (sprintf "\"%s\"") xs) ^ "|]"
+ | CallInt i when i >= 0 -> string_of_int i
+ | CallInt i (* when i < 0 *) -> "(" ^ string_of_int i ^ ")"
+ | CallBool b -> string_of_bool b
+ ) args
+ )
+ in
+
+ generate_lang_bindtests (
+ fun f args -> pr " Guestfs.%s g %s;\n" f (mkargs args)
+ );
+
+ pr "print_endline \"EOF\"\n"
+
+and generate_perl_bindtests () =
+ pr "#!/usr/bin/perl -w\n";
+ generate_header HashStyle GPLv2;
+
+ pr "\
+use strict;
+
+use Sys::Guestfs;
+
+my $g = Sys::Guestfs->new ();
+";
+
+ let mkargs args =
+ String.concat ", " (
+ List.map (
+ function
+ | CallString s -> "\"" ^ s ^ "\""
+ | CallOptString None -> "undef"
+ | CallOptString (Some s) -> sprintf "\"%s\"" s
+ | CallStringList xs ->
+ "[" ^ String.concat "," (List.map (sprintf "\"%s\"") xs) ^ "]"
+ | CallInt i -> string_of_int i
+ | CallBool b -> if b then "1" else "0"
+ ) args
+ )
+ in
+
+ generate_lang_bindtests (
+ fun f args -> pr "$g->%s (%s);\n" f (mkargs args)
+ );
+
+ pr "print \"EOF\\n\"\n"
+
+and generate_python_bindtests () =
+ generate_header HashStyle GPLv2;
+
+ pr "\
+import guestfs
+
+g = guestfs.GuestFS ()
+";
+
+ let mkargs args =
+ String.concat ", " (
+ List.map (
+ function
+ | CallString s -> "\"" ^ s ^ "\""
+ | CallOptString None -> "None"
+ | CallOptString (Some s) -> sprintf "\"%s\"" s
+ | CallStringList xs ->
+ "[" ^ String.concat "," (List.map (sprintf "\"%s\"") xs) ^ "]"
+ | CallInt i -> string_of_int i
+ | CallBool b -> if b then "1" else "0"
+ ) args
+ )
+ in
+
+ generate_lang_bindtests (
+ fun f args -> pr "g.%s (%s)\n" f (mkargs args)
+ );
+
+ pr "print \"EOF\"\n"
+
+and generate_ruby_bindtests () =
+ generate_header HashStyle GPLv2;
+
+ pr "\
+require 'guestfs'
+
+g = Guestfs::create()
+";
+
+ let mkargs args =
+ String.concat ", " (
+ List.map (
+ function
+ | CallString s -> "\"" ^ s ^ "\""
+ | CallOptString None -> "nil"
+ | CallOptString (Some s) -> sprintf "\"%s\"" s
+ | CallStringList xs ->
+ "[" ^ String.concat "," (List.map (sprintf "\"%s\"") xs) ^ "]"
+ | CallInt i -> string_of_int i
+ | CallBool b -> string_of_bool b
+ ) args
+ )
+ in
+
+ generate_lang_bindtests (
+ fun f args -> pr "g.%s(%s)\n" f (mkargs args)
+ );
+
+ pr "print \"EOF\\n\"\n"
+
+and generate_java_bindtests () =
+ generate_header CStyle GPLv2;
+
+ pr "\
+import com.redhat.et.libguestfs.*;
+
+public class Bindtests {
+ public static void main (String[] argv)
+ {
+ try {
+ GuestFS g = new GuestFS ();
+";
+
+ let mkargs args =
+ String.concat ", " (
+ List.map (
+ function
+ | CallString s -> "\"" ^ s ^ "\""
+ | CallOptString None -> "null"
+ | CallOptString (Some s) -> sprintf "\"%s\"" s
+ | CallStringList xs ->
+ "new String[]{" ^
+ String.concat "," (List.map (sprintf "\"%s\"") xs) ^ "}"
+ | CallInt i -> string_of_int i
+ | CallBool b -> string_of_bool b
+ ) args
+ )
+ in
+
+ generate_lang_bindtests (
+ fun f args -> pr " g.%s (%s);\n" f (mkargs args)
+ );
+
+ pr "
+ System.out.println (\"EOF\");
+ }
+ catch (Exception exn) {
+ System.err.println (exn);
+ System.exit (1);
+ }
+ }
+}
+"
+
+and generate_haskell_bindtests () =
+ () (* XXX Haskell bindings need to be fleshed out. *)
+
+(* Language-independent bindings tests - we do it this way to
+ * ensure there is parity in testing bindings across all languages.
+ *)
+and generate_lang_bindtests call =
+ call "test0" [CallString "abc"; CallOptString (Some "def");
+ CallStringList []; CallBool false;
+ CallInt 0; CallString "123"; CallString "456"];
+ call "test0" [CallString "abc"; CallOptString None;
+ CallStringList []; CallBool false;
+ CallInt 0; CallString "123"; CallString "456"];
+ call "test0" [CallString ""; CallOptString (Some "def");
+ CallStringList []; CallBool false;
+ CallInt 0; CallString "123"; CallString "456"];
+ call "test0" [CallString ""; CallOptString (Some "");
+ CallStringList []; CallBool false;
+ CallInt 0; CallString "123"; CallString "456"];
+ call "test0" [CallString "abc"; CallOptString (Some "def");
+ CallStringList ["1"]; CallBool false;
+ CallInt 0; CallString "123"; CallString "456"];
+ call "test0" [CallString "abc"; CallOptString (Some "def");
+ CallStringList ["1"; "2"]; CallBool false;
+ CallInt 0; CallString "123"; CallString "456"];
+ call "test0" [CallString "abc"; CallOptString (Some "def");
+ CallStringList ["1"]; CallBool true;
+ CallInt 0; CallString "123"; CallString "456"];
+ call "test0" [CallString "abc"; CallOptString (Some "def");
+ CallStringList ["1"]; CallBool false;
+ CallInt (-1); CallString "123"; CallString "456"];
+ call "test0" [CallString "abc"; CallOptString (Some "def");
+ CallStringList ["1"]; CallBool false;
+ CallInt (-2); CallString "123"; CallString "456"];
+ call "test0" [CallString "abc"; CallOptString (Some "def");
+ CallStringList ["1"]; CallBool false;
+ CallInt 1; CallString "123"; CallString "456"];
+ call "test0" [CallString "abc"; CallOptString (Some "def");
+ CallStringList ["1"]; CallBool false;
+ CallInt 2; CallString "123"; CallString "456"];
+ call "test0" [CallString "abc"; CallOptString (Some "def");
+ CallStringList ["1"]; CallBool false;
+ CallInt 4095; CallString "123"; CallString "456"];
+ call "test0" [CallString "abc"; CallOptString (Some "def");
+ CallStringList ["1"]; CallBool false;
+ CallInt 0; CallString ""; CallString ""]
+
let output_to filename =
let filename_new = filename ^ ".new" in
chan := open_out filename_new;
generate_ocaml_c ();
close ();
+ let close = output_to "ocaml/bindtests.ml" in
+ generate_ocaml_bindtests ();
+ close ();
+
let close = output_to "perl/Guestfs.xs" in
generate_perl_xs ();
close ();
generate_perl_pm ();
close ();
+ let close = output_to "perl/bindtests.pl" in
+ generate_perl_bindtests ();
+ close ();
+
let close = output_to "python/guestfs-py.c" in
generate_python_c ();
close ();
generate_python_py ();
close ();
+ let close = output_to "python/bindtests.py" in
+ generate_python_bindtests ();
+ close ();
+
let close = output_to "ruby/ext/guestfs/_guestfs.c" in
generate_ruby_c ();
close ();
+ let close = output_to "ruby/bindtests.rb" in
+ generate_ruby_bindtests ();
+ close ();
+
let close = output_to "java/com/redhat/et/libguestfs/GuestFS.java" in
generate_java_java ();
close ();
generate_java_c ();
close ();
+ let close = output_to "java/Bindtests.java" in
+ generate_java_bindtests ();
+ close ();
+
let close = output_to "haskell/Guestfs.hs" in
generate_haskell_hs ();
close ();
+
+ let close = output_to "haskell/bindtests.hs" in
+ generate_haskell_bindtests ();
+ close ();
printf ("%d\n", integer);
printf ("%s\n", filein);
printf ("%s\n", fileout);
+ /* Java changes stdout line buffering so we need this: */
+ fflush (stdout);
return 0;
}