PageRenderTime 33ms CodeModel.GetById 2ms app.highlight 25ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/common.mk

#
Makefile | 633 lines | 528 code | 37 blank | 68 comment | 2 complexity | 32d4d905bd0fa1de4392a2efcbc5f41e MD5 | raw file
  1#######################################################################
  2# SWIG test suite makefile.
  3# The test suite comprises many different test cases, which have
  4# typically produced bugs in the past. The aim is to have the test 
  5# cases compiling for every language modules. Some testcase have
  6# a runtime test which is written in each of the module's language.
  7#
  8# This makefile runs SWIG on the testcases, compiles the c/c++ code
  9# then builds the object code for use by the language.
 10# To complete a test in a language follow these guidelines: 
 11# 1) Add testcases to CPP_TEST_CASES (c++) or C_TEST_CASES (c) or
 12#    MULTI_CPP_TEST_CASES (multi-module c++ tests)
 13# 2) If not already done, create a makefile which:
 14#    a) Defines LANGUAGE matching a language rule in Examples/Makefile, 
 15#       for example LANGUAGE = java
 16#    b) Define rules for %.ctest, %.cpptest, %.multicpptest and %.clean.
 17#    c) Define srcdir, top_srcdir and top_builddir (these are the
 18#       equivalent to configure's variables of the same name).
 19# 3) One off special commandline options for a testcase can be added.
 20#    See custom tests below.
 21#
 22# The 'check' target runs the testcases including SWIG invocation,
 23# C/C++ compilation, target language compilation (if any) and runtime
 24# test (if there is an associated 'runme' test).
 25# The 'partialcheck' target only invokes SWIG.
 26# The 'all' target is the same as the 'check' target but also includes
 27# known broken testcases.
 28# The 'clean' target cleans up.
 29#
 30# Note that the RUNTOOL, COMPILETOOL and SWIGTOOL variables can be used
 31# for invoking tools for the runtime tests and target language 
 32# compiler (eg javac), and on SWIG respectively. For example, valgrind
 33# can be used for memory checking of the runtime tests using:
 34#   make RUNTOOL="valgrind --leak-check=full"
 35# and valgrind can be used when invoking SWIG using:
 36#   make SWIGTOOL="valgrind --tool=memcheck --trace-children=yes"
 37#    Note: trace-children needed because of preinst-swig shell wrapper
 38#    to the swig executable.
 39#
 40# An individual test run can be debugged easily:
 41#   make director_string.cpptest RUNTOOL="gdb --args"
 42#
 43# The variables below can be overridden after including this makefile
 44#######################################################################
 45
 46#######################################################################
 47# Variables
 48#######################################################################
 49
 50ifneq (,$(USE_VALGRIND))
 51VALGRIND_OPT = --leak-check=full
 52RUNTOOL    = valgrind $(VALGRIND_OPT)
 53else
 54RUNTOOL    =
 55endif
 56COMPILETOOL=
 57SWIGTOOL   =
 58
 59SWIG       = $(SWIGTOOL) $(top_builddir)/preinst-swig
 60SWIG_LIB   = $(top_srcdir)/Lib
 61TEST_SUITE = test-suite
 62EXAMPLES   = Examples
 63CXXSRCS    = 
 64CSRCS      = 
 65TARGETPREFIX = 
 66TARGETSUFFIX = 
 67SWIGOPT    = -outcurrentdir -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
 68INCLUDES   = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
 69LIBS       = -L.
 70LIBPREFIX  = lib
 71ACTION     = check
 72INTERFACEDIR = $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/
 73
 74#
 75# Please keep test cases in alphabetical order.
 76# Note that any whitespace after the last entry in each list will break make
 77#
 78
 79# Broken C++ test cases. (Can be run individually using: make testcase.cpptest)
 80CPP_TEST_BROKEN += \
 81	constants \
 82	cpp_broken \
 83	exception_partial_info \
 84	extend_variable \
 85	li_std_vector_ptr \
 86	li_boost_shared_ptr_template \
 87	overload_complicated \
 88	template_default_pointer \
 89	template_expr
 90
 91
 92# Broken C test cases. (Can be run individually using: make testcase.ctest)
 93C_TEST_BROKEN += \
 94	tag_no_clash_with_variable
 95
 96
 97# C++ test cases. (Can be run individually using: make testcase.cpptest)
 98CPP_TEST_CASES += \
 99	abstract_access \
