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
8import path ;
9
10import ../../config/checks/config : requires ;
11
12project
13    : requirements
14    ;
15
16#_________________________________________________________________________________________________#
17
18rule boost.test-self-test ( test-rule : test-suite : test-name : usage-variant ? : pattern_file * : source_files * : extra-libs ? : extra-options ? )
19{
20    source_files ?= $(test-suite)/$(test-name).cpp ;
21    usage-variant ?= boost_unit_test_framework/<link>static ;
22
23    return [ $(test-rule) $(source_files) ../build//$(usage-variant) $(extra-libs)
24             : #args
25             : $(pattern_file)
26             : # Activating -pedantic finds more gotchas
27               # Unfortunately, this warns about the use of "long long" in gcc's own stdlib
28               # So deactivate those warnings again
29               <toolset>gcc:<cxxflags>-pedantic
30               <toolset>gcc:<cxxflags>-Wno-long-long
31               <toolset>gcc:<cxxflags>-std=c++11
32               <toolset>clang:<cxxflags>-Wno-c99-extensions
33               <toolset>clang:<cxxflags>-std=c++11
34#               <toolset>clang:<cxxflags>-Wconversion
35#               <toolset>clang:<cxxflags>-Wno-sign-conversion
36#               <toolset>gcc:<cxxflags>-E
37#               <toolset>gcc:<cxxflags>-fno-exceptions
38#               <toolset>gcc:<cxxflags>-DBOOST_NO_EXCEPTION
39#               <toolset>clang:<cxxflags>-fno-exceptions
40#               <toolset>clang:<cxxflags>-DBOOST_NO_EXCEPTION
41               <warnings>all
42               $(extra-options)
43             : $(test-name)
44           ] ;
45}
46
47#_________________________________________________________________________________________________#
48
49rule boost.test-mt-test ( test-rule : test-suite : test-name : usage-variant ? : pattern_file * : source_files * : extra-libs ? )
50{
51    return [ boost.test-self-test $(test-rule)
52             : $(test-suite)
53             : $(test-name)
54             : $(usage-variant)
55             : $(pattern_file)
56             : $(source_files)
57             : $(extra-libs)
58             : <threading>multi
59           ] ;
60}
61
62#_________________________________________________________________________________________________#
63
64rule docs-example-as-test ( test-file )
65{
66    test-file-name = [ path.basename $(test-file) ] ;
67    test-name-rule = [ MATCH (.+)\\.(.+)\\.cpp : $(test-file-name) ] ;
68
69    return [ boost.test-self-test $(test-name-rule[2]) : ../doc/examples : doc-$(test-name-rule[1]) : included : : $(test-file) ] ;
70}
71
72#_________________________________________________________________________________________________#
73
74test-suite "utils-ts"
75:
76  [ boost.test-self-test run : utils-ts : algorithm-test ]
77  [ boost.test-self-test run : utils-ts : basic_cstring-test ]
78  [ boost.test-self-test run : utils-ts : class_properties-test ]
79#  [ boost.test-self-test run : utils-ts : config_file-test ]
80#  [ boost.test-self-test run : utils-ts : config_file_iterator-test ]
81  [ boost.test-self-test run : utils-ts : fixed_mapping-test ]
82  [ boost.test-self-test run : utils-ts : foreach-test ]
83  [ boost.test-self-test run : utils-ts : ifstream_line_iterator-test : : inputs/ifstream_line_iterator.tst1
84                                                                          inputs/ifstream_line_iterator.tst2 ]
85  [ boost.test-self-test run : utils-ts : token_iterator-test ]
86;
87
88#_________________________________________________________________________________________________#
89
90test-suite "usage-variants-ts"
91:
92  [ boost.test-self-test run : usage-variants-ts : single-header-test : included ]
93  [ boost.test-self-test run : usage-variants-ts : single-header-custom-init-test : included ]
94  [ boost.test-self-test run : usage-variants-ts : single-header-custom-main-test : included ]
95
96  [ boost.test-self-test run : usage-variants-ts : static-library-test ]
97  [ boost.test-self-test run : usage-variants-ts : static-library-custom-init-test ]
98
99  [ boost.test-self-test run : usage-variants-ts : shared-library-test : boost_unit_test_framework/<link>shared ]
100  [ boost.test-self-test run : usage-variants-ts : shared-library-custom-init-test : boost_unit_test_framework/<link>shared ]
101  [ boost.test-self-test run : usage-variants-ts : shared-library-custom-main-test : boost_unit_test_framework/<link>shared ]
102;
103
104#_________________________________________________________________________________________________#
105
106test-suite "framework-ts"
107:
108  [ boost.test-self-test run : framework-ts : result-report-test : : baseline-outputs/result-report-test.pattern ]
109  [ boost.test-self-test run : framework-ts : run-by-name-or-label-test ]
110;
111
112#_________________________________________________________________________________________________#
113
114test-suite "writing-test-ts"
115:
116  [ boost.test-self-test run : writing-test-ts : assertion-construction-test ]
117  [ boost.test-self-test run : writing-test-ts : boost_check_equal-str-test ]
118  [ boost.test-self-test run : writing-test-ts : collection-comparison-test ]
119  [ boost.test-self-test run : writing-test-ts : dont_print_log_value-test ]
120  [ boost.test-self-test run : writing-test-ts : fp-comparisons-test ]
121  [ boost.test-self-test run : writing-test-ts : fp-multiprecision-comparison-test ]
122  [ boost.test-self-test run : writing-test-ts : output_test_stream-test ]
123  [ boost.test-self-test run : writing-test-ts : test_tools-test : : baseline-outputs/test_tools-test.pattern ]
124  [ boost.test-self-test run : writing-test-ts : windows-headers-test ]
125  [ boost.test-self-test run : writing-test-ts : tools-under-debugger-test ]
126  [ boost.test-self-test run : writing-test-ts : tools-debuggable-test ]
127;
128
129#_________________________________________________________________________________________________#
130
131test-suite "test-organization-ts"
132:
133  [ boost.test-self-test run : test-organization-ts : parameterized_test-test ]
134  [ boost.test-self-test run : test-organization-ts : test_case_template-test ]
135  [ boost.test-self-test run : test-organization-ts : datasets-test : : : [ glob test-organization-ts/datasets-test/*.cpp ] ]
136  [ boost.test-self-test run : test-organization-ts : test_unit-order-test ]
137  [ boost.test-self-test run : test-organization-ts : test-tree-management-test ]
138;
139
140#_________________________________________________________________________________________________#
141
142test-suite "multithreading-ts"
143:
144  [ boost.test-mt-test run : multithreading-ts : sync-access-test : : : : /boost/thread//boost_thread/<link>static ]
145;
146
147#_________________________________________________________________________________________________#
148
149test-suite "prg_exec_monitor-ts"
150:
151  [ boost.test-self-test run-fail : prg_exec_monitor-ts : result-code-test : boost_prg_exec_monitor/<link>static ]
152  [ boost.test-self-test run-fail : prg_exec_monitor-ts : system-exception-test : boost_prg_exec_monitor/<link>static ]
153  [ boost.test-self-test run-fail : prg_exec_monitor-ts : uncatched-exception-test : included ]
154  [ boost.test-self-test run-fail : prg_exec_monitor-ts : user-fatal-exception-test : boost_prg_exec_monitor/<link>static ]
155;
156
157#_________________________________________________________________________________________________#
158
159test-suite "execution_monitor-ts"
160:
161  [ boost.test-self-test run : execution_monitor-ts : errors-handling-test : : baseline-outputs/errors-handling-test.pattern
162                                                                               baseline-outputs/errors-handling-test.pattern2 ]
163  [ boost.test-self-test run : execution_monitor-ts : custom-exception-test ]
164;
165
166#_________________________________________________________________________________________________#
167
168import sequence ;
169
170test-suite "doc-examples-ts"
171:
172  [ sequence.transform docs-example-as-test : [ glob ../doc/examples/*.cpp ] ]
173;
174
175#_________________________________________________________________________________________________#
176
177# A target that runs all the tests
178alias test
179:
180  utils-ts
181  usage-variants-ts
182  framework-ts
183  writing-test-ts
184  test-organization-ts
185  multithreading-ts
186  prg_exec_monitor-ts
187  execution_monitor-ts
188  doc-examples-ts
189;
190
191#_________________________________________________________________________________________________#
192
193# EOF
194