Jamfile.v2 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. # Copyright 2002. Dave Abrahams
  2. # Copyright 2016-2018. Rene Rivera
  3. # Distributed under the Boost Software License, Version 1.0.
  4. # (See accompanying file LICENSE_1_0.txt or copy at
  5. # http://www.boost.org/LICENSE_1_0.txt)
  6. # This build project manages running the tests for all of Boost.
  7. # The tests to run are discovered from the structure of the libs tree.
  8. #
  9. # Usage:
  10. #
  11. # > cd boost-root/status
  12. # > b2 [--check-libs-only] [--limit-tests=/lib-name-regex../]* [--exclude-tests=/lib-name-regex../]*
  13. #
  14. # --check-libs-only
  15. # Only runs the library conformance tests.
  16. #
  17. # --no-check-libs
  18. # Do not run the library conformance tests.
  19. #
  20. # --limit-tests, or --include-tests
  21. # Only runs the tests for whom the name matches the regex.
  22. # The value for the argument is a comma separated list of simple
  23. # regular expressions to check against the names of all the libraries.
  24. # If any one regex matches the matching library is tested.
  25. #
  26. # --exclude-tests
  27. # Only runs the tests for whom the names does not match the regex.
  28. # The argument is the same as for the limit-tests option except
  29. # that the result is that libraries for whom the name matches
  30. # are not tested.
  31. #
  32. # The test filters are evaluated in the order given in the command
  33. # and can be used to selectively narrow or widen the set of libraries
  34. # tested.
  35. #
  36. # Examples:
  37. #
  38. # > b2 --check-libs-only --include-tests=predef,config
  39. #
  40. # Runs the library conformance tests for the predef and config
  41. # libraries only.
  42. #
  43. # > b2 --include-tests=[n-t] --exclude-tests=rat --limit-tests=[v-w]
  44. #
  45. # Runs all the tests for library names that begin with "n" through "t",
  46. # or "v" through "w", but not libraries that start with "rat".
  47. project status
  48. : source-location $(BOOST_ROOT)
  49. : requirements <hardcode-dll-paths>true
  50. ;
  51. import testing ;
  52. import modules ;
  53. import project ;
  54. import regex ;
  55. import modules ;
  56. import path ;
  57. import feature ;
  58. import numbers ;
  59. local check-libs-only = [ MATCH "^--(check-libs-only)" : [ modules.peek : ARGV ] ] ;
  60. local no-check-libs = [ MATCH "^--(no-check-libs)$" : [ modules.peek : ARGV ] ] ;
  61. local check-libs-only-targets = ;
  62. local libraries = ;
  63. local rule run-tests ( root : tests * )
  64. {
  65. local filter-args = [ MATCH "^--(limit|exclude|include)-tests=(.*)" : [ modules.peek : ARGV ] ] ;
  66. local filter-tests ;
  67. while $(filter-args)
  68. {
  69. local type = $(filter-args[1]) ;
  70. for local test in [ regex.split-list $(filter-args[2]) : "[,]" ]
  71. {
  72. filter-tests += $(type) $(test) ;
  73. }
  74. filter-args = $(filter-args[3-]) ;
  75. }
  76. # If any filter is given we make the initial set of tested libraries we:
  77. # (a) make it empty if the first filter is an include.
  78. # (b) make it full otherwise.
  79. local include-default = y ;
  80. if $(filter-tests[1]) && ( $(filter-tests[1]) in limit include )
  81. {
  82. include-default = n ;
  83. }
  84. local location = [ project.attribute $(__name__) location ] ;
  85. # We only run the check library test when host-os == target-os.
  86. # Hence we need that information.
  87. local host-os-default = [ feature.defaults <host-os> ] ;
  88. for local test in $(tests)
  89. {
  90. local library = [ path.parent $(test) ] ;
  91. if $(library) = "."
  92. {
  93. library = $(test) ;
  94. }
  95. local include-test = $(include-default) ;
  96. local t = 1 ;
  97. local f = 2 ;
  98. while $(filter-tests[$(f)])
  99. {
  100. if [ MATCH "^($(filter-tests[$(f)]))" : $(test) ]
  101. {
  102. if $(filter-tests[$(t)]) = exclude { include-test = n ; }
  103. else { include-test = y ; }
  104. }
  105. t = [ CALC $(t) + 2 ] ;
  106. f = [ CALC $(f) + 2 ] ;
  107. }
  108. if $(include-test) = y
  109. {
  110. if [ path.exists ../$(root)/$(test) ]
  111. {
  112. use-project /boost/$(test) : ../$(root)/$(test) ;
  113. }
  114. if $(root) = libs && ! $(no-check-libs) && ( ! ( $(library) in $(libraries) ) )
  115. {
  116. libraries += $(library) ;
  117. local test_module = [ project.find ../$(root)/$(test) : $(location) ] ;
  118. modules.poke $(test_module) : __LIBRARY__ : $(root)/$(library) ;
  119. modules.poke $(test_module) : __JAMFILE__ : [ modules.peek project : JAMFILE ] ;
  120. modules.poke $(test_module) : __REQUIRE__ : <target-os>$(host-os-default:G=) ;
  121. project.push-current [ project.target $(test_module) ] ;
  122. module $(test_module)
  123. {
  124. import testing ;
  125. testing.make-test run-pyd :
  126. $(BOOST_ROOT)/status/boost_check_library.py
  127. :
  128. <pythonpath>$(BOOST_ROOT)/status
  129. <testing.arg>--boost-root=\"$(BOOST_ROOT)\"
  130. <testing.arg>--library=$(__LIBRARY__)
  131. <testing.arg>--jamfile=\"$(__JAMFILE__:J=;)\"
  132. <testing.arg>organization
  133. $(__REQUIRE__)
  134. :
  135. __boost_check_library__ ;
  136. }
  137. project.pop-current ;
  138. check-libs-only-targets += ../$(root)/$(test)//__boost_check_library__ ;
  139. }
  140. if ! $(check-libs-only)
  141. {
  142. build-project ../$(root)/$(test) ;
  143. }
  144. }
  145. }
  146. }
  147. local rule find-targets ( target : libs * )
  148. {
  149. local result = ;
  150. for local lib in $(libs)
  151. {
  152. local path = $(lib)/test ;
  153. local project = [ project.load $(path) ] ;
  154. local pt = [ project.target $(project) ] ;
  155. local mt = [ $(pt).main-target $(target) ] ;
  156. if $(mt)
  157. {
  158. result += $(path)//$(target) ;
  159. }
  160. }
  161. return $(result) ;
  162. }
  163. local libs-to-test = ;
  164. for local libdir in [ path.glob $(BOOST_ROOT) : libs/* ]
  165. {
  166. local jamfile = [ modules.peek project : JAMFILE ] ;
  167. local jamfiles = [ path.glob [ path.join $(libdir) test ] : $(jamfile) ] ;
  168. if $(jamfiles)
  169. {
  170. libs-to-test += $(libdir:B) ;
  171. }
  172. if [ path.glob $(libdir) : sublibs ]
  173. {
  174. jamfiles = [ path.glob $(libdir) : */test/$(jamfile) ] ;
  175. for local sublib_jamfile in $(jamfiles)
  176. {
  177. local sublibdir = [ path.parent [ path.parent $(sublib_jamfile) ] ] ;
  178. local sublib = $(libdir:B)/$(sublibdir:B) ;
  179. libs-to-test += $(sublib) ;
  180. }
  181. }
  182. }
  183. libs-to-test = [ SORT $(libs-to-test) ] ;
  184. run-tests libs : $(libs-to-test)/test ;
  185. # Tests from Jamfiles in tools/
  186. # Please keep these in alphabetical order
  187. local tools-to-test = ;
  188. for local tooldir in bcp check_build quickbook
  189. {
  190. local jamfile = [ modules.peek project : JAMFILE ] ;
  191. local jamfiles = [ path.glob [ path.join $(BOOST_ROOT) tools $(tooldir) test ] : $(jamfile) ] ;
  192. if $(jamfiles)
  193. {
  194. tools-to-test += $(tooldir) ;
  195. }
  196. }
  197. #ECHO "tools-to-test:" $(tools-to-test) ;
  198. run-tests tools : $(tools-to-test)/test ;
  199. if $(check-libs-only-targets)
  200. {
  201. alias check-libs-only : $(check-libs-only-targets) ;
  202. }
  203. alias minimal : [ find-targets minimal : ../libs/$(libs-to-test) ] ;
  204. explicit minimal ;
  205. alias quick : [ find-targets quick : ../libs/$(libs-to-test) ../tools/$(tools-to-test) ] ;
  206. explicit quick ;
粤ICP备19079148号