]>
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/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/header1.h")
76 t
.expect_addition("bin/header2.h")
77 t
.expect_addition("bin/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/header1.h")
126 t
.expect_addition("bin/header2.h")
127 t
.expect_addition("bin/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/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
.ignore_addition("bin/*/test.rsp")
192 t
.expect_nothing_more()
194 t
.touch("header3.in")
195 t
.run_build_system(["-j2", "test"])
196 t
.expect_touch("bin/header3.h")
197 t
.expect_touch("bin/$toolset/debug*/test1.obj")
198 t
.expect_touch("bin/$toolset/debug*/test2.obj")
199 t
.expect_touch("bin/$toolset/debug*/test.exe")
200 t
.ignore_touch("bin/*/test.rsp")
201 t
.expect_nothing_more()
205 # Test a loop that includes a generated header
206 t
.write("test1.cpp", '#include "header1.h"\n')
207 t
.write("test2.cpp", """\
212 t
.write("header1.h", """\
219 t
.write("header2.in", """\
226 t
.write("header3.h", """\
233 t
.write("sleep.bat", """\
234 ::@timeout /T %1 /NOBREAK >nul
235 @ping 127.0.0.1 -n 2 -w 1000 >nul
236 @ping 127.0.0.1 -n %1 -w 1000 >nul
240 t
.write("jamroot.jam", """\
246 SLEEP = call sleep.bat ;
253 rule copy { common.copy $(<) : $(>) ; }
254 actions copy { $(SLEEP) 1 }
256 make header2.h : header2.in : @copy ;
257 exe test : test2.cpp test1.cpp : <implicit-dependency>header2.h <include>. ;
260 t
.run_build_system(["-j2", "test"])
261 t
.expect_addition("bin/header2.h")
262 t
.expect_addition("bin/$toolset/debug*/test1.obj")
263 t
.expect_addition("bin/$toolset/debug*/test2.obj")
264 t
.expect_addition("bin/$toolset/debug*/test.exe")
265 t
.ignore_addition("bin/*/test.rsp")
266 t
.expect_nothing_more()