diff options
-rw-r--r-- | Examples/test-suite/common.mk | 19 | ||||
-rw-r--r-- | Examples/test-suite/csharp/Makefile.in | 6 | ||||
-rw-r--r-- | Examples/test-suite/java/custom_wallkw_runme.java | 25 |
3 files changed, 43 insertions, 7 deletions
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 5c6a332a4..9b54765ef 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -60,6 +60,7 @@ CSRCS = TARGETPREFIX = TARGETSUFFIX = SWIGOPT = -outcurrentdir -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE) +SWIGOPTCUSTOM = INCLUDES = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE) LIBS = -L. LIBPREFIX = lib @@ -468,6 +469,16 @@ MULTI_CPP_TEST_CASES += \ template_typedef_import \ multi_import +# Non standard testcases, usually using custom commandline options +# Testcase names are prefixed with custom_ and can be run individually using make testcase.customtest +CUSTOM_TEST_CASES = \ + custom_allkw \ + +# individual custom tests - any kind of customisation allowed here +# Note: $(basename $@) strips everything after and including the . in the target name +custom_wallkw.customtest: + $(MAKE) $(basename $@).cpptest SWIGOPTCUSTOM="-Wallkw" + NOT_BROKEN_TEST_CASES = $(CPP_TEST_CASES:=.cpptest) \ $(C_TEST_CASES:=.ctest) \ $(MULTI_CPP_TEST_CASES:=.multicpptest) \ @@ -500,14 +511,14 @@ broken: $(BROKEN_TEST_CASES) swig_and_compile_cpp = \ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \ SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \ - INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \ + INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $(SWIGOPTCUSTOM)" NOLINK=true \ TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \ $(LANGUAGE)$(VARIANT)_cpp swig_and_compile_c = \ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CSRCS="$(CSRCS)" \ SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \ - INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \ + INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $(SWIGOPTCUSTOM)" NOLINK=true \ TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \ $(LANGUAGE)$(VARIANT) @@ -515,7 +526,7 @@ swig_and_compile_multi_cpp = \ for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \ SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \ - INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \ + INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $(SWIGOPTCUSTOM)" NOLINK=true \ TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \ $(LANGUAGE)$(VARIANT)_cpp; \ done @@ -527,7 +538,7 @@ swig_and_compile_external = \ $(LANGUAGE)$(VARIANT)_externalhdr; \ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS) $*_external.cxx" \ SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \ - INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \ + INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $(SWIGOPTCUSTOM)" NOLINK=true \ TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \ $(LANGUAGE)$(VARIANT)_cpp diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in index 5fb547f3f..df5f1a7fd 100644 --- a/Examples/test-suite/csharp/Makefile.in +++ b/Examples/test-suite/csharp/Makefile.in @@ -28,7 +28,7 @@ CUSTOM_TEST_CASES = \ include $(srcdir)/../common.mk # Overridden variables here -SWIGOPT += -namespace $*Namespace $(SWIGOPTSPECIAL) +SWIGOPT += -namespace $*Namespace INTERFACEDIR = ../../ CSHARPFLAGSSPECIAL = @@ -51,9 +51,9 @@ CSHARPFLAGSSPECIAL = # Rules for custom tests intermediary_classname.customtest: - $(MAKE) intermediary_classname.cpptest SWIGOPTSPECIAL="-dllimport intermediary_classname" + $(MAKE) $(basename $@).cpptest SWIGOPTCUSTOM="-dllimport intermediary_classname" csharp_lib_arrays.customtest: - $(MAKE) csharp_lib_arrays.cpptest CSHARPFLAGSSPECIAL="-unsafe" + $(MAKE) $(basename $@).cpptest CSHARPFLAGSSPECIAL="-unsafe" # Makes a directory for the testcase if it does not exist setup = \ diff --git a/Examples/test-suite/java/custom_wallkw_runme.java b/Examples/test-suite/java/custom_wallkw_runme.java new file mode 100644 index 000000000..08d9539bd --- /dev/null +++ b/Examples/test-suite/java/custom_wallkw_runme.java @@ -0,0 +1,25 @@ + +import custom_wallkw.*; + +public class custom_wallkw_runme { + + static { + try { + System.loadLibrary("custom_wallkw"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + if (!custom_wallkw.c_clone().equals("clone")) + throw new RuntimeException("clone_c keyword fail"); + if (!custom_wallkw._delegate().equals("delegate")) + throw new RuntimeException("delegate keyword fail"); + if (!custom_wallkw._pass().equals("pass")) + throw new RuntimeException("pass keyword fail"); + if (!custom_wallkw.C_alias().equals("alias")) + throw new RuntimeException("alias keyword fail"); + } +} |