Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / serialization / util / test.jam
1 # Boost serialization Library utility test Jamfile
2
3 #  (C) Copyright Robert Ramey 2002-2004.
4 #  Use, modification, and distribution are subject to the 
5 #  Boost Software License, Version 1.0. (See accompanying file 
6 #  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #
8
9 # the file contains Jam rules which are used in both the normal
10 # boost test, as well as the performance test and comprehensive
11 # tests.
12
13 BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ;
14
15 # these are used to shorten testing while in development.  It permits
16 # testing to be applied to just a particular type of archive
17 if ! $(BOOST_ARCHIVE_LIST) {
18     BOOST_ARCHIVE_LIST = 
19         "text_archive.hpp" 
20         "text_warchive.hpp" 
21         "binary_archive.hpp" 
22         "xml_archive.hpp" 
23         "xml_warchive.hpp" 
24     ;
25     # enable the tests which don't depend on a particular archive
26     BOOST_SERIALIZATION_TEST = true ;
27 }
28
29 rule run-template ( test-name : sources * : requirements * ) {
30     return [
31         run
32             $(sources)
33         : # command
34         : # input files
35         : # requirements
36             # toolset warnings
37             <toolset>borland:<cxxflags>"-w-8080 -w-8071 -w-8057 -w-8062 -w-8008 -w-0018 -w-8066"
38             #<toolset>gcc:<warnings>all # ?
39             <toolset>gcc:<cxxflags>"-Wno-unused-variable -Wno-long-long"
40             # <toolset>gcc:<variant>debug><define>_STLP_DEBUG
41             # <toolset>gcc:<variant>debug><define>_GLIBCXX_DEBUG
42             <toolset>darwin:<cxxflags>"-Wno-unused-variable -Wno-long-long"
43             <toolset>msvc:<warnings>all # == /W4
44             <toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
45             <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
46             <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
47             <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
48             <toolset>msvc:<cxxflags>"-wd4996"
49             <toolset>clang:<variant>debug:<cxxflags>"-fsanitize=memory"
50             # toolset optimizations
51             <toolset>gcc:<cxxflags>"-ftemplate-depth-255"
52             <toolset>clang:<cxxflags>"-ftemplate-depth-255"
53             <toolset>darwin:<cxxflags>"-ftemplate-depth-255"
54             <toolset>msvc:<cxxflags>"-Gy"
55             # linking
56             <link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1 
57             <link>shared:<define>BOOST_WSERIALIZATION_DYN_LINK=1 
58             $(requirements)
59         : # test name
60             $(test-name)
61     ] ;
62 }
63
64 # Given a name of test, return the 'save' test that must be run
65 # before the named test, or empty string if there's no such test.
66 rule dependency-save-test ( test )
67 {
68     local m = [ MATCH (.*)load(.*) : $(test) ] ;
69     if $(m)
70     {
71         return $(m[1])save$(m[2]) ;
72     }  
73 }
74
75 # each of the following tests is run with each type of archive
76 rule run-invoke ( test-name : sources * : requirements * )
77 {
78     local save-test = [ dependency-save-test $(test-name) ] ;
79
80     local tests ;
81     tests += [ 
82         run-template $(test-name)
83         : # sources
84             $(sources)
85             ../build//boost_serialization
86         : # requirements
87             $(requirements)
88             <define>BOOST_LIB_DIAGNOSTIC=1
89             <dependency>$(save-test)
90     ] ;
91     return $(tests) ;
92 }
93
94 # each of the following tests is run with each type of archive
95 rule run-winvoke ( test-name : sources * : requirements * )
96 {
97     local save-test = [ dependency-save-test $(test-name) ] ;
98
99     local tests ;
100     tests += [ 
101         run-template $(test-name)
102         : # sources
103             $(sources)
104             ../build//boost_serialization
105             ../build//boost_wserialization
106         : # requirements
107             $(requirements)
108             <define>BOOST_LIB_DIAGNOSTIC=1
109             # both stlport and msvc6 define iswspace
110             <toolset>msvc,<stdlib>stlport:<linkflags>"-force:multiple"
111             <dependency>$(save-test)
112             <dependency>../../config/test/all//BOOST_NO_STD_WSTREAMBUF
113     ] ;
114     return $(tests) ;
115 }
116
117 # for tests which don't use library code - usually just headers
118 rule test-bsl-run-no-lib  ( test-name : sources * : requirements * )
119 {
120     local tests ;
121     tests += [ 
122         run-template $(test-name)
123         : # sources
124             $(test-name).cpp $(sources).cpp
125         :
126             $(requirements)
127     ] ;
128     return $(tests) ;
129 }
130
131 # for tests which are run just once rather than for every archive
132 rule test-bsl-run ( test-name : sources * : libs * : requirements * )
133 {
134     local tests ;
135     tests +=  [ 
136         run-invoke $(test-name) 
137         : # sources
138             $(test-name).cpp $(sources).cpp $(libs)
139         :
140             $(requirements)
141     ] ;
142     return $(tests) ;
143 }
144
145 rule test-bsl-run_archive ( test-name : archive-name : sources * : libs * : requirements * ) {
146     local tests ;
147     switch $(archive-name) {
148     case "*_warchive" :
149         tests +=  [
150             run-winvoke $(test-name)_$(archive-name)
151             : 
152                 $(sources).cpp $(libs)
153             :
154                 <define>BOOST_ARCHIVE_TEST=$(archive-name).hpp
155                 $(requirements)
156         ] ;
157     case "*" :
158         tests +=  [
159             run-invoke $(test-name)_$(archive-name)
160             : 
161                 $(sources).cpp $(libs)
162             : 
163                 <define>BOOST_ARCHIVE_TEST=$(archive-name).hpp
164                 $(requirements)
165         ] ;
166     }
167     return $(tests) ;
168 }
169
170 rule test-bsl-run_files ( test-name : sources * : libs * : requirements * ) {
171     local tests ;
172     for local defn in $(BOOST_ARCHIVE_LIST) {
173         tests += [ 
174             test-bsl-run_archive $(test-name) 
175             : $(defn:LB) 
176             : $(test-name) $(sources) 
177             : $(libs)
178             : $(requirements)
179         ] ;
180     }
181     return $(tests) ;
182 }
183     
184 rule test-bsl-run_polymorphic_archive ( test-name : sources * : requirements * ) {
185     local tests ;
186     for local defn in $(BOOST_ARCHIVE_LIST) {
187         tests += [ 
188             test-bsl-run_archive $(test-name)
189             : polymorphic_$(defn:LB)  
190             : $(test-name) $(sources) $(requirements)
191         ] ;
192     }
193     return $(tests) ;
194 }
195