Jamfile 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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 $(<:B:S=) : $(result) ;
  35. type-DEPENDS test : $(result) ;
  36. return $(result) ;
  37. }
  38. #######
  39. # failed-test-file test-file : fail-to-build-file
  40. #
  41. # a utility rule which causes test-file to be built successfully, only if
  42. # fail-to-build-file fails to build. Used for expected-failure tests.
  43. rule failed-test-file
  44. {
  45. DEPENDS $(<) : $(>) ;
  46. FAIL_EXPECTED $(>) ;
  47. }
  48. # to avoid building the test-file when it's actually up-to-date,
  49. # we need to put something in place of the thing it depends on.
  50. actions failed-test-file
  51. {
  52. echo building "$(>)" failed as expected > $(>)
  53. echo building "$(>)" failed as expected > $(<)
  54. }
  55. # declare-build-fail-test test-type : dependency-type
  56. #
  57. # A utility rule which declares test-type to be a target type which depends on
  58. # the /failed/ construction of a target of type dependency-type.
  59. rule declare-build-fail-test
  60. {
  61. gGENERATOR_FUNCTION($(<)) = fail-to-build ;
  62. gDEPENDENCY_TYPE($(<)) = $(>) ;
  63. SUF$(<) = .fail ;
  64. }
  65. # fail-to-build target.test : sources : requirements
  66. #
  67. # A target generator function for target types declared with
  68. # declare-build-fail-test, above.
  69. rule fail-to-build
  70. {
  71. # Get the target type of the current target out of the build properties
  72. local target-type = [ get-values <target-type> : $(gBUILD_PROPERTIES) ] ;
  73. # Get the type of target which will (hopefully) fail to build.
  74. local dependency-type = $(gDEPENDENCY_TYPE($(target-type))) ;
  75. # Get the actual name of the target which should fail to build
  76. local fail-target = $(<[1]:S=$(SUF$(dependency-type))) ;
  77. # Call dependency-type's generator function to (fail to) build the target
  78. local ignored = [
  79. $(gGENERATOR_FUNCTION($(dependency-type))) $(fail-target) : $(>) : $(3) ] ;
  80. # Generator functions don't handle this job for us; perhaps they should.
  81. set-target-variables $(fail-target)
  82. # The .test file goes with the other subvariant targets
  83. MakeLocate $(<) : $(LOCATE_TARGET) ;
  84. # Establish the dependency
  85. failed-test-file $(<) : $(fail-target) ;
  86. }
  87. ### Rules for testing whether a file compiles ###
  88. # Establish the rule which generates targets of type "OBJ". Should really go
  89. # into basic build system, but wasn't needed 'till now.
  90. gGENERATOR_FUNCTION(OBJ) = Object ;
  91. declare-build-fail-test COMPILE_FAIL : OBJ ;
  92. # Test that the given source-file(s) compile
  93. rule compile # source-file : fail : requirements
  94. {
  95. return [ boost-test $(<) : OBJ : $(3) ] ;
  96. }
  97. # Test that the given source-file(s) fail to compile
  98. rule compile-fail # source-file : requirements
  99. {
  100. return [ boost-test $(<) : COMPILE_FAIL : $(2) ] ;
  101. }
  102. ### Rules for testing whether a program runs ###
  103. gGENERATOR_FUNCTION(RUN_TEST) = run-test ;
  104. SUFRUN_TEST = .test ;
  105. rule run-test # target : sources : requirements
  106. {
  107. local executable = $(<:S=$(SUFEXE)) ;
  108. executable-file $(executable) : $(>) : $(3) ;
  109. set-target-variables $(executable) ;
  110. # Ugly hack to get the pathes transferred. See the link rule in boost-base.jam.
  111. RUN_PATH on $(<) = [ join $(gRUN_PATH($(executable))) $(RUN_PATH) : $(SPLITPATH) ] ;
  112. if $(UNIX)
  113. {
  114. RUN_LD_LIBRARY_PATH on $(<) = [ join $(gRUN_LD_LIBRARY_PATH($(executable))) $(RUN_LD_LIBRARY_PATH) : $(SPLITPATH) ] ;
  115. }
  116. # The .test file goes with the other subvariant targets
  117. # normalization is a hack to get the slashes going the right way on Windoze
  118. local LOCATE_TARGET = [ FDirName [ split-path $(LOCATE_TARGET) ] ] ;
  119. MakeLocate $(<) : $(LOCATE_TARGET) ;
  120. DEPENDS $(<) : $(executable) $(gRUN_TEST_INPUT_FILES) ;
  121. INPUT_FILES on $(<) = $(gRUN_TEST_INPUT_FILES) ;
  122. ARGS on $(<) = $(gRUN_TEST_ARGS) ;
  123. capture-run-output $(<) : $(executable) ;
  124. if $(RUN_ALL_TESTS)
  125. {
  126. ALWAYS $(<) ;
  127. }
  128. }
  129. # The rule is just used for argument checking
  130. rule capture-run-output ( target : executable + ) { }
  131. if $(UNIX)
  132. {
  133. actions capture-run-output bind INPUT_FILES
  134. {
  135. $(SHELL_SET)PATH=$(RUN_PATH)
  136. $(SHELL_EXPORT)PATH
  137. $(SHELL_SET)LD_LIBRARY_PATH=$(RUN_LD_LIBRARY_PATH)
  138. $(SHELL_EXPORT)LD_LIBRARY_PATH
  139. $(>) $(ARGS) $(INPUT_FILES) > $(<:S=.error)
  140. $(CP) $(<:S=.error) $(<)
  141. $(RM) $(<:S=.error)
  142. }
  143. }
  144. else
  145. {
  146. actions capture-run-output bind INPUT_FILES
  147. {
  148. $(SHELL_SET)PATH=$(RUN_PATH)
  149. $(SHELL_EXPORT)PATH
  150. $(>) $(ARGS) $(INPUT_FILES) > $(<:S=.error)
  151. $(CP) $(<:S=.error) $(<)
  152. $(RM) $(<:S=.error)
  153. }
  154. }
  155. rule run # sources : args : input-files : requirements
  156. {
  157. local gRUN_TEST_ARGS = $(2) ;
  158. local gRUN_TEST_INPUT_FILES = $(3) ;
  159. SEARCH on $(3) = $(LOCATE_SOURCE) ;
  160. return [ boost-test $(<) : RUN_TEST : $(4) ] ;
  161. }
  162. declare-build-fail-test RUN_FAIL : RUN_TEST ;
  163. rule run-fail # sources : args : input-files : requirements
  164. {
  165. local gRUN_TEST_ARGS = $(2) ;
  166. local gRUN_TEST_INPUT_FILES = $(3) ;
  167. SEARCH on $(3) = $(LOCATE_SOURCE) ;
  168. return [ boost-test $(<) : RUN_FAIL : $(4) ] ;
  169. }
  170. ### Rules for testing whether a program links
  171. declare-build-fail-test LINK_FAIL : EXE ;
  172. rule link-fail # sources : requirements
  173. {
  174. return [ boost-test $(<) : LINK_FAIL : $(2) ] ;
  175. }
  176. ### Rules for grouping tests into suites:
  177. rule test-suite # pseudotarget-name : test-targets...
  178. {
  179. NOTFILE $(<) ;
  180. type-DEPENDS $(<) : $(>) ;
  181. }
  182. # ----------- Actual test invocations follow ----------------#
  183. test-suite "bind"
  184. : [ run libs/bind/bind_test.cpp ]
  185. [ run libs/bind/bind_test.cpp ]
  186. [ run libs/bind/mem_fn_test.cpp ]
  187. [ run libs/bind/mem_fn_void_test.cpp ]
  188. ;
  189. test-suite config
  190. : [ run libs/config/test/config_test.cpp ]
  191. [ run libs/config/test/limits_test.cpp ]
  192. ;
  193. run libs/any/any_test.cpp ;
  194. run libs/array/array1.cpp ;
  195. test-suite concept_check
  196. : [ compile libs/concept_check/concept_check_test.cpp ]
  197. [ compile libs/concept_check/class_concept_check_test.cpp ]
  198. [ link-fail libs/concept_check/concept_check_fail_expected.cpp ]
  199. [ link-fail libs/concept_check/class_concept_fail_expected.cpp ]
  200. ;
  201. test-suite conversion
  202. : [ run libs/conversion/cast_test.cpp ]
  203. [ run libs/conversion/lexical_cast_test.cpp ]
  204. ;
  205. run libs/crc/crc_test.cpp ;
  206. run libs/function/test/function_test.cpp ;
  207. run libs/functional/function_test.cpp ;
  208. run libs/graph/test/graph.cpp ;
  209. test-suite integer
  210. : [ run libs/integer/cstdint_test.cpp ]
  211. [ run libs/integer/integer_test.cpp ]
  212. [ run libs/integer/integer_traits_test.cpp ]
  213. ;
  214. test-suite math
  215. : [ run libs/math/test/common_factor_test.cpp ]
  216. [ run libs/math/octonion/octonion_test.cpp ]
  217. [ run libs/math/quaternion/quaternion_test.cpp ]
  218. [ run libs/math/special_functions/special_functions_test.cpp ]
  219. ;
  220. run libs/pool/test/test_pool_alloc.cpp ;
  221. test-suite rational
  222. : [ run libs/rational/rational_example.cpp ]
  223. [ run libs/rational/rational_test.cpp ]
  224. ;
  225. test-suite random
  226. : [ run libs/random/random_test.cpp ]
  227. [ run libs/random/random_demo.cpp ]
  228. ;
  229. run libs/utility/ref_test.cpp ;
  230. test-suite regex
  231. : [ run libs/regex/test/regress/regex_test.cpp : :
  232. $(BOOST_ROOT)/libs/regex/test/regress/tests.txt ]
  233. [ run libs/regex/test/regress/wregex_test.cpp : :
  234. $(BOOST_ROOT)/libs/regex/test/regress/tests.txt ]
  235. ;
  236. run libs/smart_ptr/smart_ptr_test.cpp ;
  237. test-suite static_assert
  238. : [ compile libs/static_assert/static_assert_test.cpp ]
  239. [ compile-fail libs/static_assert/static_assert_test_fail_1.cpp ]
  240. [ compile-fail libs/static_assert/static_assert_test_fail_2.cpp ]
  241. [ compile-fail libs/static_assert/static_assert_test_fail_3.cpp ]
  242. [ compile-fail libs/static_assert/static_assert_test_fail_4.cpp ]
  243. [ compile-fail libs/static_assert/static_assert_test_fail_5.cpp ]
  244. [ compile-fail libs/static_assert/static_assert_test_fail_6.cpp ]
  245. [ compile-fail libs/static_assert/static_assert_test_fail_7.cpp ]
  246. [ link-fail libs/static_assert/static_assert_test_fail_8.cpp ]
  247. ;
  248. run libs/test/example/test_tools_example.cpp ;
  249. run-fail libs/test/test/test_tools_fail2.cpp ;
  250. compile libs/timer/timer_test.cpp ;
  251. test-suite tokenizer
  252. : [ run libs/tokenizer/examples.cpp ]
  253. [ run libs/tokenizer/simple_example_1.cpp ]
  254. [ run libs/tokenizer/simple_example_2.cpp ]
  255. [ run libs/tokenizer/simple_example_3.cpp ]
  256. [ run libs/tokenizer/simple_example_4.cpp ]
  257. [ run libs/tokenizer/simple_example_5.cpp ]
  258. ;
  259. test-suite type_traits
  260. : [ run libs/type_traits/tests/alignment_test.cpp ]
  261. [ run libs/type_traits/tests/arithmetic_traits_test.cpp ]
  262. [ run libs/type_traits/tests/composite_traits_test.cpp ]
  263. [ run libs/type_traits/tests/cv_traits_test.cpp ]
  264. [ run libs/type_traits/tests/is_function_test.cpp ]
  265. [ run libs/type_traits/tests/is_convertible_test.cpp ]
  266. [ run libs/type_traits/tests/is_same_test.cpp ]
  267. [ run libs/type_traits/tests/object_type_traits_test.cpp ]
  268. [ run libs/type_traits/tests/transform_traits_test.cpp ]
  269. ;
  270. run libs/utility/call_traits_test.cpp : -u ;
  271. compile-fail libs/utility/checked_delete_test.cpp ;
  272. run libs/utility/compressed_pair_test.cpp : -u ;
  273. test-suite iterator_adaptors
  274. : [ run libs/utility/counting_iterator_test.cpp : # args
  275. : # input files
  276. : # requirements
  277. # borland warns incorrectly in this case, so often that
  278. # successful compilation is prevented.
  279. <borland><*><cxxflags>"-w-8091 -w-8092"
  280. ]
  281. [ run libs/utility/iterator_adaptor_test.cpp ]
  282. [ compile-fail libs/utility/iter_adaptor_fail_expected1.cpp ]
  283. [ compile-fail libs/utility/iter_adaptor_fail_expected2.cpp ]
  284. [ run libs/utility/transform_iterator_test.cpp ]
  285. [ run libs/utility/indirect_iterator_test.cpp ]
  286. [ run libs/utility/iter_traits_gen_test.cpp ]
  287. [ run libs/utility/iterator_adaptor_examples.cpp ]
  288. [ run libs/utility/counting_iterator_example.cpp ]
  289. [ run libs/utility/filter_iterator_example.cpp ]
  290. [ run libs/utility/fun_out_iter_example.cpp ]
  291. [ run libs/utility/indirect_iterator_example.cpp ]
  292. [ run libs/utility/projection_iterator_example.cpp ]
  293. [ run libs/utility/reverse_iterator_example.cpp ]
  294. [ run libs/utility/transform_iterator_example.cpp ]
  295. ;
  296. run libs/utility/iterator_traits_test.cpp ;
  297. run libs/utility/iterators_test.cpp ;
  298. compile-fail libs/utility/noncopyable_test.cpp ;
  299. run libs/utility/numeric_traits_test.cpp ;
  300. run libs/utility/operators_test.cpp ;
  301. run libs/utility/tie_example.cpp ;
  302. run libs/utility/binary_search_test.cpp ;
粤ICP备19079148号