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