Jamfile.v2 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. # Copyright 2007 Andy Tompkins.
  2. # Copyright 2017 - 2018 James E. King III
  3. # Distributed under the Boost Software License, Version 1.0. (See
  4. # accompanying file LICENSE_1_0.txt or copy at
  5. # https://www.boost.org/LICENSE_1_0.txt)
  6. lib bcrypt ;
  7. project libs/uuid/test
  8. : requirements
  9. # boost.jam defines BOOST_ALL_NO_LIB, this makes library management
  10. # near-impossible with the platform selection logic in the random_provider
  11. <target-os>windows:<define>BOOST_UUID_FORCE_AUTO_LINK
  12. <target-os>windows,<toolset>gcc:<library>bcrypt
  13. # boost::lexical_cast needs this for a warning-free build (CHAR_MAX)
  14. <toolset>clang:<cxxflags>-Wno-c99-extensions
  15. # boost::random needs this setting for a warning free build:
  16. <toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
  17. # link static for easier debugging
  18. <link>static
  19. ;
  20. import os ;
  21. import path ;
  22. import regex ;
  23. import testing ;
  24. # this rule enumerates through all the headers and ensures
  25. # that inclusion of the header by itself is sufficient to
  26. # compile successfully, proving the header does not depend
  27. # on any other headers to be included first - adapted from
  28. # logic in the winapi test bjam script
  29. rule test_all
  30. {
  31. local all_rules = ;
  32. local file ;
  33. local headers_path = [ path.make $(BOOST_ROOT)/libs/uuid/include/boost/uuid ] ;
  34. for file in [ path.glob-tree $(headers_path) : *.hpp : uuid ]
  35. {
  36. local rel_file = [ path.relative-to $(headers_path) $(file) ] ;
  37. # Note: The test name starts with '~' in order to group these tests in the test report table, preferably at the end.
  38. # All '/' are replaced with '-' because apparently test scripts have a problem with test names containing slashes.
  39. local test_name = [ regex.replace $(rel_file) "/" "-" ] ;
  40. local decl_test_name = ~hdr-decl-$(test_name) ;
  41. # ECHO $(rel_file) ;
  42. all_rules += [ compile compile/decl_header.cpp : <define>"BOOST_UUID_TEST_HEADER=$(rel_file)" <dependency>$(file) : $(decl_test_name) ] ;
  43. }
  44. local tests_path = [ path.make $(BOOST_ROOT)/libs/uuid/test/compile-fail ] ;
  45. for file in [ path.glob-tree $(tests_path) : *.cpp ]
  46. {
  47. local rel_file = [ path.relative-to $(tests_path) $(file) ] ;
  48. local test_name = [ regex.replace [ regex.replace $(rel_file) "/" "-" ] ".cpp" "" ] ;
  49. local decl_test_name = cf-$(test_name) ;
  50. # ECHO $(rel_file) ;
  51. all_rules += [ compile-fail $(file) : : $(decl_test_name) ] ;
  52. }
  53. # make sure compile time options work in isolation
  54. all_rules += [ compile compile/decl_header.cpp :
  55. <define>"BOOST_UUID_TEST_HEADER=uuid.hpp"
  56. <define>"BOOST_UUID_NO_TYPE_TRAITS"
  57. <dependency>$(BOOST_ROOT)/boost/uuid/uuid.hpp :
  58. compile_uuid_no_type_traits ] ;
  59. all_rules += [ compile compile/decl_header.cpp :
  60. <define>"BOOST_UUID_TEST_HEADER=uuid.hpp"
  61. <define>"BOOST_UUID_NO_SIMD"
  62. <dependency>$(BOOST_ROOT)/boost/uuid/uuid.hpp :
  63. compile_uuid_no_simd ] ;
  64. # ECHO All rules: $(all_rules) ;
  65. return $(all_rules) ;
  66. }
  67. # disabled in UBSAN builds due to issues in Boost.Serialization
  68. if ! [ os.environ UBSAN_OPTIONS ]
  69. {
  70. test-suite uuid-serialization :
  71. # test serializing uuids
  72. [ run test_serialization.cpp ../../serialization/build//boost_serialization ]
  73. # TODO - This test fails to like with boost_wserialization
  74. # [ run test_wserialization.cpp
  75. # ../../serialization/build//boost_serialization
  76. # ../../serialization/build//boost_wserialization
  77. # : : : <dependency>../../config/test/all//BOOST_NO_STD_WSTREAMBUF
  78. # ]
  79. ;
  80. }
  81. test-suite uuid :
  82. [ test_all ]
  83. # test inclucing all .hpp files in 2 translations units
  84. # to look for issues when using multiple translation units
  85. # eg. missing inline on a global functionstate is not missing
  86. [ run test_include1.cpp test_include2.cpp ]
  87. # main test
  88. [ run test_uuid.cpp ]
  89. [ run test_uuid_no_simd.cpp ]
  90. # test uuid_io.hpp
  91. [ run test_io.cpp ]
  92. # test generators
  93. [ run test_nil_generator.cpp ]
  94. [ run test_name_generator.cpp ]
  95. [ run test_name_generator.cpp : : : <define>BOOST_UUID_COMPAT_PRE_1_71_MD5 : test_name_generator_pre_1_71_compat ]
  96. [ run test_string_generator.cpp ]
  97. [ run test_random_generator.cpp ]
  98. # test tagging an object
  99. [ run test_tagging.cpp ]
  100. # test use cases
  101. [ run test_uuid_class.cpp ]
  102. [ run test_uuid_in_map.cpp ]
  103. # test hash functions
  104. [ run test_hash.cpp ]
  105. [ run test_md5.cpp ]
  106. [ run test_md5.cpp : : : <define>BOOST_UUID_COMPAT_PRE_1_71_MD5 : test_md5_pre_1_71_compat ]
  107. [ run test_sha1.cpp ]
  108. # test MSVC 12 (VS2013) optimizer bug with SIMD operations.
  109. # See https://svn.boost.org/trac/boost/ticket/8509#comment:3
  110. # Only happens in Release x64 builds.
  111. [ run test_msvc_simd_bug981648_main.cpp
  112. test_msvc_simd_bug981648_foo.cpp
  113. : : : <build>no <toolset>msvc-12.0:<build>yes <variant>release <debug-symbols>on : test_msvc_simd_bug981648 ]
  114. # a small benchmark test for random generation
  115. [ run test_bench_random.cpp ../../timer/build//boost_timer : : : <toolset>clang-cloudabi:<build>no ]
  116. [ run test_entropy_error.cpp ]
  117. # tests for the header-only random provider
  118. # there are a number of variations to test all compile-time branches
  119. # and to make sure we test all the error handling code paths
  120. [ run test_detail_random_provider.cpp
  121. : : :
  122. <define>_WIN32_WINNT=0x0600 # will force bcrypt over wincrypt (on windows)
  123. : test_detail_random_provider_happy ]
  124. [ run test_detail_random_provider.cpp
  125. : : :
  126. <define>BOOST_UUID_RANDOM_PROVIDER_NO_LIB # disable any auto-linking
  127. <define>BOOST_UUID_TEST_RANDOM_MOCK # mock default provider to force error path testing
  128. <define>_WIN32_WINNT=0x0600 # will force bcrypt over wincrypt (on windows)
  129. :
  130. test_detail_random_provider_sad ]
  131. # CI builds in appveyor normally select the bcrypt provider, so
  132. # force wincrypt to be selected and test both happy and sad paths:
  133. [ lib mock_random
  134. : mock_random.cpp
  135. : <link>shared
  136. <build>no # do not build on any target-os
  137. <target-os>windows:<build>yes ] # except for windows
  138. [ run test_detail_random_provider.cpp
  139. : : :
  140. <define>_WIN32_WINNT=0x0501 # will force wincrypt over bcrypt
  141. <build>no # do not build on any target-os
  142. <target-os>windows:<build>yes # except for windows
  143. : test_detail_random_provider_happy_wincrypt ]
  144. [ run test_detail_random_provider.cpp
  145. mock_random
  146. : : :
  147. <define>_WIN32_WINNT=0x0501 # will force wincrypt over bcrypt
  148. <define>BOOST_UUID_RANDOM_PROVIDER_NO_LIB # disable any auto-linking
  149. <define>BOOST_UUID_TEST_RANDOM_MOCK # mock wincrypt to force error path testing
  150. <build>no # do not build on any target-os
  151. <target-os>windows:<build>yes # except for windows
  152. : test_detail_random_provider_sad_wincrypt ]
  153. # CI builds in travis will eventually select getrandom/getentropy when they move
  154. # to a version of ubuntu with glibc-2.25 on it, so when that happens keep
  155. # testing the posix provider:
  156. [ run test_detail_random_provider.cpp
  157. : : :
  158. <define>BOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX # will force POSIX over getrandom/getentropy
  159. <target-os>windows:<build>no # do not bother running on windows
  160. <toolset>clang-cloudabi:<build>no # no need to build under cloudabi
  161. : test_detail_random_provider_happy_posix ]
  162. [ run test_detail_random_provider.cpp
  163. : : :
  164. <define>BOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX # will force POSIX over getrandom/getentropy
  165. <define>BOOST_UUID_TEST_RANDOM_MOCK # redirect code to use mock system calls
  166. <target-os>windows:<build>no # do not bother running on windows
  167. <toolset>clang-cloudabi:<build>no # no need to build under cloudabi
  168. : test_detail_random_provider_sad_posix ]
  169. # Force running tests for getentropy despite it's not going to be used on Linux. getentropy
  170. # may be used on systems other than Linux, which are not part of the CI testers pool.
  171. [ run test_detail_random_provider.cpp
  172. : : :
  173. <define>BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETRANDOM # will force getentropy over getrandom
  174. <build>no
  175. <target-os>linux:<build>yes # build only on linux (or any other systems that support getentropy)
  176. : test_detail_random_provider_happy_getentropy ]
  177. [ run test_detail_random_provider.cpp
  178. : : :
  179. <define>BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETRANDOM # will force getentropy over getrandom
  180. <define>BOOST_UUID_TEST_RANDOM_MOCK # redirect code to use mock system calls
  181. <build>no
  182. <target-os>linux:<build>yes # build only on linux (or any other systems that support getentropy)
  183. : test_detail_random_provider_sad_getentropy ]
  184. ;