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