1# Boost Chrono Library test Jamfile
2
3# Copyright Beman Dawes 2008
4# Copyright Vicente J. Botet Escriba 2009-2010
5
6# Distributed under the Boost Software License, Version 1.0.
7# See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt
8
9# See library home page at http://www.boost.org/libs/chrono
10
11import testing ;
12import os ;
13import feature ;
14
15project
16    : requirements
17        <target-os>freebsd:<linkflags>"-lrt"
18        <target-os>linux:<linkflags>"-lrt -lpthread"
19        <toolset>clang/<target-os>linux:<linkflags>"-lpthread"
20        <toolset>pgi:<linkflags>"-lrt"
21        #<threading>single:<define>BOOST_CHRONO_THREAD_DISABLED
22        <toolset>msvc:<asynch-exceptions>on
23        <define>BOOST_CHRONO_USES_MPL_ASSERT
24        #<toolset>sun:<define>BOOST_COMMON_TYPE_DONT_USE_TYPEOF
25        #<toolset>sun:<define>BOOST_TYPEOF_EMULATION
26        <toolset>sun:<define>__typeof__=__typeof__
27        <warnings>all
28        <toolset>gcc:<cxxflags>-Wextra
29        #<toolset>gcc:<cxxflags>-pedantic
30        <toolset>clang:<warnings>on
31        <toolset>gcc:<cxxflags>-Wno-long-long
32        <toolset>gcc:<cxxflags>-Wno-variadic-macros
33        <toolset>darwin:<cxxflags>-Wextra
34        <toolset>darwin:<cxxflags>-pedantic
35        <toolset>darwin:<cxxflags>-Wno-long-long
36        <toolset>darwin:<cxxflags>-Wno-variadic-macros
37        #<toolset>pathscale:<cxxflags>-Wextra
38        <toolset>pathscale:<cxxflags>-Wno-long-long
39        <toolset>pathscale:<cxxflags>-pedantic
40        <toolset>clang:<cxxflags>-Wextra
41        <toolset>clang:<cxxflags>-pedantic
42        <toolset>clang:<cxxflags>-Wno-long-long
43        <toolset>clang:<cxxflags>-Wno-variadic-macros
44        <toolset>gcc-4.5.0,<target-os>windows:<cxxflags>-Wno-missing-field-initializers
45        <toolset>gcc-4.5.0,<target-os>windows:<cxxflags>-fdiagnostics-show-option
46        <toolset>msvc:<cxxflags>/wd4127
47        <toolset>msvc:<cxxflags>/wd4512
48# Note: Some of the remarks from the Intel compiler are disabled
49# remark #193: zero used for undefined preprocessing identifier "XXX"
50# remark #304: access control not specified ("public" by default)
51# remark #383: value copied to temporary, reference to temporary used
52# remark #444: destructor for base class "XXX" (declared at line YYY") is not virtual
53# remark #593: variable "XXX" was set but never used
54# remark #981: operands are evaluated in unspecified order
55# remark #1418: external function definition with no prior declaration
56# remark #2415: variable "XXX" of static storage duration was declared but never referenced
57
58        <toolset>intel:<cxxflags>-wd193,304,383,444
59        <toolset>intel:<cxxflags>-wd593,981
60        <toolset>intel:<cxxflags>-wd1418
61        <toolset>intel:<cxxflags>-wd2415
62    ;
63
64rule chrono-run ( sources )
65{
66    return
67    [ run $(sources) ../build//boost_chrono
68        : :
69        :
70            <define>BOOST_CHRONO_VERSION=2
71        :   $(sources[1]:B)_d  ]
72    #[ run $(sources) ../build//boost_chrono/<link>static
73    #    : :
74    #    :
75    #    :   $(sources[1]:B)_s ]
76    [ run $(sources)
77        : :
78        :   <define>BOOST_CHRONO_HEADER_ONLY
79            <define>BOOST_ERROR_CODE_HEADER_ONLY
80           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
81            <define>BOOST_CHRONO_VERSION=2
82        :   $(sources[1]:B)_h ]
83    ;
84}
85
86rule chrono-runXXX ( sources )
87{
88    return
89    [ run $(sources) ../build//boost_chrono
90        : :
91        :
92            <define>BOOST_CHRONO_VERSION=2
93        :   $(sources[1]:B)_d  ]
94    #[ run $(sources) ../build//boost_chrono/<link>static
95    #    : :
96    #    :
97    #    :   $(sources[1]:B)_s ]
98    [ run $(sources)
99        : :
100        :   <define>BOOST_CHRONO_HEADER_ONLY
101            <define>BOOST_ERROR_CODE_HEADER_ONLY
102           <define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
103            <define>BOOST_CHRONO_VERSION=2
104        :   $(sources[1]:B)_h ]
105    ;
106}
107
108
109rule chrono-v1-v2-run ( sources )
110{
111    return
112    [ run $(sources) ../build//boost_chrono
113        : :
114        :
115            <define>BOOST_CHRONO_VERSION=2
116        :   $(sources[1]:B)_d  ]
117    [ run $(sources) ../build//boost_chrono/<link>static
118        : :
119        :
120        :   v1_$(sources[1]:B)_s ]
121    [ run $(sources)
122        : :
123        :   <define>BOOST_CHRONO_HEADER_ONLY
124            <define>BOOST_ERROR_CODE_HEADER_ONLY
125           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
126            <define>BOOST_CHRONO_VERSION=2
127        :   $(sources[1]:B)_h ]
128    [ run $(sources)
129        : :
130        :   <define>BOOST_CHRONO_HEADER_ONLY
131            <define>BOOST_ERROR_CODE_HEADER_ONLY
132           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
133           #<define>BOOST_CHRONO_VERSION=1
134        :   v1_$(sources[1]:B)_h ]
135    ;
136}
137
138rule chrono-run2 ( sources : name )
139{
140    return
141    [ run $(sources) ../build//boost_chrono
142        : :
143        :
144            <define>BOOST_CHRONO_VERSION=2
145        :   $(name)_d  ]
146    #[ run $(sources) ../build//boost_chrono/<link>static
147    #    : :
148    #    :
149    #    : $(name)_s ]
150    [ run $(sources)
151        : :
152        :   <define>BOOST_CHRONO_HEADER_ONLY
153            <define>BOOST_ERROR_CODE_HEADER_ONLY
154           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
155            <define>BOOST_CHRONO_VERSION=2
156        : $(name)_h ]
157    ;
158}
159
160rule date-run ( sources + )
161{
162    return
163    [ run $(sources) ../build//boost_chrono
164        : :
165        :
166            <define>BOOST_CHRONO_VERSION=2
167        :   $(sources[1]:B)_d  ]
168    ;
169}
170
171rule date-run-2 ( sources + : name )
172{
173    return
174    [ run $(sources) ../build//boost_chrono
175        : :
176        :
177            <define>BOOST_CHRONO_VERSION=2
178        :   $(name)_d  ]
179    ;
180}
181
182
183rule chrono-run-mt ( sources )
184{
185    return
186    [ run $(sources) ../build//boost_chrono
187        : :
188        :
189            <define>BOOST_CHRONO_VERSION=2
190        :   $(sources[1]:B)_d  ]
191    #[ run $(sources) ../build//boost_chrono/<link>static
192    #    : :
193    #    :
194    #    :  $(sources[1]:B)_s ]
195    [ run $(sources)
196        : :
197        :   <define>BOOST_CHRONO_HEADER_ONLY
198            <define>BOOST_ERROR_CODE_HEADER_ONLY
199           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
200            <define>BOOST_CHRONO_VERSION=2
201        :   $(sources[1]:B)_h ]
202    ;
203}
204rule chrono-run2-mt ( sources * : name )
205{
206    return
207    [ run $(sources) ../build//boost_chrono
208        : :
209        :
210            <define>BOOST_CHRONO_VERSION=2
211        :   $(name)_d  ]
212    #[ run $(sources) ../build//boost_chrono/<link>static
213    #    : :
214    #    :
215    #    : $(name)_s ]
216    [ run $(sources)
217        : :
218        :   <define>BOOST_CHRONO_HEADER_ONLY
219            <define>BOOST_ERROR_CODE_HEADER_ONLY
220           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
221            <define>BOOST_CHRONO_VERSION=2
222        : $(name)_h ]
223    ;
224}
225
226rule chrono-run-check ( sources )
227{
228    return
229    [ run $(sources)
230        : :
231        :
232            <define>BOOST_CHRONO_VERSION=2
233        :   $(sources[1]:B)_d  ]
234    [ run $(sources)
235        : :
236        :
237            <define>BOOST_CHRONO_VERSION=2
238        :   $(sources[1]:B)_s ]
239    [ run $(sources)
240        : :
241        :   <define>BOOST_CHRONO_HEADER_ONLY
242            <define>BOOST_ERROR_CODE_HEADER_ONLY
243           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
244            <define>BOOST_CHRONO_VERSION=2
245        :   $(sources[1]:B)_h ]
246    ;
247}
248
249rule chrono-run-check2 ( sources : name )
250{
251    return
252    [ run $(sources)
253        : :
254        :
255            <define>BOOST_CHRONO_VERSION=2
256        :   $(name)_d  ]
257    [ run $(sources)
258        : :
259        :
260            <define>BOOST_CHRONO_VERSION=2
261        : $(name)_s ]
262    [ run $(sources)
263        : :
264        :   <define>BOOST_CHRONO_HEADER_ONLY
265            <define>BOOST_ERROR_CODE_HEADER_ONLY
266           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
267            <define>BOOST_CHRONO_VERSION=2
268        : $(name)_h ]
269    ;
270}
271
272rule chrono-run-header ( sources )
273{
274    return
275    [ run $(sources)
276        : :
277        :   <define>BOOST_CHRONO_HEADER_ONLY
278            <define>BOOST_ERROR_CODE_HEADER_ONLY
279           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
280            <define>BOOST_CHRONO_VERSION=2
281        :   $(sources[1]:B)_h ]
282    ;
283}
284
285rule chrono-v1-v2-run-header ( sources )
286{
287    return
288    [ run $(sources)
289        : :
290        :   <define>BOOST_CHRONO_HEADER_ONLY
291            <define>BOOST_ERROR_CODE_HEADER_ONLY
292           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
293            <define>BOOST_CHRONO_VERSION=2
294        :   $(sources[1]:B)_h ]
295    [ run $(sources)
296        : :
297        :   <define>BOOST_CHRONO_HEADER_ONLY
298            <define>BOOST_ERROR_CODE_HEADER_ONLY
299           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
300        :   v1_$(sources[1]:B)_h ]
301    ;
302}
303
304rule chrono-run-header2 ( sources : name )
305{
306    return
307    [ run $(sources)
308        : :
309        :   <define>BOOST_CHRONO_HEADER_ONLY
310            <define>BOOST_ERROR_CODE_HEADER_ONLY
311           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
312            <define>BOOST_CHRONO_VERSION=2
313        : $(name)_h ]
314    ;
315}
316
317rule chrono-compile ( sources )
318{
319    return
320    [ compile $(sources)
321        :
322            <define>BOOST_CHRONO_VERSION=2
323        : $(sources[1]:B)_l ]
324    [ compile $(sources)
325        :   <define>BOOST_CHRONO_HEADER_ONLY
326            <define>BOOST_ERROR_CODE_HEADER_ONLY
327           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
328            <define>BOOST_CHRONO_VERSION=2
329        : $(sources[1]:B)_h ]
330    ;
331}
332
333rule chrono-compile2 ( sources : name )
334{
335    return
336    [ compile $(sources)
337        :
338            <define>BOOST_CHRONO_VERSION=2
339        : $(name)_l ]
340    [ compile $(sources)
341        :  <define>BOOST_CHRONO_HEADER_ONLY
342            <define>BOOST_ERROR_CODE_HEADER_ONLY
343           #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
344            <define>BOOST_CHRONO_VERSION=2
345        : $(name)_h ]
346    ;
347}
348
349
350    test-suite "examples"
351        :
352        [ chrono-run-header ../example/cycle_count.cpp  ]
353        [ chrono-run-header ../example/runtime_resolution.cpp  ]
354        [ chrono-run-header ../example/xtime.cpp ]
355        [ chrono-run-header ../example/saturating.cpp  ]
356        [ chrono-run ../example/min_time_point.cpp  ]
357        [ chrono-run-header ../example/i_dont_like_the_default_duration_behavior.cpp ]
358        [ chrono-run ../example/simulated_thread_interface_demo.cpp ]
359        [ chrono-run-header ../example/timeval_demo.cpp ]
360        [ chrono-run ../example/chrono_unit_test.cpp  ]
361        [ chrono-run-header ../example/explore_limits.cpp  ]
362        [ chrono-run-header ../example/test_duration.cpp ]
363        [ chrono-run ../example/test_clock.cpp ]
364        [ chrono-run-header ../example/miscellaneous.cpp ]
365        [ chrono-run-header ../example/test_special_values.cpp ]
366        [ chrono-run ../example/manipulate_clock_object.cpp ]
367        [ chrono-run-mt ../example/test_thread_clock.cpp  ]
368        [ chrono-run-header ../example/rounding.cpp  ]
369        #[ chrono-run ../example/await_keystroke.cpp  ]
370        ;
371
372    test-suite "traits"
373        :
374        [ chrono-compile2 traits/common_type_duration_pass.cpp : traits_common_type_duration_p ]
375        [ chrono-compile2 traits/common_type_time_point_pass.cpp : traits_common_type_time_point_p ]
376        [ chrono-compile2 traits/treat_as_floating_point_pass.cpp : traits_treat_as_floating_point_p  ]
377        [ chrono-run-header2 traits/duration_values_pass.cpp : traits_duration_values_p ]
378        ;
379
380    test-suite "duration"
381        :
382        [ compile-fail duration/duration_duration_fail.cpp  ]
383        [ compile-fail duration/ratio_fail.cpp  ]
384        [ compile-fail duration/positive_num_fail.cpp  ]
385        [ chrono-compile duration/default_ratio_pass.cpp ]
386        [ chrono-compile duration/types_pass.cpp ]
387        [ chrono-compile duration/ratio_alias_pass.cpp ]
388        [ chrono-compile duration/typedefs_pass.cpp  ]
389        [ chrono-run-header duration/arithmetic_pass.cpp  ]
390        [ chrono-run-header duration/duration_cast_pass.cpp  ]
391        [ compile-fail duration/duration_cast_int_fail.cpp  ]
392        [ chrono-run-header duration/comparisons_pass.cpp  ]
393        [ chrono-run-header duration/constructor_pass.cpp  ]
394        [ compile-fail duration/cons/convert_float_to_int_fail.cpp  ]
395        [ compile-fail duration/cons/convert_inexact_fail.cpp  ]
396        [ compile-fail duration/cons/implicit_constructot_fail.cpp  ]
397        [ compile-fail duration/cons/non_implicit_convertible_rep_fail.cpp ]
398        [ compile-fail duration/cons/treat_as_floating_point_Rep2_true_fail.cpp  ]
399        [ compile-fail duration/nonmember/divide_rep2_fail.cpp  ]
400        [ compile-fail duration/nonmember/modulus_rep2_fail.cpp  ]
401        [ compile-fail duration/nonmember/times_rep2_lhs_fail.cpp ]
402        [ compile-fail duration/nonmember/times_rep2_rhs_fail.cpp ]
403        [ chrono-run-header duration/duration_values_pass.cpp ]
404        [ chrono-run-header duration/rounding_pass.cpp  ]
405        ;
406
407    test-suite "time_point"
408        :
409        [ chrono-compile2 time_point/default_duration_pass.cpp : time_point_default_duration_p ]
410        [ compile-fail time_point/not_duration_fail.cpp : : time_point_not_duration_f   ]
411        [ chrono-run-header2 time_point/arithmetic_pass.cpp  : time_point_arithmetic_p ]
412        [ chrono-run-header2 time_point/arithmetic_ext_pass.cpp  : time_point_arithmetic_ext_p ]
413        [ chrono-run-header2 time_point/time_point_cast_pass.cpp  : time_point_time_point_cast_p ]
414        [ compile-fail time_point/time_point_cast_int_fail.cpp : : time_point_time_point_cast_int_f   ]
415        [ chrono-run-header2 time_point/comparisons_pass.cpp  : time_point_comparisons_p ]
416        [ compile-fail time_point/comparisons/equal_fail.cpp : : time_point_equal_f   ]
417        [ compile-fail time_point/comparisons/less_fail.cpp : : time_point_less_f   ]
418        [ chrono-run-header2 time_point/constructor_pass.cpp  : time_point_constructor_p ]
419        [ compile-fail time_point/cons/implicit_fail.cpp : : time_point_implicit_f   ]
420        [ compile-fail time_point/cons/non_implicit_convertible_duration_fail.cpp : : time_point_non_implicit_convertible_duration_f   ]
421        [ chrono-run-header2 time_point/min_max_pass.cpp  : time_point_min_max_p ]
422        ;
423
424    test-suite "clock"
425        :
426        [ chrono-run2-mt clock/clock_pass.cpp  : clock_clock_p ]
427        [ chrono-run2-mt one_obj.cpp another_obj.cpp   : two_obj_p ]
428        ;
429
430    test-suite "io_ex"
431        :
432        [ chrono-v1-v2-run ../example/io_ex1.cpp  ]
433        [ chrono-v1-v2-run-header ../example/io_ex2.cpp  ]
434        [ chrono-v1-v2-run ../example/io_ex3.cpp  ]
435        [ chrono-v1-v2-run ../example/io_ex4.cpp  ]
436        [ chrono-v1-v2-run ../example/io_ex5.cpp  ]
437        [ chrono-v1-v2-run ../example/french.cpp  ]
438        ;
439
440    test-suite "io"
441        :
442        [ chrono-v1-v2-run-header io/duration_input.cpp  ]
443        [ chrono-v1-v2-run-header io/duration_output.cpp  ]
444        [ chrono-v1-v2-run-header io/time_point_input.cpp  ]
445        [ chrono-v1-v2-run-header io/time_point_output.cpp  ]
446        [ chrono-run test_7868.cpp  ]
447        [ chrono-run test_11006.cpp  ]
448        [ chrono-run test_11012.cpp  ]
449        [ chrono-runXXX test_12176.cpp  ]
450        ;
451
452    test-suite "win32"
453        :
454        [ chrono-run win32_test.cpp  ]
455        ;
456
457    explicit ts_ ;
458    test-suite ts_
459        :
460        #[ chrono-run test_7868.cpp  ]
461        #[ chrono-run test_9337.cpp  ]
462        #[ chrono-run test_10778.cpp  ]
463        [ chrono-run test_10631.cpp  ]
464        ;
465
466