]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # (C) Copyright Gennadiy Rozental 2001-2015. |
2 | # Use, modification, and distribution are subject to the | |
3 | # Boost Software License, Version 1.0. (See accompanying file | |
4 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | # | |
6 | # See http://www.boost.org/libs/test for the library home page. | |
7 | ||
8 | import path ; | |
b32b8144 FG |
9 | import project ; |
10 | import property ; | |
11 | import property-set ; | |
12 | import "class" : new ; | |
7c673cae FG |
13 | |
14 | import ../../config/checks/config : requires ; | |
15 | ||
b32b8144 | 16 | project boost/test-tests |
7c673cae FG |
17 | : requirements |
18 | ; | |
19 | ||
b32b8144 FG |
20 | import ../../predef/check/predef |
21 | : check require | |
22 | : predef-check predef-require ; | |
23 | ||
7c673cae FG |
24 | local check_msg = "Boost.Test feature check: " ; |
25 | ||
26 | # documentation requirements: we use new style examples in the doc and compile on compilers supporting that | |
27 | requirements_documentation = [ requires cxx11_decltype cxx11_hdr_random cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_variadic_macros cxx11_template_aliases ] ; | |
28 | ||
29 | # requirements for BOOST_TEST feature, full extension | |
30 | requirements_boost_test_full_support = [ requires cxx11_variadic_macros cxx11_decltype cxx11_auto_declarations ] ; | |
31 | # requirements_boost_test_full_support += [ check-target-builds ../tools/check_boost_test_support.cpp "Boost.Test feature check: BOOST_TEST full support" : : <build>no ] ; | |
32 | ||
33 | # requirements for dataset feature | |
34 | requirements_datasets = [ requires cxx11_decltype cxx11_hdr_random cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_variadic_macros cxx11_trailing_result_types cxx11_template_aliases ] ; | |
35 | ||
36 | ||
37 | #_________________________________________________________________________________________________# | |
38 | ||
39 | # lib gcov : : <name>gcov : ; | |
40 | ||
41 | rule boost.test-self-test ( test-rule : test-suite : test-name : usage-variant ? : pattern_file * : source_files * : extra-libs ? : extra-options ? : requirements * ) | |
42 | { | |
43 | source_files ?= $(test-suite)/$(test-name).cpp ; | |
44 | usage-variant ?= boost_unit_test_framework/<link>static ; | |
45 | ||
46 | return [ $(test-rule) $(source_files) ../build//$(usage-variant) $(extra-libs) | |
47 | # gcov | |
48 | : -- "" #args | |
49 | : $(pattern_file) | |
50 | : # Activating -pedantic finds more gotchas | |
51 | # Unfortunately, this warns about the use of "long long" in gcc's own stdlib | |
52 | # So deactivate those warnings again | |
53 | <toolset>gcc:<cxxflags>-pedantic | |
54 | <toolset>gcc:<cxxflags>-Wno-long-long | |
b32b8144 | 55 | [ predef-check "BOOST_COMP_GNUC >= 4.3.0" : : <cxxflags>-Wno-variadic-macros ] |
7c673cae FG |
56 | <toolset>clang:<cxxflags>-Wno-c99-extensions |
57 | <toolset>clang:<cxxflags>-Wno-variadic-macros | |
58 | # <toolset>gcc:<cxxflags>--coverage | |
59 | <warnings>all | |
60 | $(extra-options) | |
61 | $(requirements) | |
62 | : $(test-name) | |
63 | ] ; | |
64 | } | |
65 | ||
66 | #_________________________________________________________________________________________________# | |
67 | ||
68 | rule boost.test-mt-test ( test-rule : test-suite : test-name : usage-variant ? : pattern_file * : source_files * : extra-libs ? ) | |
69 | { | |
70 | return [ boost.test-self-test $(test-rule) | |
71 | : $(test-suite) | |
72 | : $(test-name) | |
73 | : $(usage-variant) | |
74 | : $(pattern_file) | |
75 | : $(source_files) | |
76 | : $(extra-libs) | |
77 | : <threading>multi | |
78 | ] ; | |
79 | } | |
80 | ||
81 | #_________________________________________________________________________________________________# | |
82 | ||
83 | rule docs-example-as-test ( test-file ) | |
84 | { | |
85 | test-file-name = [ path.basename $(test-file) ] ; | |
86 | test-name-rule = [ MATCH (.+)\\.(.+)\\.cpp : $(test-file-name) ] ; | |
87 | ||
88 | ||
89 | return [ boost.test-self-test $(test-name-rule[2]) | |
90 | : ../doc/examples | |
91 | : doc-$(test-name-rule[1]) | |
92 | : included | |
93 | : | |
94 | : $(test-file) | |
95 | : | |
96 | : | |
97 | : $(requirements_documentation) # requirements | |
98 | ] ; | |
99 | } | |
100 | ||
101 | #_________________________________________________________________________________________________# | |
102 | ||
103 | test-suite "utils-ts" | |
104 | : | |
105 | [ boost.test-self-test run : utils-ts : algorithm-test ] | |
106 | [ boost.test-self-test run : utils-ts : basic_cstring-test ] | |
107 | [ boost.test-self-test run : utils-ts : class_properties-test ] | |
108 | [ boost.test-self-test run : utils-ts : foreach-test ] | |
109 | [ boost.test-self-test run : utils-ts : named_params-test ] | |
110 | [ boost.test-self-test run : utils-ts : runtime-param-test : : : : : : [ requires cxx11_auto_declarations cxx11_function_template_default_args cxx11_lambdas cxx11_hdr_initializer_list cxx11_template_aliases ] ] | |
111 | [ boost.test-self-test run : utils-ts : string_cast-test ] | |
112 | [ boost.test-self-test run : utils-ts : token_iterator-test ] | |
113 | ; | |
114 | ||
115 | #_________________________________________________________________________________________________# | |
116 | ||
117 | test-suite "usage-variants-ts" | |
118 | : | |
119 | [ boost.test-self-test run : usage-variants-ts : single-header-test : included ] | |
120 | [ boost.test-self-test run : usage-variants-ts : single-header-custom-init-test : included ] | |
121 | [ boost.test-self-test run : usage-variants-ts : single-header-custom-main-test : included ] | |
122 | ||
123 | [ boost.test-self-test run : usage-variants-ts : static-library-test ] | |
124 | [ boost.test-self-test run : usage-variants-ts : static-library-custom-init-test ] | |
125 | ||
126 | [ boost.test-self-test run : usage-variants-ts : shared-library-test : boost_unit_test_framework/<link>shared ] | |
127 | [ boost.test-self-test run : usage-variants-ts : shared-library-custom-init-test : boost_unit_test_framework/<link>shared ] | |
128 | [ boost.test-self-test run : usage-variants-ts : shared-library-custom-main-test : boost_unit_test_framework/<link>shared ] | |
129 | ; | |
130 | ||
131 | #_________________________________________________________________________________________________# | |
132 | ||
133 | test-suite "framework-ts" | |
134 | : | |
135 | [ boost.test-self-test run : framework-ts : result-report-test : : baseline-outputs/result-report-test.pattern ] | |
136 | [ boost.test-self-test run : framework-ts : log-formatter-test : : baseline-outputs/log-formatter-test.pattern ] | |
137 | [ boost.test-self-test run : framework-ts : run-by-name-or-label-test ] | |
b32b8144 FG |
138 | [ boost.test-self-test run : framework-ts : version-uses-module-name : included ] |
139 | [ boost.test-self-test run : framework-ts : test-macro-global-fixture : : baseline-outputs/global-fixtures-test.pattern ] | |
140 | [ boost.test-self-test run : framework-ts : message-in-datatestcase-test : : baseline-outputs/messages-in-datasets-test.pattern : : : : $(requirements_datasets) ] | |
7c673cae FG |
141 | ; |
142 | ||
143 | #_________________________________________________________________________________________________# | |
144 | ||
145 | test-suite "writing-test-ts" | |
146 | : | |
147 | [ boost.test-self-test run : writing-test-ts : assertion-construction-test : : : : : : $(requirements_boost_test_full_support) [ requires cxx11_trailing_result_types cxx11_nullptr ] ] | |
148 | [ boost.test-self-test run : writing-test-ts : boost_check_equal-str-test ] | |
149 | [ boost.test-self-test run : writing-test-ts : collection-comparison-test : : : : : : $(requirements_boost_test_full_support) [ requires cxx11_unified_initialization_syntax ] ] # required by the test content | |
150 | [ boost.test-self-test run : writing-test-ts : dont_print_log_value-test : : : : : : $(requirements_datasets) ] | |
151 | [ boost.test-self-test run : writing-test-ts : fp-comparisons-test : : : : : : $(requirements_boost_test_full_support) ] | |
152 | [ boost.test-self-test run : writing-test-ts : fp-multiprecision-comparison-test : : : : : : $(requirements_boost_test_full_support) ] | |
b32b8144 | 153 | [ boost.test-self-test run : writing-test-ts : fp-relational-operator ] |
7c673cae FG |
154 | [ boost.test-self-test run : writing-test-ts : output_test_stream-test ] |
155 | [ boost.test-self-test run : writing-test-ts : test_tools-test : : baseline-outputs/test_tools-test.pattern : : : : $(requirements_boost_test_full_support) ] | |
156 | [ boost.test-self-test run : writing-test-ts : windows-headers-test ] | |
157 | [ boost.test-self-test run : writing-test-ts : tools-under-debugger-test ] | |
158 | [ boost.test-self-test run : writing-test-ts : tools-debuggable-test : : : : : : $(requirements_boost_test_full_support) ] | |
159 | [ boost.test-self-test run : writing-test-ts : test-dataset-over-tuples : : : : : : $(requirements_datasets) ] | |
b32b8144 FG |
160 | [ boost.test-self-test run : writing-test-ts : nullptr-support-test : : : : : : [ requires cxx11_nullptr ] ] |
161 | [ boost.test-self-test run : writing-test-ts : user-defined-types-logging-customization-points ] | |
162 | [ boost.test-self-test run : writing-test-ts : test-fixture-detect-setup-teardown ] | |
163 | [ boost.test-self-test run : writing-test-ts : test-fixture-detect-setup-teardown-cpp11 : : : : : : [ requires cxx11_decltype cxx11_trailing_result_types ] ] | |
7c673cae FG |
164 | ; |
165 | ||
166 | #_________________________________________________________________________________________________# | |
167 | ||
168 | test-suite "test-organization-ts" | |
169 | : | |
170 | [ boost.test-self-test run : test-organization-ts : parameterized_test-test ] | |
171 | [ boost.test-self-test run : test-organization-ts : test_case_template-test ] | |
172 | [ boost.test-self-test run : test-organization-ts : datasets-test : : : [ glob test-organization-ts/datasets-test/*.cpp ] : : : $(requirements_datasets) ] | |
173 | [ boost.test-self-test run : test-organization-ts : dataset-variadic_and_move_semantic-test : : : : : : $(requirements_datasets) ] | |
174 | [ boost.test-self-test run : test-organization-ts : test_unit-order-test ] | |
175 | [ boost.test-self-test run : test-organization-ts : test_unit-order-shuffled-test : : : : : : $(requirements_boost_test_full_support) ] | |
176 | [ boost.test-self-test run : test-organization-ts : test-tree-management-test ] | |
b32b8144 | 177 | [ boost.test-self-test run : test-organization-ts : test-tree-several-suite-decl ] |
7c673cae FG |
178 | ; |
179 | ||
180 | #_________________________________________________________________________________________________# | |
181 | ||
182 | test-suite "multithreading-ts" | |
183 | : | |
184 | [ boost.test-mt-test run : multithreading-ts : sync-access-test : : : : /boost/thread//boost_thread/<link>static ] | |
185 | ; | |
186 | ||
187 | #_________________________________________________________________________________________________# | |
188 | ||
189 | test-suite "prg_exec_monitor-ts" | |
190 | : | |
191 | [ boost.test-self-test run-fail : prg_exec_monitor-ts : result-code-test : boost_prg_exec_monitor/<link>static ] | |
192 | [ boost.test-self-test run-fail : prg_exec_monitor-ts : system-exception-test : boost_prg_exec_monitor/<link>static ] | |
193 | [ boost.test-self-test run-fail : prg_exec_monitor-ts : uncatched-exception-test : included ] | |
194 | [ boost.test-self-test run-fail : prg_exec_monitor-ts : user-fatal-exception-test : boost_prg_exec_monitor/<link>static ] | |
195 | ; | |
196 | ||
197 | #_________________________________________________________________________________________________# | |
198 | ||
199 | test-suite "execution_monitor-ts" | |
200 | : | |
201 | [ boost.test-self-test run : execution_monitor-ts : errors-handling-test : : baseline-outputs/errors-handling-test.pattern | |
202 | baseline-outputs/errors-handling-test.pattern2 ] | |
203 | [ boost.test-self-test run : execution_monitor-ts : custom-exception-test ] | |
204 | ; | |
205 | ||
206 | #_________________________________________________________________________________________________# | |
207 | ||
208 | import sequence ; | |
209 | ||
210 | test-suite "doc-examples-ts" | |
211 | : | |
212 | [ sequence.transform docs-example-as-test : [ glob ../doc/examples/*.cpp ] ] | |
213 | ; | |
214 | ||
215 | #_________________________________________________________________________________________________# | |
216 | ||
b32b8144 FG |
217 | class bt-conditional-sink |
218 | { | |
219 | import property-set ; | |
220 | import targets ; | |
221 | import property ; | |
222 | ||
223 | rule __init__ ( logger : log_or_report : sink_is_file : log_new_style ) | |
224 | { | |
225 | self.logger = $(logger) ; | |
226 | sink_is_file ?= "no" ; | |
227 | self.sink_is_file = $(sink_is_file) ; | |
228 | self.log_or_report = $(log_or_report) ; | |
229 | self.log_new_style = $(log_new_style) ; | |
230 | } | |
231 | ||
232 | rule check ( properties * ) | |
233 | { | |
234 | local ps = [ property-set.create $(properties) ] ; | |
235 | local path,relative-to-build-dir = [ $(ps).target-path ] ; | |
236 | local path = $(path,relative-to-build-dir[1]) ; | |
237 | ||
238 | local ret ; | |
239 | if $(self.log_new_style) = "yes" && $(self.log_or_report) = "log" | |
240 | { | |
241 | ret += "<testing.arg>--logger=$(self.logger)" ; | |
242 | ||
243 | if $(self.sink_is_file) = "yes" | |
244 | { | |
245 | ret += ",,smoke-ts-sink-new-style.$(self.logger):" ; | |
246 | } | |
247 | ||
248 | ret = $(ret:J) ; | |
249 | } | |
250 | else | |
251 | { | |
252 | ret += <testing.arg>--$(self.log_or_report)_format=$(self.logger) ; | |
253 | ||
254 | if $(self.sink_is_file) = "yes" | |
255 | { | |
256 | ret += <testing.arg>--$(self.log_or_report)_sink=smoke-ts-sink.$(self.logger) ; | |
257 | } | |
258 | } | |
259 | #ECHO ret is $(ret) ; | |
260 | #ECHO ret2 is $(ret:J) ; | |
261 | return $(ret) ; | |
262 | } | |
263 | } | |
264 | ||
265 | rule boost.test-smoke-ts-logger ( test-name-prefix : logger ? : log_or_report ? : requirements ? : log_new_style ? ) | |
266 | { | |
267 | logger ?= HRF ; | |
268 | log_or_report ?= log ; | |
269 | log_new_style ?= no ; | |
270 | ||
271 | local detailed_name = all ; | |
272 | if $(log_or_report) = report | |
273 | { | |
274 | detailed_name = detailed ; | |
275 | } | |
276 | ||
277 | requirements ?= $(requirements_datasets) ; | |
278 | ||
279 | local bt-format-instance = [ new bt-conditional-sink $(logger) : $(log_or_report) : "no" : $(log_new_style) ] ; | |
280 | local bt-format-sink-instance = [ new bt-conditional-sink $(logger) : $(log_or_report) : "yes" : $(log_new_style) ] ; | |
281 | ||
282 | local conditions-format = <conditional>@$(bt-format-instance).check ; | |
283 | local conditions-format-sink = <conditional>@$(bt-format-sink-instance).check ; | |
284 | ||
285 | to-return = | |
286 | [ run smoke-ts-included : | |
287 | : : $(requirements) $(conditions-format) : $(test-name-prefix)-0-$(log_or_report)-format-$(log_new_style) ] | |
288 | [ run smoke-ts-included : --$(log_or_report)_level=$(detailed_name) | |
289 | : : $(requirements) $(conditions-format) : $(test-name-prefix)-1-$(log_or_report)-format-$(log_new_style)-all ] | |
290 | [ run smoke-ts-included : | |
291 | : : $(requirements) $(conditions-format-sink) : $(test-name-prefix)-2-$(log_or_report)-format-to-file-$(log_new_style) ] | |
292 | [ run smoke-ts-included : --$(log_or_report)_level=$(detailed_name) | |
293 | : : $(requirements) $(conditions-format-sink) : $(test-name-prefix)-3-$(log_or_report)-format-to-file-$(log_new_style)-all ] | |
294 | [ run smoke-ts-included : --run_test=test1/_2 | |
295 | : : $(requirements) $(conditions-format) : $(test-name-prefix)-4-$(log_or_report)-format-$(log_new_style)-filter ] | |
296 | ; | |
297 | ||
298 | return $(to-return) ; | |
299 | } | |
300 | ||
301 | exe smoke-ts-included : smoke-ts/basic-smoke-test.cpp | |
302 | : $(requirements_datasets) ; | |
303 | ||
304 | exe smoke-ts-included-2 : smoke-ts/basic-smoke-test2.cpp ; | |
305 | ||
306 | alias "smoke-ts" | |
307 | : | |
308 | [ boost.test-smoke-ts-logger bt-st-txml : XML : log ] | |
309 | [ boost.test-smoke-ts-logger bt-st-txml : XML : log : : yes ] | |
310 | [ boost.test-smoke-ts-logger bt-st-txml : XML : report ] | |
311 | [ boost.test-smoke-ts-logger bt-st-thrf : HRF : log ] | |
312 | [ boost.test-smoke-ts-logger bt-st-thrf : HRF : log : : yes ] | |
313 | [ boost.test-smoke-ts-logger bt-st-thrf : HRF : report ] | |
314 | [ boost.test-smoke-ts-logger bt-st-tjunit : JUNIT : log ] | |
315 | [ boost.test-smoke-ts-logger bt-st-tjunit : JUNIT : log : : yes ] | |
316 | [ run smoke-ts-included-2 : <testing.arg>\"--run_test=test<*\" : : : bt-st-runtest-with-colons ] | |
317 | [ run smoke-ts-included : --version : : $(requirements_datasets) : cla-check-print-version ] | |
318 | # : $(requirements_datasets) | |
319 | ; | |
320 | ||
321 | #_________________________________________________________________________________________________# | |
322 | ||
7c673cae FG |
323 | # A target that runs all the tests |
324 | alias test | |
325 | : | |
b32b8144 | 326 | smoke-ts |
7c673cae FG |
327 | utils-ts |
328 | usage-variants-ts | |
329 | framework-ts | |
330 | writing-test-ts | |
331 | test-organization-ts | |
332 | multithreading-ts | |
333 | prg_exec_monitor-ts | |
334 | execution_monitor-ts | |
335 | doc-examples-ts | |
336 | ; | |
337 | ||
338 | #_________________________________________________________________________________________________# | |
339 | ||
340 | # EOF |