Imported Upstream version 1.57.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>gcc:<cxxflags>"-Wno-non-virtual-dtor -Wno-ctor-dtor-privacy"
38             <toolset>borland:<cxxflags>"-w-8080 -w-8071 -w-8057 -w-8062 -w-8008 -w-0018 -w-8066"
39             <toolset>gcc:<warnings>all # ?
40             <toolset>gcc:<cxxflags>"-Wno-long-long"
41             <toolset>msvc:<warnings>all # == /W4
42             <toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
43             <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
44             <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
45             <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
46             <toolset>msvc:<cxxflags>"-wd4996"
47             # toolset optimizations
48             <toolset>gcc:<cxxflags>"-ftemplate-depth-255"
49             <toolset>clang:<cxxflags>"-ftemplate-depth-255"
50             <toolset>clang-darwin:<cxxflags>"-ftemplate-depth-255"
51             <toolset>darwin:<cxxflags>"-ftemplate-depth-255"
52             <toolset>msvc:<cxxflags>"-Gy"
53             $(requirements)
54         : # test name
55             $(test-name)
56     ] ;
57 }
58
59 # Given a name of test, return the 'save' test that must be run
60 # before the named test, or empty string if there's no such test.
61 rule dependency-save-test ( test )
62 {
63     local m = [ MATCH (.*)load(.*) : $(test) ] ;
64     if $(m)
65     {
66         return $(m[1])save$(m[2]) ;
67     }  
68 }
69
70 # each of the following tests is run with each type of archive
71 rule run-invoke ( test-name : sources * : requirements * )
72 {
73     local save-test = [ dependency-save-test $(test-name) ] ;
74
75     local tests ;
76     tests += [ 
77         run-template $(test-name)
78         : # sources
79             $(sources)
80             ../build//boost_serialization
81         : # requirements
82             $(requirements)
83             <define>BOOST_LIB_DIAGNOSTIC=1
84             <dependency>$(save-test)
85     ] ;
86     return $(tests) ;
87 }
88
89 # each of the following tests is run with each type of archive
90 rule run-winvoke ( test-name : sources * : requirements * )
91 {
92     local save-test = [ dependency-save-test $(test-name) ] ;
93
94     local tests ;
95     tests += [ 
96         run-template $(test-name)
97         : # sources
98             $(sources)
99             ../build//boost_serialization
100             ../build//boost_wserialization
101         : # requirements
102             $(requirements)
103             <define>BOOST_LIB_DIAGNOSTIC=1
104             # both stlport and msvc6 define iswspace
105             <toolset>msvc,<stdlib>stlport:<linkflags>"-force:multiple"
106             <dependency>$(save-test)
107             <dependency>../../config/test/all//BOOST_NO_STD_WSTREAMBUF
108     ] ;
109     return $(tests) ;
110 }
111
112 # for tests which don't use library code - usually just headers
113 rule test-bsl-run-no-lib  ( test-name : sources * : requirements * )
114 {
115     local tests ;
116     tests += [ 
117         run-template $(test-name)
118         : # sources
119             $(test-name).cpp $(sources).cpp
120         :
121             $(requirements)
122     ] ;
123     return $(tests) ;
124 }
125
126 # for tests which are run just once rather than for every archive
127 rule test-bsl-run ( test-name : sources * : libs * : requirements * )
128 {
129     local tests ;
130     tests +=  [ 
131         run-invoke $(test-name) 
132         : # sources
133             $(test-name).cpp $(sources).cpp $(libs)
134         :
135             $(requirements)
136     ] ;
137     return $(tests) ;
138 }
139
140 rule test-bsl-run_archive ( test-name : archive-name : sources * : libs * : requirements * ) {
141     local tests ;
142     switch $(archive-name) {
143     case "*_warchive" :
144         tests +=  [
145             run-winvoke $(test-name)_$(archive-name)
146             : 
147                 $(sources).cpp $(libs)
148             :
149                 <define>BOOST_ARCHIVE_TEST=$(archive-name).hpp
150                 $(requirements)
151         ] ;
152     case "*" :
153         tests +=  [
154             run-invoke $(test-name)_$(archive-name)
155             : 
156                 $(sources).cpp $(libs)
157             : 
158                 <define>BOOST_ARCHIVE_TEST=$(archive-name).hpp
159                 $(requirements)
160         ] ;
161     }
162     return $(tests) ;
163 }
164
165 rule test-bsl-run_files ( test-name : sources * : libs * : requirements * ) {
166     local tests ;
167     for local defn in $(BOOST_ARCHIVE_LIST) {
168         tests += [ 
169             test-bsl-run_archive $(test-name) 
170             : $(defn:LB) 
171             : $(test-name) $(sources) 
172             : $(libs)
173             : $(requirements)
174         ] ;
175     }
176     return $(tests) ;
177 }
178     
179 rule test-bsl-run_polymorphic_archive ( test-name : sources * ) {
180     local tests ;
181     for local defn in $(BOOST_ARCHIVE_LIST) {
182         tests += [ 
183             test-bsl-run_archive $(test-name)
184             : polymorphic_$(defn:LB)  
185             : $(test-name) $(sources)
186         ] ;
187     }
188     return $(tests) ;
189 }
190
191