100	abstract_inherit \
101	abstract_inherit_ok \
102	abstract_signature \
103	abstract_typedef \
104	abstract_typedef2 \
105	abstract_virtual \
106	access_change \
107	add_link \
108	aggregate \
109	allowexcept \
110	allprotected \
111	anonymous_bitfield \
112	apply_signed_char \
113	apply_strings \
114	argout \
115	array_member \
116	array_typedef_memberin \
117	arrayref \
118	arrays_dimensionless \
119	arrays_global \
120	arrays_global_twodim \
121	arrays_scope \
122	autodoc \
123	bloody_hell \
124	bools \
125	catches \
126	cast_operator \
127	casts \
128	char_binary \
129	char_strings \
130	class_forward \
131	class_ignore \
132	class_scope_weird \
133	compactdefaultargs \
134	const_const_2 \
135	constant_pointers \
136	constover \
137	constructor_copy \
138	constructor_exception \
139	constructor_explicit \
140	constructor_ignore \
141	constructor_rename \
142	constructor_value \
143	contract \
144	conversion \
145	conversion_namespace \
146	conversion_ns_template \
147	cplusplus_throw \
148	cpp_basic \
149	cpp_enum \
150	cpp_namespace \
151	cpp_nodefault \
152	cpp_static \
153	cpp_typedef \
154	default_args \
155	default_arg_values \
156	default_constructor \
157	defvalue_constructor \
158	derived_byvalue \
159	derived_nested \
160	destructor_reprotected \
161	director_abstract \
162	director_alternating \
163	director_basic \
164	director_binary_string \
165	director_classes \
166	director_classic \
167	director_constructor \
168	director_default \
169	director_detect \
170	director_enum \
171	director_exception \
172	director_extend \
173	director_finalizer \
174	director_frob \
175	director_ignore \
176	director_keywords \
177	director_namespace_clash \
178	director_nspace \
179	director_nested \
180	director_overload \
181	director_primitives \
182	director_protected \
183	director_protected_overloaded \
184	director_redefined \
185	director_thread \
186	director_unroll \
187	director_using \
188	director_wombat \
189	disown \
190	dynamic_cast \
191	empty \
192	enum_rename \
193	enum_scope_template \
194	enum_template \
195	enum_thorough \
196	enum_var \
197	evil_diamond \
198	evil_diamond_ns \
199	evil_diamond_prop \
200	exception_order \
201	extend \
202	extend_constructor_destructor \
203	extend_default \
204	extend_placement \
205	extend_template \
206	extend_template_ns \
207	extend_typedef_class \
208	extern_c \
209	extern_namespace \
210	extern_throws \
211	expressions \
212	features \
213	fragments \
214	friends \
215	funcptr_cpp \
216	fvirtual \
217	global_namespace \
218	global_ns_arg \
219	global_scope_types \
220	global_vars \
221	grouping \
222	ignore_parameter \
223	import_nomodule \
224	inherit \
225	inherit_missing \
226	inherit_same_name \
227	inherit_target_language \
228	inherit_void_arg \
229	inline_initializer \
230	insert_directive \
231        keyword_rename \
232	kind \
233	langobj \
234	li_attribute \
235	li_boost_shared_ptr \
236	li_boost_shared_ptr_bits \
237	li_boost_shared_ptr_template \
238	li_carrays \
239	li_cdata \
240	li_cpointer \
241	li_stdint \
242	li_typemaps \
243	li_typemaps_apply \
244	li_windows \
245	long_long_apply \
246	memberin_extend \
247	member_funcptr_galore \
248	member_pointer \
249	member_template \
250	minherit \
251	minherit2 \
252	mixed_types \
253	multiple_inheritance \
254	name_cxx \
255	name_warnings \
256	namespace_class \
257	namespace_enum \
258	namespace_extend \
259	namespace_nested \
260	namespace_spaces \
261	namespace_template \
262	namespace_typedef_class \
263	namespace_typemap \
264	namespace_union \
265	namespace_virtual_method \
266	nspace \
267	nspace_extend \
268	naturalvar \
269	nested_class \
270	nested_comment \
271	nested_workaround \
272	newobject1 \
273	null_pointer \
274	operator_overload \
275	operator_overload_break \
276	operator_pointer_ref \
277        operbool \
278	ordering \
279	overload_copy \
280	overload_extend \
281	overload_rename \
282	overload_return_type \
283	overload_simple \
284	overload_subtype \
285	overload_template \
286	overload_template_fast \
287	pointer_reference \
288	preproc_constants \
289	primitive_ref \
290	private_assign \
291	protected_rename \
292	pure_virtual \
293	redefined \
294	redefined_not \
295	refcount \
296	reference_global_vars \
297	register_par \
298	rename1 \
299	rename2 \
300	rename3 \
301	rename4 \
302	rename_scope \
303	rename_simple \
304	rename_strip_encoder \
305	rename_pcre_encoder \
306	rename_pcre_enum \
307	restrict_cplusplus \
308	return_const_value \
309	return_value_scope \
310	rname \
311	samename \
312	sizet \
313	smart_pointer_const \
314	smart_pointer_const2 \
315	smart_pointer_const_overload \
316	smart_pointer_extend \
317	smart_pointer_member \
318	smart_pointer_multi \
319	smart_pointer_multi_typedef \
320	smart_pointer_namespace \
321	smart_pointer_namespace2 \
322	smart_pointer_not \
323	smart_pointer_overload \
324	smart_pointer_protected \
325	smart_pointer_rename \
326	smart_pointer_simple \
327	smart_pointer_static \
328	smart_pointer_template_const_overload \
329	smart_pointer_templatemethods \
330	smart_pointer_templatevariables \
331	smart_pointer_typedef \
332	special_variables \
333	special_variable_macros \
334	static_array_member \
335	static_const_member \
336	static_const_member_2 \
337	struct_initialization_cpp \
338	struct_value \
339	symbol_clash \
340	template_arg_replace \
341	template_arg_scope \
342	template_arg_typename \
343	template_array_numeric \
344	template_basic \
345	template_base_template \
346	template_classes \
347	template_const_ref \
348	template_construct \
349	template_default \
350	template_default2 \
351	template_default_arg \
352	template_default_class_parms \
353	template_default_class_parms_typedef \
354	template_default_inherit \
355	template_default_qualify \
356	template_default_vw \
357	template_enum \
358	template_enum_ns_inherit \
359	template_enum_typedef \
360	template_explicit \
361	template_extend1 \
362	template_extend2 \
363	template_extend_overload \
364	template_extend_overload_2 \
365	template_forward \
366	template_inherit \
367	template_inherit_abstract \
368	template_int_const \
369	template_methods \
370	template_nested \
371	template_nested_typemaps \
372	template_ns \
373	template_ns2 \
374	template_ns3 \
375	template_ns4 \
376	template_ns_enum \
377	template_ns_enum2 \
378	template_ns_inherit \
379	template_ns_scope \
380	template_partial_arg \
381	template_partial_specialization \
382	template_partial_specialization_typedef \
383	template_qualifier \
384	template_qualifier \
385	template_ref_type \
386	template_rename \
387	template_retvalue \
388	template_specialization \
389	template_specialization_defarg \
390	template_specialization_enum \
391	template_static \
392	template_tbase_template \
393	template_template_parameters \
394	template_typedef \
395	template_typedef_class_template \
396	template_typedef_cplx \
397	template_typedef_cplx2 \
398	template_typedef_cplx3 \
399	template_typedef_cplx4 \
400	template_typedef_cplx5 \
401	template_typedef_funcptr \
402	template_typedef_inherit \
403	template_typedef_ns \
404	template_typedef_ptr \
405	template_typedef_rec \
406	template_typemaps \
407	template_typemaps_typedef \
408	template_typemaps_typedef2 \
409	template_using \
410	template_virtual \
411	template_whitespace \
412	threads \
413	threads_exception \
414	throw_exception \
415	typedef_array_member \
416	typedef_class \
417	typedef_funcptr \
418	typedef_inherit \
419	typedef_mptr \
420	typedef_reference \
421	typedef_scope \
422	typedef_sizet \
423	typedef_struct \
424	typemap_arrays \
425	typemap_delete \
426	typemap_global_scope \
427	typemap_manyargs \
428	typemap_namespace \
429	typemap_ns_using \
430	typemap_numinputs \
431	typemap_template \
432	typemap_out_optimal \
433	typemap_qualifier_strip \
434	typemap_variables \
435	typemap_various \
436	typename \
437	types_directive \
438	union_scope \
439	using1 \
440	using2 \
441	using_composition \
442	using_extend \
443	using_inherit \
444	using_namespace \
445	using_namespace_loop \
446	using_pointers \
447	using_private \
448	using_protected \
449	valuewrapper \
450	valuewrapper_base \
451	valuewrapper_const \
452	valuewrapper_opaque \
453	varargs \
454	varargs_overload \
455	virtual_destructor \
456	virtual_poly \
457	virtual_vs_nonvirtual_base \
458	voidtest \
459	wallkw \
460	wrapmacro
461
462#
463# Put all the heavy STD/STL cases here, where they can be skipped if needed
464#
465CPP_STD_TEST_CASES += \
466	director_string \
467	ignore_template_constructor \
468	li_std_combinations \
469	li_std_containers_int \
470	li_std_deque \
471	li_std_except \
472	li_std_map \
473        li_std_pair \
474	li_std_string \
475	li_std_vector \
476	li_std_vector_enum \
477	naturalvar \
478	smart_pointer_inherit \
479	template_typedef_fnc \
480	template_type_namespace \
481	template_opaque
482#        li_std_list
483
484
485ifndef SKIP_CPP_STD_CASES
486CPP_TEST_CASES += ${CPP_STD_TEST_CASES}
487endif
488
489
490# C test cases. (Can be run individually using: make testcase.ctest)
491C_TEST_CASES += \
492	arrays \
493	char_constant \
494	const_const \
495	constant_expr \
496	empty \
497	enums \
498	extern_declaration \
499	funcptr \
500	function_typedef \
501	immutable_values \
502	inctest \
503	integers \
504        keyword_rename \
505	lextype \
506	li_carrays \
507	li_cdata \
508	li_cmalloc \
509	li_constraints \
510	li_cpointer \
511	li_math \
512	long_long \
513	memberin_extend_c \
514	name \
515	nested \
516	nested_structs \
517	newobject2 \
518	overload_extend \
519	overload_extendc \
520	preproc \
521	preproc_constants_c \
522	preproc_defined \
523	preproc_include \
524	preproc_line_file \
525	ret_by_value \
526	simple_array \
527	sizeof_pointer \
528	sneaky1 \
529	struct_rename \
530	struct_initialization \
531	typedef_struct \
532	typemap_subst \
533	union_parameter \
534	unions
535
536
537# Multi-module C++ test cases . (Can be run individually using make testcase.multicpptest)
538MULTI_CPP_TEST_CASES += \
539	clientdata_prop \
540	imports \
541	import_stl \
542	packageoption \
543	mod \
544	template_typedef_import \
545	multi_import
546
547# Custom tests - tests with additional commandline options
548wallkw.cpptest: SWIGOPT += -Wallkw
549preproc_include.ctest: SWIGOPT += -includeall
550
551
552NOT_BROKEN_TEST_CASES =	$(CPP_TEST_CASES:=.cpptest) \
553			$(C_TEST_CASES:=.ctest) \
554			$(MULTI_CPP_TEST_CASES:=.multicpptest) \
555			$(EXTRA_TEST_CASES)
556
557BROKEN_TEST_CASES = 	$(CPP_TEST_BROKEN:=.cpptest) \
558			$(C_TEST_BROKEN:=.ctest)
559
560ALL_CLEAN = 		$(CPP_TEST_CASES:=.clean) \
561			$(C_TEST_CASES:=.clean) \
562			$(MULTI_CPP_TEST_CASES:=.clean) \
563			$(CPP_TEST_BROKEN:=.clean) \
564			$(C_TEST_BROKEN:=.clean)
565
566#######################################################################
567# The following applies for all module languages
568#######################################################################
569all:	$(BROKEN_TEST_CASES) $(NOT_BROKEN_TEST_CASES)
570
571check: 	$(NOT_BROKEN_TEST_CASES)
572
573# partialcheck target runs SWIG only, ie no compilation or running of tests (for a subset of languages)
574partialcheck:
575	$(MAKE) check CC=true CXX=true LDSHARED=true CXXSHARED=true RUNTOOL=true COMPILETOOL=true
576
577broken: $(BROKEN_TEST_CASES)
578
579swig_and_compile_cpp =  \
580	$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
581	SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
582	INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
583	TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
584	$(LANGUAGE)$(VARIANT)_cpp
585
586swig_and_compile_c =  \
587	$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CSRCS="$(CSRCS)" \
588	SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
589	INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
590	TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
591	$(LANGUAGE)$(VARIANT)
592
593swig_and_compile_multi_cpp = \
594	for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
595	  $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
596	  SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
597	  INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
598	  TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
599	  $(LANGUAGE)$(VARIANT)_cpp; \
600	done
601
602swig_and_compile_external =  \
603	$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
604	SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
605	TARGET="$*_wrap_hdr.h" \
606	$(LANGUAGE)$(VARIANT)_externalhdr; \
607	$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS) $*_external.cxx" \
608	SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
609	INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
610	TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
611	$(LANGUAGE)$(VARIANT)_cpp
612
613swig_and_compile_runtime = \
614
615setup = \
616	if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then	  \
617	  echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE)" ; \
618	else								  \
619	  echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ;		  \
620	fi;
621
622
623
624#######################################################################
625# Clean
626#######################################################################
627clean: $(ALL_CLEAN)
628
629distclean: clean
630	@rm -f Makefile
631
632.PHONY: all check partialcheck broken clean distclean 
633