]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/rescan_header.py
3 # Copyright 2012 Steven Watanabe
4 # Distributed under the Boost Software License, Version 1.0.
5 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
9 t
= BoostBuild
.Tester(use_test_config
=False)
11 # Test a header loop that depends on (but does not contain) a generated header.
12 t
.write("test.cpp", '#include "header1.h"\n')
14 t
.write("header1.h", """\
21 t
.write("header2.h", """\
29 t
.write("header3.in", "/* empty file */\n")
31 t
.write("jamroot.jam", """\
33 make header3.h : header3.in : @common.copy ;
34 obj test : test.cpp : <implicit-dependency>header3.h ;
37 t
.run_build_system(["-j2"])
38 t
.expect_addition("bin/$toolset/debug*/header3.h")
39 t
.expect_addition("bin/$toolset/debug*/test.obj")
40 t
.expect_nothing_more()
44 # Test a linear sequence of generated headers.
45 t
.write("test.cpp", '#include "header1.h"\n')
47 t
.write("header1.in", """\
54 t
.write("header2.in", """\
61 t
.write("header3.in", "/* empty file */\n")
63 t
.write("jamroot.jam", """\
65 make header1.h : header1.in : @common.copy ;
66 make header2.h : header2.in : @common.copy ;
67 make header3.h : header3.in : @common.copy ;
69 <implicit-dependency>header1.h
70 <implicit-dependency>header2.h
71 <implicit-dependency>header3.h ;
74 t
.run_build_system(["-j2", "test"])
75 t
.expect_addition("bin/$toolset/debug*/header1.h")
76 t
.expect_addition("bin/$toolset/debug*/header2.h")
77 t
.expect_addition("bin/$toolset/debug*/header3.h")
78 t
.expect_addition("bin/$toolset/debug*/test.obj")
79 t
.expect_nothing_more()
83 # Test a loop in generated headers.
84 t
.write("test.cpp", '#include "header1.h"\n')
86 t
.write("header1.in", """\
93 t
.write("header2.in", """\
100 t
.write("header3.in", """\
107 t
.write("jamroot.jam", """\
115 make header1.h : header1.in : @common.copy ;
116 make header2.h : header2.in : @common.copy ;
117 make header3.h : header3.in : @common.copy ;
118 obj test : test.cpp :
119 <implicit-dependency>header1.h
120 <implicit-dependency>header2.h
121 <implicit-dependency>header3.h ;
124 t
.run_build_system(["-j2", "test"])
125 t
.expect_addition("bin/$toolset/debug*/header1.h")
126 t
.expect_addition("bin/$toolset/debug*/header2.h")
127 t
.expect_addition("bin/$toolset/debug*/header3.h")
128 t
.expect_addition("bin/$toolset/debug*/test.obj")
129 t
.expect_nothing_more()
133 # Test that all the dependencies of a loop are updated before any of the
135 t
.write("test1.cpp", '#include "header1.h"\n')
137 t
.write("test2.cpp", """\
142 t
.write("header1.h", """\
149 t
.write("header2.h", """\
157 t
.write("header3.in", "\n")
159 t
.write("sleep.bat", """\
160 ::@timeout /T %1 /NOBREAK >nul
161 @ping 127.0.0.1 -n 2 -w 1000 >nul
162 @ping 127.0.0.1 -n %1 -w 1000 >nul
166 t
.write("jamroot.jam", """\
172 SLEEP = call sleep.bat ;
179 rule copy { common.copy $(<) : $(>) ; }
180 actions copy { $(SLEEP) 1 }
182 make header3.h : header3.in : @copy ;
183 exe test : test2.cpp test1.cpp : <implicit-dependency>header3.h ;
186 t
.run_build_system(["-j2", "test"])
187 t
.expect_addition("bin/$toolset/debug*/header3.h")
188 t
.expect_addition("bin/$toolset/debug*/test1.obj")
189 t
.expect_addition("bin/$toolset/debug*/test2.obj")
190 t
.expect_addition("bin/$toolset/debug*/test.exe")
191 t
.expect_nothing_more()
193 t
.touch("header3.in")
194 t
.run_build_system(["-j2", "test"])
195 t
.expect_touch("bin/$toolset/debug*/header3.h")
196 t
.expect_touch("bin/$toolset/debug*/test1.obj")
197 t
.expect_touch("bin/$toolset/debug*/test2.obj")
198 t
.expect_touch("bin/$toolset/debug*/test.exe")
199 t
.expect_nothing_more()
203 # Test a loop that includes a generated header
204 t
.write("test1.cpp", '#include "header1.h"\n')
205 t
.write("test2.cpp", """\
210 t
.write("header1.h", """\
217 t
.write("header2.in", """\
224 t
.write("header3.h", """\
231 t
.write("sleep.bat", """\
232 ::@timeout /T %1 /NOBREAK >nul
233 @ping 127.0.0.1 -n 2 -w 1000 >nul
234 @ping 127.0.0.1 -n %1 -w 1000 >nul
238 t
.write("jamroot.jam", """\
244 SLEEP = call sleep.bat ;
251 rule copy { common.copy $(<) : $(>) ; }
252 actions copy { $(SLEEP) 1 }
254 make header2.h : header2.in : @copy ;
255 exe test : test2.cpp test1.cpp : <implicit-dependency>header2.h <include>. ;
258 t
.run_build_system(["-j2", "test"])
259 t
.expect_addition("bin/$toolset/debug*/header2.h")
260 t
.expect_addition("bin/$toolset/debug*/test1.obj")
261 t
.expect_addition("bin/$toolset/debug*/test2.obj")
262 t
.expect_addition("bin/$toolset/debug*/test.exe")
263 t
.expect_nothing_more()