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)
6 # See http://www.boost.org/libs/test for the library home page.
12 import "class" : new ;
14 import ../../config/checks/config : requires ;
16 project boost/test-tests
20 import ../../predef/check/predef
22 : predef-check predef-require ;
24 local check_msg = "Boost.Test feature check: " ;
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 ] ;
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 ] ;
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 ] ;
37 #_________________________________________________________________________________________________#
39 # lib gcov : : <name>gcov : ;
41 rule boost.test-self-test ( test-rule : test-suite : test-name : usage-variant ? : pattern_file * : source_files * : extra-libs ? : extra-options ? : requirements * )
43 source_files ?= $(test-suite)/$(test-name).cpp ;
44 usage-variant ?= boost_unit_test_framework/<link>static ;
46 return [ $(test-rule) $(source_files) ../build//$(usage-variant) $(extra-libs)
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
55 [ predef-check "BOOST_COMP_GNUC >= 4.3.0" : : <cxxflags>-Wno-variadic-macros ]
56 <toolset>clang:<cxxflags>-Wno-c99-extensions
57 <toolset>clang:<cxxflags>-Wno-variadic-macros
58 # <toolset>gcc:<cxxflags>--coverage
66 #_________________________________________________________________________________________________#
68 rule boost.test-mt-test ( test-rule : test-suite : test-name : usage-variant ? : pattern_file * : source_files * : extra-libs ? )
70 return [ boost.test-self-test $(test-rule)
81 #_________________________________________________________________________________________________#
83 rule docs-example-as-test ( test-file )
85 test-file-name = [ path.basename $(test-file) ] ;
86 test-name-rule = [ MATCH (.+)\\.(.+)\\.cpp : $(test-file-name) ] ;
89 return [ boost.test-self-test $(test-name-rule[2])
91 : doc-$(test-name-rule[1])
97 : $(requirements_documentation) # requirements
101 #_________________________________________________________________________________________________#
103 test-suite "utils-ts"
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 ]
115 #_________________________________________________________________________________________________#
117 test-suite "usage-variants-ts"
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 ]
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 ]
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 ]
131 #_________________________________________________________________________________________________#
133 test-suite "framework-ts"
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 ]
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) ]
143 #_________________________________________________________________________________________________#
145 test-suite "writing-test-ts"
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) ]
153 [ boost.test-self-test run : writing-test-ts : fp-relational-operator ]
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) ]
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 ] ]
166 #_________________________________________________________________________________________________#
168 test-suite "test-organization-ts"
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 ]
177 [ boost.test-self-test run : test-organization-ts : test-tree-several-suite-decl ]
180 #_________________________________________________________________________________________________#
182 test-suite "multithreading-ts"
184 [ boost.test-mt-test run : multithreading-ts : sync-access-test : : : : /boost/thread//boost_thread/<link>static ]
187 #_________________________________________________________________________________________________#
189 test-suite "prg_exec_monitor-ts"
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 ]
197 #_________________________________________________________________________________________________#
199 test-suite "execution_monitor-ts"
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 ]
206 #_________________________________________________________________________________________________#
210 test-suite "doc-examples-ts"
212 [ sequence.transform docs-example-as-test : [ glob ../doc/examples/*.cpp ] ]
215 #_________________________________________________________________________________________________#
217 class bt-conditional-sink
219 import property-set ;
223 rule __init__ ( logger : log_or_report : sink_is_file : log_new_style )
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) ;
232 rule check ( properties * )
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]) ;
239 if $(self.log_new_style) = "yes" && $(self.log_or_report) = "log"
241 ret += "<testing.arg>--logger=$(self.logger)" ;
243 if $(self.sink_is_file) = "yes"
245 ret += ",,smoke-ts-sink-new-style.$(self.logger):" ;
252 ret += <testing.arg>--$(self.log_or_report)_format=$(self.logger) ;
254 if $(self.sink_is_file) = "yes"
256 ret += <testing.arg>--$(self.log_or_report)_sink=smoke-ts-sink.$(self.logger) ;
259 #ECHO ret is $(ret) ;
260 #ECHO ret2 is $(ret:J) ;
265 rule boost.test-smoke-ts-logger ( test-name-prefix : logger ? : log_or_report ? : requirements ? : log_new_style ? )
268 log_or_report ?= log ;
269 log_new_style ?= no ;
271 local detailed_name = all ;
272 if $(log_or_report) = report
274 detailed_name = detailed ;
277 requirements ?= $(requirements_datasets) ;
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) ] ;
282 local conditions-format = <conditional>@$(bt-format-instance).check ;
283 local conditions-format-sink = <conditional>@$(bt-format-sink-instance).check ;
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 ]
298 return $(to-return) ;
301 exe smoke-ts-included : smoke-ts/basic-smoke-test.cpp
302 : $(requirements_datasets) ;
304 exe smoke-ts-included-2 : smoke-ts/basic-smoke-test2.cpp ;
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)
321 #_________________________________________________________________________________________________#
323 # A target that runs all the tests
338 #_________________________________________________________________________________________________#