]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/inherited_dependency.py
3 # Copyright (c) 2008 Steven Watanabe
5 # Distributed under the Boost Software License, Version 1.0. (See
6 # accompanying file LICENSE_1_0.txt) or copy at
7 # http://www.boost.org/LICENSE_1_0.txt)
11 tester
= BoostBuild
.Tester(use_test_config
=False)
14 ################################################################################
16 # Test without giving the project an explicit id.
18 ################################################################################
20 tester
.write("jamroot.jam", """
22 project : requirements <library>test ;
26 tester
.write("test.cpp", """
33 tester
.write("a/test1.cpp", """
37 tester
.write("a/jamfile.jam", """
38 exe test1 : test1.cpp ;
41 tester
.run_build_system()
43 tester
.expect_addition("bin/$toolset/debug*/test.obj")
44 tester
.expect_addition("a/bin/$toolset/debug*/test1.exe")
50 ################################################################################
52 # Run the same test from the "a" directory.
54 ################################################################################
56 tester
.run_build_system(subdir
="a")
58 tester
.expect_addition("bin/$toolset/debug*/test.obj")
59 tester
.expect_addition("a/bin/$toolset/debug*/test1.exe")
65 ################################################################################
67 # This time, do give the project an id.
69 ################################################################################
71 tester
.write("jamroot.jam", """
73 project test_project : requirements <library>test ;
77 tester
.run_build_system()
79 tester
.expect_addition("bin/$toolset/debug*/test.obj")
80 tester
.expect_addition("a/bin/$toolset/debug*/test1.exe")
86 ################################################################################
88 # Now, give the project an id in its attributes.
90 ################################################################################
92 tester
.write("jamroot.jam", """
94 project : id test_project : requirements <library>test ;
98 tester
.run_build_system()
100 tester
.expect_addition("bin/$toolset/debug*/test.obj")
101 tester
.expect_addition("a/bin/$toolset/debug*/test1.exe")
107 ################################################################################
109 # Give the project an id in both ways at once.
111 ################################################################################
113 tester
.write("jamroot.jam", """
114 lib test : test.cpp ;
115 project test_project1 : id test_project : requirements <library>test ;
119 tester
.run_build_system()
121 tester
.expect_addition("bin/$toolset/debug*/test.obj")
122 tester
.expect_addition("a/bin/$toolset/debug*/test1.exe")
128 ################################################################################
130 # Test an absolute path in native format.
132 ################################################################################
134 tester
.write("jamroot.jam", """
136 path-constant here : . ;
137 current-location = [ path.native [ path.root [ path.make $(here) ] [ path.pwd ]
139 project test : requirements <source>$(current-location)/a/test1.cpp ;
140 exe test : test.cpp ;
143 tester
.run_build_system()
144 tester
.expect_addition("bin/$toolset/debug*/test.exe")
150 ################################################################################
152 # Test an absolute path in canonical format.
154 ################################################################################
156 tester
.write("jamroot.jam", """
158 path-constant here : . ;
159 current-location = [ path.root [ path.make $(here) ] [ path.pwd ] ] ;
160 project test : requirements <source>$(current-location)/a/test1.cpp ;
161 exe test : test.cpp ;
164 tester
.run_build_system()
165 tester
.expect_addition("bin/$toolset/debug*/test.exe")
171 ################################################################################
173 # Test dependency properties (e.g. <source>) whose targets are specified using a
176 ################################################################################
178 # Use jamroot.jam rather than jamfile.jam to avoid inheriting the <source> from
179 # the parent as that would would make test3 a source of itself.
180 tester
.write("b/jamroot.jam", """
181 obj test3 : test3.cpp ;
184 tester
.write("b/test3.cpp", """
188 tester
.write("jamroot.jam", """
189 project test : requirements <source>b//test3 ;
193 tester
.write("a/jamfile.jam", """
194 exe test : test1.cpp ;
197 tester
.write("a/test1.cpp", """
199 int main() { bar(); }
202 tester
.run_build_system()
203 tester
.expect_addition("b/bin/$toolset/debug*/test3.obj")
204 tester
.expect_addition("a/bin/$toolset/debug*/test.exe")
208 tester
.rm("jamroot.jam")
209 tester
.rm("test.cpp")
212 ################################################################################
214 # Test that source-location is respected.
216 ################################################################################
218 tester
.write("build/jamroot.jam", """
219 project : requirements <source>test.cpp : source-location ../src ;
222 tester
.write("src/test.cpp", """
226 tester
.write("build/a/jamfile.jam", """
227 project : source-location ../../a_src ;
228 exe test : test1.cpp ;
231 tester
.write("a_src/test1.cpp", """
234 tester
.run_build_system(subdir
="build/a")
235 tester
.expect_addition("build/a/bin/$toolset/debug*/test.exe")