Jamfile 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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. # Ugly hack to get the pathes transferred. See the link rule in boost-base.jam.
  110. RUN_PATH on $(<) = [ join $(gRUN_PATH($(executable))) $(RUN_PATH) : $(SPLITPATH) ] ;
  111. if $(UNIX)
  112. {
  113. RUN_LD_LIBRARY_PATH on $(<) = [ join $(gRUN_LD_LIBRARY_PATH($(executable))) $(RUN_LD_LIBRARY_PATH) : $(SPLITPATH) ] ;
  114. }
  115. # The .test file goes with the other subvariant targets
  116. # normalization is a hack to get the slashes going the right way on Windoze
  117. local LOCATE_TARGET = [ FDirName [ split-path $(LOCATE_TARGET) ] ] ;
  118. MakeLocate $(<) : $(LOCATE_TARGET) ;
  119. DEPENDS $(<) : $(executable) $(gRUN_TEST_INPUT_FILES) ;
  120. INPUT_FILES on $(<) = $(gRUN_TEST_INPUT_FILES) ;
  121. ARGS on $(<) = $(gRUN_TEST_ARGS) ;
  122. capture-run-output $(<) : $(executable) ;
  123. if $(RUN_ALL_TESTS)
  124. {
  125. ALWAYS $(<) ;
  126. }
  127. }
  128. # The rule is just used for argument checking
  129. rule capture-run-output ( target : executable + ) { }
  130. if $(UNIX)
  131. {
  132. actions capture-run-output bind INPUT_FILES
  133. {
  134. $(SHELL_SET)PATH=$(RUN_PATH)
  135. $(SHELL_EXPORT)PATH
  136. $(SHELL_SET)LD_LIBRARY_PATH=$(RUN_LD_LIBRARY_PATH)
  137. $(SHELL_EXPORT)LD_LIBRARY_PATH
  138. $(>) $(ARGS) $(INPUT_FILES) > $(<:S=.error)
  139. $(CP) $(<:S=.error) $(<)
  140. $(RM) $(<:S=.error)
  141. }
  142. }
  143. else
  144. {
  145. actions capture-run-output bind INPUT_FILES
  146. {
  147. $(SHELL_SET)PATH=$(RUN_PATH)
  148. $(SHELL_EXPORT)PATH
  149. $(>) $(ARGS) $(INPUT_FILES) > $(<:S=.error)
  150. $(CP) $(<:S=.error) $(<)
  151. $(RM) $(<:S=.error)
  152. }
  153. }
  154. rule run # sources : args : input-files : requirements
  155. {
  156. local gRUN_TEST_ARGS = $(2) ;
  157. local gRUN_TEST_INPUT_FILES = $(3) ;
  158. SEARCH on $(3) = $(LOCATE_SOURCE) ;
  159. return [ boost-test $(<) : RUN_TEST : $(4) ] ;
  160. }
  161. declare-build-fail-test RUN_FAIL : RUN_TEST ;
  162. rule run-fail # sources : args : input-files : requirements
  163. {
  164. local gRUN_TEST_ARGS = $(2) ;
  165. local gRUN_TEST_INPUT_FILES = $(3) ;
  166. SEARCH on $(3) = $(LOCATE_SOURCE) ;
  167. return [ boost-test $(<) : RUN_FAIL : $(4) ] ;
  168. }
  169. ### Rules for testing whether a program links
  170. declare-build-fail-test LINK_FAIL : EXE ;
  171. rule link-fail # sources : requirements
  172. {
  173. return [ boost-test $(<) : LINK_FAIL : $(2) ] ;
  174. }
  175. ### Rules for grouping tests into suites:
  176. rule test-suite # pseudotarget-name : test-targets...
  177. {
  178. NOTFILE $(<) ;
  179. type-DEPENDS $(<) : $(>) ;
  180. }
  181. # ----------- Actual test invocations follow ----------------#
  182. test-suite "bind"
  183. : [ run libs/bind/bind_test.cpp ]
  184. [ run libs/bind/bind_test.cpp ]
  185. [ run libs/bind/mem_fn_test.cpp ]
  186. [ run libs/bind/mem_fn_void_test.cpp ]
  187. ;
  188. test-suite config
  189. : [ run libs/config/test/config_test.cpp ]
  190. [ run libs/config/test/limits_test.cpp ]
  191. ;
  192. run libs/any/any_test.cpp ;
  193. run libs/array/array1.cpp ;
  194. test-suite concept_check
  195. : [ compile libs/concept_check/concept_check_test.cpp ]
  196. [ compile libs/concept_check/class_concept_check_test.cpp ]
  197. [ link-fail libs/concept_check/concept_check_fail_expected.cpp ]
  198. [ link-fail libs/concept_check/class_concept_fail_expected.cpp ]
  199. ;
  200. test-suite conversion
  201. : [ run libs/conversion/cast_test.cpp ]
  202. [ run libs/conversion/lexical_cast_test.cpp ]
  203. ;
  204. run libs/crc/crc_test.cpp ;
  205. run libs/function/test/function_test.cpp ;
  206. run libs/functional/function_test.cpp ;
  207. run libs/graph/test/graph.cpp ;
  208. test-suite integer
  209. : [ run libs/integer/cstdint_test.cpp ]
  210. [ run libs/integer/integer_test.cpp ]
  211. [ run libs/integer/integer_traits_test.cpp ]
  212. ;
  213. test-suite math
  214. : [ run libs/math/test/common_factor_test.cpp ]
  215. [ run libs/math/octonion/octonion_test.cpp ]
  216. [ run libs/math/quaternion/quaternion_test.cpp ]
  217. [ run libs/math/special_functions/special_functions_test.cpp ]
  218. ;
  219. run libs/pool/test/test_pool_alloc.cpp ;
  220. test-suite rational
  221. : [ run libs/rational/rational_example.cpp ]
  222. [ run libs/rational/rational_test.cpp ]
  223. ;
  224. test-suite random
  225. : [ run libs/random/random_test.cpp ]
  226. [ run libs/random/random_demo.cpp ]
  227. ;
  228. test-suite regex
  229. : [ run libs/regex/test/regress/regex_test.cpp : :
  230. $(BOOST_ROOT)/libs/regex/test/regress/tests.txt ]
  231. [ run libs/regex/test/regress/wregex_test.cpp : :
  232. $(BOOST_ROOT)/libs/regex/test/regress/tests.txt ]
  233. ;
  234. run libs/smart_ptr/smart_ptr_test.cpp ;
  235. test-suite static_assert
  236. : [ compile libs/static_assert/static_assert_test.cpp ]
  237. [ compile-fail libs/static_assert/static_assert_test_fail_1.cpp ]
  238. [ compile-fail libs/static_assert/static_assert_test_fail_2.cpp ]
  239. [ compile-fail libs/static_assert/static_assert_test_fail_3.cpp ]
  240. [ compile-fail libs/static_assert/static_assert_test_fail_4.cpp ]
  241. [ compile-fail libs/static_assert/static_assert_test_fail_5.cpp ]
  242. [ compile-fail libs/static_assert/static_assert_test_fail_6.cpp ]
  243. [ compile-fail libs/static_assert/static_assert_test_fail_7.cpp ]
  244. [ link-fail libs/static_assert/static_assert_test_fail_8.cpp ]
  245. ;
  246. run libs/test/example/test_tools_example.cpp ;
  247. run-fail libs/test/test/test_tools_fail2.cpp ;
  248. compile libs/timer/timer_test.cpp ;
  249. test-suite tokenizer
  250. : [ run libs/tokenizer/examples.cpp ]
  251. [ run libs/tokenizer/simple_example_1.cpp ]
  252. [ run libs/tokenizer/simple_example_2.cpp ]
  253. [ run libs/tokenizer/simple_example_3.cpp ]
  254. [ run libs/tokenizer/simple_example_4.cpp ]
  255. [ run libs/tokenizer/simple_example_5.cpp ]
  256. ;
  257. test-suite type_traits
  258. : [ run libs/type_traits/tests/alignment_test.cpp ]
  259. [ run libs/type_traits/tests/arithmetic_traits_test.cpp ]
  260. [ run libs/type_traits/tests/composite_traits_test.cpp ]
  261. [ run libs/type_traits/tests/cv_traits_test.cpp ]
  262. [ run libs/type_traits/tests/is_function_test.cpp ]
  263. [ run libs/type_traits/tests/is_convertible_test.cpp ]
  264. [ run libs/type_traits/tests/is_same_test.cpp ]
  265. [ run libs/type_traits/tests/object_type_traits_test.cpp ]
  266. [ run libs/type_traits/tests/transform_traits_test.cpp ]
  267. ;
  268. run libs/utility/call_traits_test.cpp : -u ;
  269. compile-fail libs/utility/checked_delete_test.cpp ;
  270. run libs/utility/compressed_pair_test.cpp : -u ;
  271. test-suite iterator_adaptors
  272. : [ run libs/utility/counting_iterator_test.cpp : # args
  273. : # input files
  274. : # requirements
  275. # borland warns incorrectly in this case, so often that
  276. # successful compilation is prevented.
  277. <borland><*><cxxflags>"-w-8091 -w-8092"
  278. ]
  279. [ run libs/utility/iterator_adaptor_test.cpp ]
  280. [ compile-fail libs/utility/iter_adaptor_fail_expected1.cpp ]
  281. [ compile-fail libs/utility/iter_adaptor_fail_expected2.cpp ]
  282. [ run libs/utility/transform_iterator_test.cpp ]
  283. [ run libs/utility/indirect_iterator_test.cpp ]
  284. [ run libs/utility/iter_traits_gen_test.cpp ]
  285. [ run libs/utility/iterator_adaptor_examples.cpp ]
  286. [ run libs/utility/counting_iterator_example.cpp ]
  287. [ run libs/utility/filter_iterator_example.cpp ]
  288. [ run libs/utility/fun_out_iter_example.cpp ]
  289. [ run libs/utility/indirect_iterator_example.cpp ]
  290. [ run libs/utility/projection_iterator_example.cpp ]
  291. [ run libs/utility/reverse_iterator_example.cpp ]
  292. [ run libs/utility/transform_iterator_example.cpp ]
  293. ;
  294. run libs/utility/iterator_traits_test.cpp ;
  295. run libs/utility/iterators_test.cpp ;
  296. compile-fail libs/utility/noncopyable_test.cpp ;
  297. run libs/utility/numeric_traits_test.cpp ;
  298. run libs/utility/operators_test.cpp ;
  299. run libs/utility/tie_example.cpp ;
粤ICP备19079148号