swig/Examples/test-suite/c/Makefile.in
Vadim Zeitlin 43276f22a7 Enable testing some C++ wrappers code in the test suite
C++ wrappers still don't compile for about a hundred tests, but they do
compile for almost 500 more of them, so it's still valuable to be able
to check that there are no regressions for those that do work now.
2021-11-24 02:41:33 +01:00

284 lines
7.4 KiB
Makefile

#######################################################################
# Makefile for C test-suite
#######################################################################
LANGUAGE = c
C = gcc
CXX = g++
RUNMESUFFIX = _runme
srcdir = @srcdir@
top_srcdir = ../@top_srcdir@
top_builddir = ../@top_builddir@
# This can be set to ":" to avoid progress messages.
ECHO_PROGRESS := echo
CPP_TEST_CASES := \
c_backend_cpp_natural_std_string \
c_backend_cpp_exception
CPP11_TEST_CASES := \
cpp11_shared_ptr_const \
cpp11_shared_ptr_nullptr_in_containers \
cpp11_shared_ptr_overload \
cpp11_shared_ptr_upcast \
# The following tests are currently broken and need to be fixed.
FAILING_C_TESTS := \
arrays \
funcptr \
function_typedef \
lextype \
li_carrays \
nested \
nested_extend_c \
nested_structs \
typedef_struct \
union_parameter \
unions \
FAILING_CPP_TESTS := \
apply_signed_char \
array_member \
array_typedef_memberin \
arrayref \
arrays_dimensionless \
arrays_global \
arrays_global_twodim \
constant_pointers \
director_smartptr \
enum_thorough \
extend \
extend_default \
extern_c \
extern_template_method \
funcptr_cpp \
global_scope_types \
grouping \
import_nomodule \
li_attribute \
li_boost_shared_ptr_attribute \
li_std_deque \
li_std_wstring \
li_windows \
member_funcptr_galore \
member_pointer \
member_pointer_const \
mixed_types \
nested_class \
template_basic \
template_default \
template_enum \
template_explicit \
template_typedef_fnc \
typedef_array_member \
typedef_funcptr \
typedef_struct_cpp \
typemap_array_qualifiers \
typemap_namespace \
typemap_various \
using_extend \
varargs \
varargs_overload \
virtual_poly \
cpp11_ref_qualifiers \
cpp11_ref_qualifiers_typemaps \
cpp11_result_of \
cpp11_rvalue_reference \
cpp11_rvalue_reference2 \
cpp11_rvalue_reference3 \
cpp11_type_aliasing \
FAILING_MULTI_CPP_TESTS := \
clientdata_prop \
imports \
import_stl \
template_typedef_import \
# Ignore warnings about failing to apply typemaps because none are defined:
# usually there is no need for special typemaps in C.
char_binary.cpptest director_binary_string.cpptest li_typemaps.cpptest li_typemaps_apply.cpptest long_long_apply.cpptest: SWIGOPT += -w453
include $(srcdir)/../common.mk
# Overridden variables here
SWIGOPT += -w524 # Suppress SWIGWARN_LANG_EXPERIMENTAL warning
%.ctest: SWIGOPT += -nocxx
# Tests for which C++ wrappers currently don't compile.
apply_strings.cpptest \
autodoc.cpptest \
class_ignore.cpptest \
class_scope_weird.cpptest \
contract.cpptest \
conversion.cpptest \
conversion_namespace.cpptest \
conversion_ns_template.cpptest \
cpp11_default_delete.cpptest \
cpp11_explicit_conversion_operators.cpptest \
cpp11_final_override.cpptest \
cpp11_initializer_list.cpptest \
cpp11_noexcept.cpptest \
cpp11_shared_ptr_upcast.cpptest \
cpp11_strongly_typed_enumerations.cpptest \
cpp_typedef.cpptest \
default_constructor.cpptest \
derived_nested.cpptest \
director_basic.cpptest \
director_classes.cpptest \
director_conversion_operators.cpptest \
director_frob.cpptest \
director_property.cpptest \
director_string.cpptest \
dynamic_cast.cpptest \
extend_template_method.cpptest \
features.cpptest \
global_namespace.cpptest \
ignore_parameter.cpptest \
inherit_target_language.cpptest \
kind.cpptest \
li_boost_shared_ptr_bits.cpptest \
li_boost_shared_ptr_director.cpptest \
li_std_except.cpptest \
li_std_map.cpptest \
li_std_vector.cpptest \
li_std_vector_enum.cpptest \
li_std_vector_ptr.cpptest \
li_swigtype_inout.cpptest \
member_template.cpptest \
multiple_inheritance_abstract.cpptest \
multiple_inheritance_interfaces.cpptest \
multiple_inheritance_nspace.cpptest \
multiple_inheritance_shared_ptr.cpptest \
namespace_class.cpptest \
namespace_virtual_method.cpptest \
naturalvar_more.cpptest \
nested_ignore.cpptest \
nested_scope_flat.cpptest \
operator_pointer_ref.cpptest \
operbool.cpptest \
overload_arrays.cpptest \
overload_complicated.cpptest \
overload_null.cpptest \
overload_template.cpptest \
overload_template_fast.cpptest \
pure_virtual.cpptest \
refcount.cpptest \
rename1.cpptest \
rename2.cpptest \
rename3.cpptest \
rename4.cpptest \
rename_wildcard.cpptest \
return_const_value.cpptest \
smart_pointer_ignore.cpptest \
smart_pointer_member.cpptest \
smart_pointer_multi_typedef.cpptest \
smart_pointer_template_const_overload.cpptest \
smart_pointer_templatemethods.cpptest \
smart_pointer_typedef.cpptest \
template_arg_scope.cpptest \
template_const_ref.cpptest \
template_default_arg.cpptest \
template_default_arg_overloaded.cpptest \
template_default_vw.cpptest \
template_extend_overload.cpptest \
template_inherit_abstract.cpptest \
template_methods.cpptest \
template_nested.cpptest \
template_nested_flat.cpptest \
template_ns_enum2.cpptest \
template_opaque.cpptest \
template_qualifier.cpptest \
template_retvalue.cpptest \
template_static.cpptest \
template_typedef_class_template.cpptest \
template_typedef_cplx5.cpptest \
template_typemaps.cpptest \
template_typemaps_typedef.cpptest \
template_typemaps_typedef2.cpptest \
typename.cpptest \
valuewrapper_const.cpptest \
valuewrapper_opaque.cpptest \
: SWIGOPT += -nocxx
%.multicpptest: SWIGOPT += -nocxx
%.cpptest: SWIGOPT += -namespace $*
SRCDIR = ../$(srcdir)/
# Make function to check if we have an executable test for the given test base name.
define has_runme
-f $(srcdir)/$1$(RUNMESUFFIX).c -o -f $(srcdir)/$1$(RUNMESUFFIX).cxx
endef
# Rules for the different types of tests
%.cpptest:
$(setup)
+(cd $* && $(swig_and_compile_cpp))
+if [ $(call has_runme,$*) ]; then \
$(do_run_testcase); \
else \
cd $* && $(call syntax_check_testcase,$*); \
fi
%.ctest:
$(setup)
+(cd $* && $(swig_and_compile_c))
+if [ $(call has_runme,$*) ]; then \
$(do_run_testcase); \
else \
cd $* && $(call syntax_check_testcase,$*,_c); \
fi
%.multicpptest:
$(setup)
+(cd $* && $(swig_and_compile_multi_cpp))
+if [ $(call has_runme,$*) ]; then \
$(do_run_testcase); \
else \
cd $* && for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; do \
$(call syntax_check_testcase,$${f}) || exit 1; \
done; \
fi
# Makes a directory for the testcase if it does not exist
setup = \
if [ $(call has_runme,$*) ]; then \
$(ECHO_PROGRESS) "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE)" ; \
else \
$(ECHO_PROGRESS) "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
fi; \
if [ ! -d $* ]; then \
mkdir $*; \
fi;
# Checks the header syntax if there is no runnable testcase for it.
#
# The optional second argument can be "_c" to check syntax using C compiler only
# (by default both C and C++ compilers are used).
syntax_check_testcase = \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
SRCDIR='$(SRCDIR)' \
INTERFACEDIR='$(INTERFACEDIR)' \
C_HEADER=$1_wrap.h \
c_syntax_check$2
# Compiles C files then runs the testcase unconditionally.
do_run_testcase = \
cd $* && $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
SRCDIR='$(SRCDIR)' \
RUNME=$*$(RUNMESUFFIX) \
RUNME_EXT=$(patsubst .%,%,$(suffix $(wildcard $(srcdir)/$*$(RUNMESUFFIX).c*))) \
TARGET='$*' \
c_run
# Clean: remove testcase directories
%.clean:
@if [ -d $* ]; then \
rm -rf $*; \
fi;
clean:
@rm -f *_wrap.* *~ *.exe *.dll *.so *.out *runme