Make guile test suite default to scm api

In other words guilescm becomes guile.
Deprecated gh api tests are moved to guilegh.
This commit is contained in:
Geert Janssens 2013-03-07 14:39:38 +01:00
commit 7dfe4a0653
5 changed files with 27 additions and 41 deletions

View file

@ -2,14 +2,16 @@
# Makefile for guile test-suite
#######################################################################
EXTRA_TEST_CASES += guile_ext_test.externaltest
LANGUAGE = guile
VARIANT = _gh
VARIANT =
SCRIPTSUFFIX = _runme.scm
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
GUILE = @GUILE@
GUILE_RUNTIME=-runtime
GUILE_RUNTIME=
C_TEST_CASES = long_long \
list_vector \
@ -20,7 +22,7 @@ C_TEST_CASES = long_long \
include $(srcdir)/../common.mk
# Overridden variables here
# none!
INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guile
# Custom tests - tests with additional commandline options
%.multicpptest: SWIGOPT += $(GUILE_RUNTIME)
@ -41,6 +43,11 @@ include $(srcdir)/../common.mk
+$(swig_and_compile_multi_cpp)
$(run_testcase)
%.externaltest:
$(setup)
+$(swig_and_compile_external)
$(run_testcase)
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \

View file

@ -0,0 +1,24 @@
#include <guile_ext_test_wrap_hdr.h>
#include <imports_a.h>
SCM test_create()
{
#define FUNC_NAME "test-create"
SCM result;
A *newobj;
swig_type_info *type;
newobj = new A();
type = SWIG_TypeQuery("A *");
result = SWIG_NewPointerObj(newobj, type, 1);
return result;
#undef FUNC_NAME
}
SCM test_is_pointer(SCM val)
{
#define FUNC_NAME "test-is-pointer"
return SCM_BOOL(SWIG_IsPointer(val));
#undef FUNC_NAME
}

View file

@ -0,0 +1,19 @@
(dynamic-call "scm_init_guile_ext_test_module" (dynamic-link "./libguile_ext_test.so"))
; This is a test for SF Bug 1573892
; If IsPointer is called before TypeQuery, the test-is-pointer will fail
; (i.e if the bottom two lines were moved to the top, the old code would succeed)
; only a problem when is-pointer is called first
(define a (new-A))
(if (not (test-is-pointer a))
(error "test-is-pointer failed!"))
(if (test-is-pointer 5)
(error "test-is-pointer thinks 5 is a pointer!"))
(define b (test-create))
(A-hello b)
(exit 0)

View file

@ -0,0 +1,19 @@
%module guile_ext_test
/* just use the imports_a.h header... for this test we only need a class */
%{
#include "imports_a.h"
%}
%include "imports_a.h"
%{
SCM test_create();
SCM test_is_pointer(SCM val);
%}
%init %{
scm_c_define_gsubr("test-create", 0, 0, 0, (swig_guile_proc) test_create);
scm_c_define_gsubr("test-is-pointer", 1, 0, 0, (swig_guile_proc) test_is_pointer);
%}

View file

@ -0,0 +1,28 @@
#######################################################################
# Makefile for guile test-suite (with SCM API)
#######################################################################
include ../guile/Makefile
# Overridden variables here
VARIANT = _gh
# Refer to the guile directory for the run scripts
SCRIPTPREFIX = ../guile/
GUILE_RUNTIME=-runtime
# Custom tests - tests with additional commandline options
# none!
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
setup = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE) (with GH API)" ; \
else \
echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with GH API)" ; \
fi