]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/load_order.py
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / build / test / load_order.py
1 #!/usr/bin/python
2
3 # Copyright 2004 Vladimir Prus.
4 # Distributed under the Boost Software License, Version 1.0.
5 # (See accompanying file LICENSE_1_0.txt or copy at
6 # http://www.boost.org/LICENSE_1_0.txt)
7
8 # Test that we load parent projects before loading children.
9
10 import BoostBuild
11
12 t = BoostBuild.Tester(use_test_config=False)
13
14 t.write("jamroot.jam", """\
15 use-project /child : child ;
16 ECHO "Setting parent requirements" ;
17 project : requirements <define>PASS_THE_TEST ;
18 alias x : child//main ;
19 """)
20
21 t.write("child/jamfile.jam", """\
22 ECHO "Setting child requirements" ;
23 project /child ;
24 exe main : main.cpp ;
25 """)
26
27 t.write("child/main.cpp", """\
28 #if defined(PASS_THE_TEST)
29 int main() {}
30 #endif
31 """)
32
33 t.run_build_system()
34
35 t.expect_addition("child/bin/$toolset/debug*/main.exe")
36 t.fail_test(t.stdout().find("Setting child requirements") < t.stdout().find(
37 "Setting parent requirements"))
38
39
40 # Regression test: parent requirements were ignored in some cases.
41 t.rm(".")
42 t.write("jamroot.jam", "build-project src ;")
43 t.write("src/jamfile.jam", "project : requirements <define>EVERYTHING_OK ;")
44 t.write("src/app/jamfile.jam", "exe test : test.cpp ;")
45 t.write("src/app/test.cpp", """\
46 #ifdef EVERYTHING_OK
47 int main() {}
48 #endif
49 """)
50
51 t.run_build_system(subdir="src/app")
52 t.expect_addition("src/app/bin/$toolset/debug*/test.exe")
53
54
55 # child/child2 used to be loaded before child
56 t.rm(".")
57 t.write("jamroot.jam", """\
58 use-project /child/child2 : child/child2 ;
59 rule parent-rule ( )
60 {
61 ECHO "Running parent-rule" ;
62 }
63 """)
64 t.write("child/jamfile.jam", "")
65 t.write("child/child1/jamfile.jam", "")
66 t.write("child/child2/jamfile.jam", "parent-rule ;")
67
68 t.run_build_system(subdir="child/child1")
69 t.expect_output_lines("Running parent-rule")
70
71 t.cleanup()