diff options
author | John Lenz <jlenz2@math.uiuc.edu> | 2006-10-14 08:19:27 +0000 |
---|---|---|
committer | John Lenz <jlenz2@math.uiuc.edu> | 2006-10-14 08:19:27 +0000 |
commit | 56904f30d011353943111f248b8596dd7b4cff11 (patch) | |
tree | 3115a756e1dae5a35fc0eaacba4347d117b8449f /Examples/test-suite/guilescm | |
parent | 5149b7b4f3dfc1faf486179267719e11585a5845 (diff) | |
download | swig-56904f30d011353943111f248b8596dd7b4cff11.tar.gz |
- Fix SF bug 1573892
- Minor change to chicken to make it work with version 2.5rc1
- add externaltest to chicken and guile modules
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9451 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples/test-suite/guilescm')
-rw-r--r-- | Examples/test-suite/guilescm/Makefile.in | 22 | ||||
-rw-r--r-- | Examples/test-suite/guilescm/ext_test.i | 19 | ||||
-rw-r--r-- | Examples/test-suite/guilescm/ext_test_external.cxx | 24 | ||||
-rw-r--r-- | Examples/test-suite/guilescm/ext_test_runme.scm | 19 |
4 files changed, 84 insertions, 0 deletions
diff --git a/Examples/test-suite/guilescm/Makefile.in b/Examples/test-suite/guilescm/Makefile.in index 0bcb166d1..9c2e8a45f 100644 --- a/Examples/test-suite/guilescm/Makefile.in +++ b/Examples/test-suite/guilescm/Makefile.in @@ -3,8 +3,12 @@ # Makefile for guile test-suite (with SCM API) ####################################################################### +EXTRA_TEST_CASES += ext_test.externaltest + include ../guile/Makefile +INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guilescm + VARIANT = # Refer to the guile directory for the run scripts SCRIPTPREFIX = ../guile/ @@ -31,3 +35,21 @@ swig_and_compile_multi_cpp = \ TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACE="$$f.i" \ $(LANGUAGE)$(VARIANT)_cpp; \ done + +%.externaltest: + $(local_setup) \ + ($(swig_and_compile_external); ) && \ + $(local_run_testcase) + +# Same as setup and run_testcase, but without the SCRIPTPREFIX (so the runme comes from the guilescm directory) +local_setup = \ + if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \ + echo "Checking testcase $* (with run test) under $(LANGUAGE) (with SCM API)" ; \ + else \ + echo "Checking testcase $* under $(LANGUAGE) (with SCM API)" ; \ + fi; + +local_run_testcase = \ + if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then ( \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(GUILE) -l $(srcdir)/$*$(SCRIPTSUFFIX);) \ + fi; diff --git a/Examples/test-suite/guilescm/ext_test.i b/Examples/test-suite/guilescm/ext_test.i new file mode 100644 index 000000000..8b117bb5a --- /dev/null +++ b/Examples/test-suite/guilescm/ext_test.i @@ -0,0 +1,19 @@ +%module 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); +%} + diff --git a/Examples/test-suite/guilescm/ext_test_external.cxx b/Examples/test-suite/guilescm/ext_test_external.cxx new file mode 100644 index 000000000..4b65f4953 --- /dev/null +++ b/Examples/test-suite/guilescm/ext_test_external.cxx @@ -0,0 +1,24 @@ +#include <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(result, 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 +} diff --git a/Examples/test-suite/guilescm/ext_test_runme.scm b/Examples/test-suite/guilescm/ext_test_runme.scm new file mode 100644 index 000000000..67add849e --- /dev/null +++ b/Examples/test-suite/guilescm/ext_test_runme.scm @@ -0,0 +1,19 @@ +(dynamic-call "scm_init_ext_test_module" (dynamic-link "./libext_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) |