summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2010-12-02 17:28:33 +0000
committerSimon McVittie <smcv@debian.org>2010-12-02 17:28:33 +0000
commit28880468dddbb0e063d80dd003145a6322238507 (patch)
treef52124e6e169f2d5b3d1ed2389ce4857045dc33c
parentd3f57baf2a9e5e26e2365313abd2890239b6572a (diff)
downloaddbus-python-28880468dddbb0e063d80dd003145a6322238507.tar.gz
Add a regression test for fd.o #23831
-rw-r--r--.gitignore2
-rw-r--r--configure.ac4
-rw-r--r--test/Makefile.am8
-rw-r--r--test/import-repeatedly.c16
4 files changed, 29 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index d2304c9..3086c17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
run-with-tmp-session-bus.conf
test/data
+*.o
*.pyc
*.pyo
*.orig
@@ -45,3 +46,4 @@ INSTALL
/m4/ltsugar.m4
/m4/ltversion.m4
/m4/lt~obsolete.m4
+/test/test-import-repeatedly
diff --git a/configure.ac b/configure.ac
index c6cfd07..4d50669 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,7 @@ dnl (copied from libglade/configure.in)
m4_define([_LT_AC_TAGCONFIG],[])
AC_PROG_LIBTOOL
+AM_PROG_CC_C_O
AM_PATH_PYTHON(2.4.0)
@@ -52,6 +53,9 @@ AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
PLATFORM=`$PYTHON -c "from distutils import util; print util.get_platform()"`
AC_SUBST(PLATFORM)
+PYTHON_LIBS=`$PYTHON-config --ldflags`
+AC_SUBST([PYTHON_LIBS])
+
dnl Building documentation
AC_MSG_CHECKING([whether you want to build HTML docs])
diff --git a/test/Makefile.am b/test/Makefile.am
index a40c3d1..345d6da 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -37,7 +37,13 @@ TESTS_ENVIRONMENT = DBUS_TOP_SRCDIR="$(abs_top_srcdir)" \
PYTHONPATH="$(abs_top_builddir)/test/.libs:$(abs_top_srcdir):$(abs_top_srcdir)/test:$(abs_top_builddir)/_dbus_bindings/.libs:$(abs_top_builddir)/_dbus_glib_bindings/.libs" \
PYTHON='$(PYTHON)'
-TESTS = run-test.sh
+TESTS = run-test.sh test-import-repeatedly
+
+check_PROGRAMS = test-import-repeatedly
+
+test_import_repeatedly_SOURCES = import-repeatedly.c
+test_import_repeatedly_CPPFLAGS = $(PYTHON_INCLUDES)
+test_import_repeatedly_LDFLAGS = $(PYTHON_LIBS)
cross-test-server:
$(TESTS_ENVIRONMENT) $(PYTHON) $(top_srcdir)/test/cross-test-server.py
diff --git a/test/import-repeatedly.c b/test/import-repeatedly.c
new file mode 100644
index 0000000..4d177ed
--- /dev/null
+++ b/test/import-repeatedly.c
@@ -0,0 +1,16 @@
+/* Regression test for https://bugs.freedesktop.org/show_bug.cgi?id=23831 */
+
+#include <Python.h>
+
+int main(void)
+{
+ int i;
+
+ for (i = 0; i < 100; ++i) {
+ Py_Initialize();
+ PyRun_SimpleString("import dbus\n");
+ Py_Finalize();
+ }
+
+ return 0;
+}