summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-03-30 20:28:30 -0700
committerAndy Wingo <wingo@pobox.com>2009-03-30 20:28:30 -0700
commita44c43368b5a6c423e0498b6df734b969df2fdde (patch)
treebfc1dfc82d7cd608650c1914839846a27daf714f
parent9c0cd73e614e338528e1d323dedec54f3dfad1d8 (diff)
add test case for load-extension bug, fix gdb-uninstalled-guile
* test-suite/standalone/test-extensions: * test-suite/standalone/test-extensions-lib.c: * test-suite/standalone/Makefile.am: Add a test case for the load-extension bug. * meta/gdb-uninstalled-guile.in: Fix the path to include meta/.
-rw-r--r--meta/gdb-uninstalled-guile.in2
-rw-r--r--test-suite/standalone/Makefile.am9
-rwxr-xr-xtest-suite/standalone/test-extensions14
-rw-r--r--test-suite/standalone/test-extensions-lib.c43
4 files changed, 67 insertions, 1 deletions
diff --git a/meta/gdb-uninstalled-guile.in b/meta/gdb-uninstalled-guile.in
index 457ab2bd7..aa33e0799 100644
--- a/meta/gdb-uninstalled-guile.in
+++ b/meta/gdb-uninstalled-guile.in
@@ -34,5 +34,5 @@
set -e
# env (set by configure)
top_builddir="@top_builddir_absolute@"
-exec ${top_builddir}/uninstalled-env libtool --mode=execute \
+exec ${top_builddir}/meta/uninstalled-env libtool --mode=execute \
gdb --args ${top_builddir}/libguile/guile "$@"
diff --git a/test-suite/standalone/Makefile.am b/test-suite/standalone/Makefile.am
index b8d6e81e4..9bfd801d8 100644
--- a/test-suite/standalone/Makefile.am
+++ b/test-suite/standalone/Makefile.am
@@ -125,6 +125,15 @@ test_scm_take_locale_symbol_LDADD = ${top_builddir}/libguile/libguile.la
check_PROGRAMS += test-scm-take-locale-symbol
TESTS += test-scm-take-locale-symbol
+# test-extensions
+noinst_LTLIBRARIES += libtest-extensions.la
+libtest_extensions_la_SOURCES = test-extensions-lib.c
+libtest_extensions_la_CFLAGS = ${test_cflags}
+libtest_extensions_la_LDFLAGS = -no-undefined -rpath `pwd` # so libtool will really build an .so
+libtest_extensions_la_LIBADD = ${top_builddir}/libguile/libguile.la
+check_SCRIPTS += test-extensions
+TESTS += test-extensions
+
if BUILD_PTHREAD_SUPPORT
diff --git a/test-suite/standalone/test-extensions b/test-suite/standalone/test-extensions
new file mode 100755
index 000000000..bea432de2
--- /dev/null
+++ b/test-suite/standalone/test-extensions
@@ -0,0 +1,14 @@
+#!/bin/sh
+exec guile -q -s "$0" "$@"
+!#
+
+(load-extension "libtest-extensions" "libtest_extensions_init")
+(load-extension "libtest-extensions" "libtest_extensions_init2")
+
+(or (= init2-count 1)
+ (error "init2 called more or less than one time"))
+
+
+;; Local Variables:
+;; mode: scheme
+;; End: \ No newline at end of file
diff --git a/test-suite/standalone/test-extensions-lib.c b/test-suite/standalone/test-extensions-lib.c
new file mode 100644
index 000000000..25b3a38a9
--- /dev/null
+++ b/test-suite/standalone/test-extensions-lib.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1999,2000,2001,2003, 2006, 2008 Free Software Foundation, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libguile.h>
+
+SCM init2_count;
+
+void libtest_extensions_init2 (void);
+void libtest_extensions_init (void);
+
+void
+libtest_extensions_init2 (void)
+{
+ scm_variable_set_x (init2_count,
+ scm_from_int (scm_to_int (scm_variable_ref (init2_count)) + 1));
+}
+
+void
+libtest_extensions_init (void)
+{
+ scm_c_define ("init2-count", scm_from_int (0));
+ init2_count = scm_permanent_object (scm_c_lookup ("init2-count"));
+ scm_c_register_extension ("libtest-extensions", "libtest_extensions_init2",
+ (scm_t_extension_init_func)libtest_extensions_init2, NULL);
+}