summaryrefslogtreecommitdiffstats
path: root/python
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 /python
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 'python')
-rw-r--r--python/Makefile.am9
-rw-r--r--python/bindtests.py37
-rwxr-xr-xpython/run-bindtests22
-rwxr-xr-xpython/run-python-tests24
4 files changed, 89 insertions, 3 deletions
diff --git a/python/Makefile.am b/python/Makefile.am
index 4c72bbd4..dcd06253 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -18,6 +18,9 @@
EXTRA_DIST = \
guestfs.py \
guestfs-py.c \
+ bindtests.py \
+ run-bindtests \
+ run-python-tests \
t/*.py
if HAVE_PYTHON
@@ -34,8 +37,8 @@ libguestfsmod_la_LIBADD = $(top_builddir)/src/libguestfs.la
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
diff --git a/python/bindtests.py b/python/bindtests.py
new file mode 100644
index 00000000..09f5d5ec
--- /dev/null
+++ b/python/bindtests.py
@@ -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.
+
+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"
diff --git a/python/run-bindtests b/python/run-bindtests
new file mode 100755
index 00000000..17448c3b
--- /dev/null
+++ b/python/run-bindtests
@@ -0,0 +1,22 @@
+#!/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
diff --git a/python/run-python-tests b/python/run-python-tests
new file mode 100755
index 00000000..90e38b39
--- /dev/null
+++ b/python/run-python-tests
@@ -0,0 +1,24 @@
+#!/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
+