test.jam 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. # Boost serialization Library utility test Jamfile
  2. # (C) Copyright Robert Ramey 2002-2004.
  3. # Use, modification, and distribution are subject to the
  4. # Boost Software License, Version 1.0. (See accompanying file
  5. # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #
  7. # the file contains Jam rules which are used in both the normal
  8. # boost test, as well as the performance test and comprehensive
  9. # tests.
  10. # import rules for testing conditional on config file variables
  11. import ../../config/checks/config : requires ;
  12. BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ;
  13. # these are used to shorten testing while in development. It permits
  14. # testing to be applied to just a particular type of archive
  15. if ! $(BOOST_ARCHIVE_LIST) {
  16. BOOST_ARCHIVE_LIST =
  17. "text_archive.hpp"
  18. "text_warchive.hpp"
  19. "binary_archive.hpp"
  20. "xml_archive.hpp"
  21. "xml_warchive.hpp"
  22. ;
  23. # enable the tests which don't depend on a particular archive
  24. BOOST_SERIALIZATION_TEST = true ;
  25. }
  26. rule run-template ( test-name : sources * : files * : requirements * ) {
  27. return [
  28. run
  29. $(sources)
  30. : # command
  31. : #input files
  32. $(files)
  33. : # requirements
  34. # toolset warnings
  35. <toolset>borland:<cxxflags>"-w-8080 -w-8071 -w-8057 -w-8062 -w-8008 -w-0018 -w-8066"
  36. #<toolset>gcc:<warnings>all # ?
  37. <toolset>gcc:<cxxflags>"-Wno-unused-variable -Wno-long-long"
  38. # <toolset>gcc:<variant>debug><define>_STLP_DEBUG
  39. # <toolset>gcc:<variant>debug><define>_GLIBCXX_DEBUG
  40. <toolset>darwin:<cxxflags>"-Wno-unused-variable -Wno-long-long"
  41. <toolset>msvc:<warnings>all # == /W4
  42. <toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
  43. <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
  44. <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
  45. <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
  46. <toolset>msvc:<cxxflags>"-wd4996"
  47. <toolset>clang:<variant>debug:<cxxflags>"-fsanitize=memory"
  48. # toolset optimizations
  49. <toolset>gcc:<cxxflags>"-ftemplate-depth-255"
  50. <toolset>clang:<cxxflags>"-ftemplate-depth-255"
  51. <toolset>darwin:<cxxflags>"-ftemplate-depth-255"
  52. <toolset>msvc:<cxxflags>"-Gy"
  53. # linking
  54. <link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
  55. <link>shared:<define>BOOST_WSERIALIZATION_DYN_LINK=1
  56. $(requirements)
  57. : # test name
  58. $(test-name)
  59. ] ;
  60. }
  61. # Given a name of test, return the 'save' test that must be run
  62. # before the named test, or empty string if there's no such test.
  63. rule dependency-save-test ( test )
  64. {
  65. local m = [ MATCH (.*)load(.*) : $(test) ] ;
  66. if $(m)
  67. {
  68. return $(m[1])save$(m[2]) ;
  69. }
  70. }
  71. # each of the following tests is run with each type of archive
  72. rule run-invoke ( test-name : sources * : files * : requirements * )
  73. {
  74. local save-test = [ dependency-save-test $(test-name) ] ;
  75. local tests ;
  76. tests += [
  77. run-template $(test-name)
  78. : # sources
  79. $(sources)
  80. ../build//boost_serialization
  81. : # input files
  82. : # requirements
  83. $(requirements)
  84. <define>BOOST_LIB_DIAGNOSTIC=1
  85. <dependency>$(save-test)
  86. ] ;
  87. return $(tests) ;
  88. }
  89. # each of the following tests is run with each type of archive
  90. rule run-winvoke ( test-name : sources * : files * : requirements * )
  91. {
  92. local save-test = [ dependency-save-test $(test-name) ] ;
  93. local tests ;
  94. tests += [
  95. run-template $(test-name)
  96. : # sources
  97. $(sources)
  98. ../build//boost_serialization
  99. ../build//boost_wserialization
  100. : # input files
  101. : # requirements
  102. $(requirements)
  103. <define>BOOST_LIB_DIAGNOSTIC=1
  104. # both stlport and msvc6 define iswspace
  105. <toolset>msvc,<stdlib>stlport:<linkflags>"-force:multiple"
  106. <dependency>$(save-test)
  107. [ requires std_wstreambuf ]
  108. ] ;
  109. return $(tests) ;
  110. }
  111. # for tests which don't use library code - usually just headers
  112. rule test-bsl-run-no-lib ( test-name : sources * : requirements * )
  113. {
  114. local tests ;
  115. tests += [
  116. run-template $(test-name)
  117. : # sources
  118. $(test-name).cpp $(sources).cpp
  119. : # input files
  120. : # requirements
  121. $(requirements)
  122. ] ;
  123. return $(tests) ;
  124. }
  125. # for tests which are run just once rather than for every archive
  126. rule test-bsl-run ( test-name : sources * : libs * : requirements * )
  127. {
  128. local tests ;
  129. tests += [
  130. run-invoke $(test-name)
  131. : # sources
  132. $(test-name).cpp $(sources).cpp $(libs)
  133. : # input files
  134. : # requirements
  135. $(requirements)
  136. ] ;
  137. return $(tests) ;
  138. }
  139. rule test-bsl-run_archive ( test-name : archive-name : sources * : libs * : requirements * ) {
  140. local tests ;
  141. switch $(archive-name) {
  142. case "*_warchive" :
  143. tests += [
  144. run-winvoke $(test-name)_$(archive-name)
  145. : # sources
  146. $(sources).cpp $(libs)
  147. : # input files
  148. : # requirements
  149. <define>BOOST_ARCHIVE_TEST=$(archive-name).hpp
  150. $(requirements)
  151. ] ;
  152. case "*" :
  153. tests += [
  154. run-invoke $(test-name)_$(archive-name)
  155. : # sources
  156. $(sources).cpp $(libs)
  157. : # input files
  158. : # requirements
  159. <define>BOOST_ARCHIVE_TEST=$(archive-name).hpp
  160. $(requirements)
  161. ] ;
  162. }
  163. return $(tests) ;
  164. }
  165. rule test-bsl-run_files ( test-name : sources * : libs * : requirements * ) {
  166. local tests ;
  167. for local defn in $(BOOST_ARCHIVE_LIST) {
  168. tests += [
  169. test-bsl-run_archive $(test-name)
  170. : $(defn:LB)
  171. : $(test-name) $(sources)
  172. : $(libs)
  173. : $(requirements)
  174. ] ;
  175. }
  176. return $(tests) ;
  177. }
  178. rule test-bsl-run_polymorphic_files ( test-name : sources * : libs * : requirements * ) {
  179. local tests ;
  180. for local defn in $(BOOST_ARCHIVE_LIST) {
  181. ECHO polymorphic_$(defn:LB) ;
  182. tests += [
  183. test-bsl-run_archive $(test-name)
  184. : polymorphic_$(defn:LB)
  185. : $(test-name) $(sources)
  186. : $(libs)
  187. : $(requirements)
  188. ] ;
  189. }
  190. return $(tests) ;
  191. }