Jamfile 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. # Boost regression-testing Jamfile
  2. # (C) Copyright David Abrahams 2001. Permission to copy, use, modify, sell and
  3. # distribute this software is granted provided this copyright notice appears in
  4. # all copies. This software is provided "as is" without express or implied
  5. # warranty, and with no claim as to its suitability for any purpose.
  6. subproject status ;
  7. # ----------- Jam rules for testing; test invocations at bottom ----------------#
  8. # boost-test sources : type : requirements [ : name ]
  9. #
  10. # Declares a test target. If name is not supplied, it is taken from the name of
  11. # the first source file, sans extension and directory path.
  12. #
  13. # type should be a target type (e.g. OBJ, DLL, LIB, EXE)
  14. #
  15. # RETURNS the name(s) of the generated test target(s).
  16. rule boost-test
  17. {
  18. local result ;
  19. {
  20. local requirements = $(3) ;
  21. local name = $(4) ;
  22. name ?= $(<[1]:D=:S=) ;
  23. # Make sure that targets don't become part of "all"
  24. local gSUPPRESS_FAKE_TARGETS = true ;
  25. result = [
  26. declare-local-target $(name)
  27. : $(<:R=$(BOOST_ROOT)) # sources
  28. : $(requirements) <include>$(BOOST_ROOT) # requirements
  29. : # default build
  30. : $(>) # target type
  31. ] ;
  32. }
  33. Clean clean : $(result) ;
  34. type-DEPENDS test : $(result) ;
  35. return $(result) ;
  36. }
  37. #######
  38. # failed-test-file test-file : fail-to-build-file
  39. #
  40. # a utility rule which causes test-file to be built successfully, only if
  41. # fail-to-build-file fails to build. Used for expected-failure tests.
  42. rule failed-test-file
  43. {
  44. DEPENDS $(<) : $(>) ;
  45. FAIL_EXPECTED $(>) ;
  46. }
  47. # to avoid building the test-file when it's actually up-to-date,
  48. # we need to put something in place of the thing it depends on.
  49. actions failed-test-file
  50. {
  51. echo building "$(>)" failed as expected > $(>)
  52. echo building "$(>)" failed as expected > $(<)
  53. }
  54. # declare-build-fail-test test-type : dependency-type
  55. #
  56. # A utility rule which declares test-type to be a target type which depends on
  57. # the /failed/ construction of a target of type dependency-type.
  58. rule declare-build-fail-test
  59. {
  60. gGENERATOR_FUNCTION($(<)) = fail-to-build ;
  61. gDEPENDENCY_TYPE($(<)) = $(>) ;
  62. SUF$(<) = .fail ;
  63. }
  64. # fail-to-build target.test : sources : requirements
  65. #
  66. # A target generator function for target types declared with
  67. # declare-build-fail-test, above.
  68. rule fail-to-build
  69. {
  70. # Get the target type of the current target out of the build properties
  71. local target-type = [ get-values <target-type> : $(gBUILD_PROPERTIES) ] ;
  72. # Get the type of target which will (hopefully) fail to build.
  73. local dependency-type = $(gDEPENDENCY_TYPE($(target-type))) ;
  74. # Get the actual name of the target which should fail to build
  75. local fail-target = $(<[1]:S=$(SUF$(dependency-type))) ;
  76. # Call dependency-type's generator function to (fail to) build the target
  77. local ignored = [
  78. $(gGENERATOR_FUNCTION($(dependency-type))) $(fail-target) : $(>) : $(3) ] ;
  79. # Generator functions don't handle this job for us; perhaps they should.
  80. set-target-variables $(fail-target)
  81. # The .test file goes with the other subvariant targets
  82. MakeLocate $(<) : $(LOCATE_TARGET) ;
  83. # Establish the dependency
  84. failed-test-file $(<) : $(fail-target) ;
  85. }
  86. ### Rules for testing whether a file compiles ###
  87. # Establish the rule which generates targets of type "OBJ". Should really go
  88. # into basic build system, but wasn't needed 'till now.
  89. gGENERATOR_FUNCTION(OBJ) = Object ;
  90. declare-build-fail-test COMPILE_FAIL : OBJ ;
  91. # Test that the given source-file(s) compile
  92. rule compile # source-file : fail : requirements
  93. {
  94. return [ boost-test $(<) : OBJ : $(3) ] ;
  95. }
  96. # Test that the given source-file(s) fail to compile
  97. rule compile-fail # source-file : requirements
  98. {
  99. return [ boost-test $(<) : COMPILE_FAIL : $(2) ] ;
  100. }
  101. ### Rules for testing whether a program runs ###
  102. gGENERATOR_FUNCTION(RUN_TEST) = run-test ;
  103. SUFRUN_TEST = .test ;
  104. rule run-test # target : sources : requirements
  105. {
  106. local executable = $(<:S=$(SUFEXE)) ;
  107. executable-file $(executable) : $(>) : $(3) ;
  108. set-target-variables $(executable) ;
  109. # The .test file goes with the other subvariant targets
  110. # normalization is a hack to get the slashes going the right way on Windoze
  111. local normalized-locate = [ FDirName [ split-path $(LOCATE_TARGET) ] ] ;
  112. MakeLocate $(<) : $(normalized-locate) ;
  113. DEPENDS $(<) : $(executable) $(gRUN_TEST_INPUT_FILES) ;
  114. INPUT_FILES on $(<) = $(gRUN_TEST_INPUT_FILES) ;
  115. ARGS on $(<) = $(gRUN_TEST_ARGS) ;
  116. capture-run-output $(<) : $(executable) ;
  117. if $(RUN_ALL_TESTS)
  118. {
  119. ALWAYS $(<) ;
  120. }
  121. }
  122. actions capture-run-output bind INPUT_FILES
  123. {
  124. $(>) $(ARGS) $(INPUT_FILES) > $(<:S=.error)
  125. $(CP) $(<:S=.error) $(<)
  126. $(RM) $(<:S=.error)
  127. }
  128. rule run # sources : args : input-files : requirements
  129. {
  130. local gRUN_TEST_ARGS = $(2) ;
  131. local gRUN_TEST_INPUT_FILES = $(3) ;
  132. SEARCH on $(3) = $(LOCATE_SOURCE) ;
  133. return [ boost-test $(<) : RUN_TEST : $(4) ] ;
  134. }
  135. declare-build-fail-test RUN_FAIL : RUN_TEST ;
  136. rule run-fail # sources : args : input-files : requirements
  137. {
  138. local gRUN_TEST_ARGS = $(2) ;
  139. local gRUN_TEST_INPUT_FILES = $(3) ;
  140. SEARCH on $(3) = $(LOCATE_SOURCE) ;
  141. return [ boost-test $(<) : RUN_FAIL : $(4) ] ;
  142. }
  143. ### Rules for testing whether a program links
  144. declare-build-fail-test LINK_FAIL : EXE ;
  145. rule link-fail # sources : requirements
  146. {
  147. return [ boost-test $(<) : LINK_FAIL : $(2) ] ;
  148. }
  149. ### Rules for grouping tests into suites:
  150. rule test-suite # pseudotarget-name : test-targets...
  151. {
  152. NOTFILE $(<) ;
  153. type-DEPENDS $(<) : $(>) ;
  154. }
  155. # ----------- Actual test invocations follow ----------------#
  156. test-suite config
  157. : [ run libs/config/test/config_test.cpp ]
  158. [ run libs/config/test/limits_test.cpp ]
  159. ;
  160. run libs/any/any_test.cpp ;
  161. run libs/array/array1.cpp ;
  162. test-suite concept_check
  163. : [ compile libs/concept_check/concept_check_test.cpp ]
  164. [ compile libs/concept_check/class_concept_check_test.cpp ]
  165. [ link-fail libs/concept_check/concept_check_fail_expected.cpp ]
  166. [ link-fail libs/concept_check/class_concept_fail_expected.cpp ]
  167. ;
  168. test-suite conversion
  169. : [ run libs/conversion/cast_test.cpp ]
  170. [ run libs/conversion/lexical_cast_test.cpp ]
  171. ;
  172. run libs/crc/crc_test.cpp ;
  173. run libs/function/test/function_test.cpp ;
  174. run libs/functional/function_test.cpp ;
  175. run libs/graph/test/graph.cpp ;
  176. test-suite integer
  177. : [ run libs/integer/cstdint_test.cpp ]
  178. [ run libs/integer/integer_test.cpp ]
  179. [ run libs/integer/integer_traits_test.cpp ]
  180. ;
  181. test-suite math
  182. : [ run libs/math/octonion/octonion_test.cpp ]
  183. [ run libs/math/quaternion/quaternion_test.cpp ]
  184. [ run libs/math/special_functions/special_functions_test.cpp ]
  185. ;
  186. run libs/pool/test/test_pool_alloc.cpp ;
  187. test-suite rational
  188. : [ run libs/rational/rational_example.cpp ]
  189. [ run libs/rational/rational_test.cpp ]
  190. ;
  191. test-suite random
  192. : [ run libs/random/random_test.cpp ]
  193. [ run libs/random/random_demo.cpp ]
  194. ;
  195. test-suite regex
  196. : [ run libs/regex/test/regress/regex_test.cpp : :
  197. $(BOOST_ROOT)/libs/regex/test/regress/tests.txt ]
  198. [ run libs/regex/test/regress/wregex_test.cpp : :
  199. $(BOOST_ROOT)/libs/regex/test/regress/tests.txt ]
  200. ;
  201. run libs/smart_ptr/smart_ptr_test.cpp ;
  202. test-suite static_assert
  203. : [ compile libs/static_assert/static_assert_test.cpp ]
  204. [ compile-fail libs/static_assert/static_assert_test_fail_1.cpp ]
  205. [ compile-fail libs/static_assert/static_assert_test_fail_2.cpp ]
  206. [ compile-fail libs/static_assert/static_assert_test_fail_3.cpp ]
  207. [ compile-fail libs/static_assert/static_assert_test_fail_4.cpp ]
  208. [ compile-fail libs/static_assert/static_assert_test_fail_5.cpp ]
  209. [ compile-fail libs/static_assert/static_assert_test_fail_6.cpp ]
  210. [ compile-fail libs/static_assert/static_assert_test_fail_7.cpp ]
  211. [ link-fail libs/static_assert/static_assert_test_fail_8.cpp ]
  212. ;
  213. run libs/test/example/test_tools_example.cpp ;
  214. run-fail libs/test/test/test_tools_fail2.cpp ;
  215. compile libs/timer/timer_test.cpp ;
  216. test-suite tokenizer
  217. : [ run libs/tokenizer/examples.cpp ]
  218. [ run libs/tokenizer/simple_example_1.cpp ]
  219. [ run libs/tokenizer/simple_example_2.cpp ]
  220. [ run libs/tokenizer/simple_example_3.cpp ]
  221. [ run libs/tokenizer/simple_example_4.cpp ]
  222. [ run libs/tokenizer/simple_example_5.cpp ]
  223. ;
  224. test-suite type_traits
  225. : [ run libs/type_traits/tests/alignment_test.cpp ]
  226. [ run libs/type_traits/tests/arithmetic_traits_test.cpp ]
  227. [ run libs/type_traits/tests/composite_traits_test.cpp ]
  228. [ run libs/type_traits/tests/cv_traits_test.cpp ]
  229. [ run libs/type_traits/tests/is_function_test.cpp ]
  230. [ run libs/type_traits/tests/is_convertible_test.cpp ]
  231. [ run libs/type_traits/tests/is_same_test.cpp ]
  232. [ run libs/type_traits/tests/object_type_traits_test.cpp ]
  233. [ run libs/type_traits/tests/transform_traits_test.cpp ]
  234. ;
  235. run libs/utility/call_traits_test.cpp : -u ;
  236. compile-fail libs/utility/checked_delete_test.cpp ;
  237. run libs/utility/compressed_pair_test.cpp : -u ;
  238. test-suite iterator_adaptors
  239. : [ run libs/utility/counting_iterator_test.cpp ]
  240. [ run libs/utility/iterator_adaptor_test.cpp ]
  241. [ compile-fail libs/utility/iter_adaptor_fail_expected1.cpp ]
  242. [ compile-fail libs/utility/iter_adaptor_fail_expected2.cpp ]
  243. [ run libs/utility/transform_iterator_test.cpp ]
  244. [ run libs/utility/indirect_iterator_test.cpp ]
  245. [ run libs/utility/iter_traits_gen_test.cpp ]
  246. [ run libs/utility/iterator_adaptor_examples.cpp ]
  247. [ run libs/utility/counting_iterator_example.cpp ]
  248. [ run libs/utility/filter_iterator_example.cpp ]
  249. [ run libs/utility/fun_out_iter_example.cpp ]
  250. [ run libs/utility/indirect_iterator_example.cpp ]
  251. [ run libs/utility/projection_iterator_example.cpp ]
  252. [ run libs/utility/reverse_iterator_example.cpp ]
  253. [ run libs/utility/transform_iterator_example.cpp ]
  254. ;
  255. run libs/utility/iterator_traits_test.cpp ;
  256. run libs/utility/iterators_test.cpp ;
  257. compile-fail libs/utility/noncopyable_test.cpp ;
  258. run libs/utility/numeric_traits_test.cpp ;
  259. run libs/utility/operators_test.cpp ;
  260. run libs/utility/tie_example.cpp ;
粤ICP备19079148号