]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/build_file.py
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / build / test / build_file.py
1 #!/usr/bin/python
2
3 # Copyright (C) 2006. Vladimir Prus
4 # Copyright (C) 2008. Jurko Gospodnetic
5 # Distributed under the Boost Software License, Version 1.0.
6 # (See accompanying file LICENSE_1_0.txt or copy at
7 # http://www.boost.org/LICENSE_1_0.txt)
8
9 # Tests that we explicitly request a file (not target) to be built by
10 # specifying its name on the command line.
11
12 import BoostBuild
13
14
15 ###############################################################################
16 #
17 # test_building_file_from_specific_project()
18 # ------------------------------------------
19 #
20 ###############################################################################
21
22 def test_building_file_from_specific_project():
23 t = BoostBuild.Tester(use_test_config=False)
24
25 t.write("jamroot.jam", """\
26 exe hello : hello.cpp ;
27 exe hello2 : hello.cpp ;
28 build-project sub ;
29 """)
30 t.write("hello.cpp", "int main() {}\n")
31 t.write("sub/jamfile.jam", """
32 exe hello : hello.cpp ;
33 exe hello2 : hello.cpp ;
34 exe sub : hello.cpp ;
35 """)
36 t.write("sub/hello.cpp", "int main() {}\n")
37
38 t.run_build_system(["sub", t.adjust_suffix("hello.obj")])
39 t.expect_output_lines("*depends on itself*", False)
40 t.expect_addition("sub/bin/$toolset/debug*/hello.obj")
41 t.expect_nothing_more()
42
43 t.cleanup()
44
45
46 ###############################################################################
47 #
48 # test_building_file_from_specific_target()
49 # -----------------------------------------
50 #
51 ###############################################################################
52
53 def test_building_file_from_specific_target():
54 t = BoostBuild.Tester(use_test_config=False)
55
56 t.write("jamroot.jam", """\
57 exe hello1 : hello1.cpp ;
58 exe hello2 : hello2.cpp ;
59 exe hello3 : hello3.cpp ;
60 """)
61 t.write("hello1.cpp", "int main() {}\n")
62 t.write("hello2.cpp", "int main() {}\n")
63 t.write("hello3.cpp", "int main() {}\n")
64
65 t.run_build_system(["hello1", t.adjust_suffix("hello1.obj")])
66 t.expect_addition("bin/$toolset/debug*/hello1.obj")
67 t.expect_nothing_more()
68
69 t.cleanup()
70
71
72 ###############################################################################
73 #
74 # test_building_missing_file_from_specific_target()
75 # -------------------------------------------------
76 #
77 ###############################################################################
78
79 def test_building_missing_file_from_specific_target():
80 t = BoostBuild.Tester(use_test_config=False)
81
82 t.write("jamroot.jam", """\
83 exe hello1 : hello1.cpp ;
84 exe hello2 : hello2.cpp ;
85 exe hello3 : hello3.cpp ;
86 """)
87 t.write("hello1.cpp", "int main() {}\n")
88 t.write("hello2.cpp", "int main() {}\n")
89 t.write("hello3.cpp", "int main() {}\n")
90
91 obj = t.adjust_suffix("hello2.obj")
92 t.run_build_system(["hello1", obj], status=1)
93 t.expect_output_lines("don't know how to make*" + obj)
94 t.expect_nothing_more()
95
96 t.cleanup()
97
98
99 ###############################################################################
100 #
101 # test_building_multiple_files_with_different_names()
102 # ---------------------------------------------------
103 #
104 ###############################################################################
105
106 def test_building_multiple_files_with_different_names():
107 t = BoostBuild.Tester(use_test_config=False)
108
109 t.write("jamroot.jam", """\
110 exe hello1 : hello1.cpp ;
111 exe hello2 : hello2.cpp ;
112 exe hello3 : hello3.cpp ;
113 """)
114 t.write("hello1.cpp", "int main() {}\n")
115 t.write("hello2.cpp", "int main() {}\n")
116 t.write("hello3.cpp", "int main() {}\n")
117
118 t.run_build_system([t.adjust_suffix("hello1.obj"), t.adjust_suffix(
119 "hello2.obj")])
120 t.expect_addition("bin/$toolset/debug*/hello1.obj")
121 t.expect_addition("bin/$toolset/debug*/hello2.obj")
122 t.expect_nothing_more()
123
124 t.cleanup()
125
126
127 ###############################################################################
128 #
129 # test_building_multiple_files_with_the_same_name()
130 # -------------------------------------------------
131 #
132 ###############################################################################
133
134 def test_building_multiple_files_with_the_same_name():
135 t = BoostBuild.Tester(use_test_config=False)
136
137 t.write("jamroot.jam", """\
138 exe hello : hello.cpp ;
139 exe hello2 : hello.cpp ;
140 build-project sub ;
141 """)
142 t.write("hello.cpp", "int main() {}\n")
143 t.write("sub/jamfile.jam", """
144 exe hello : hello.cpp ;
145 exe hello2 : hello.cpp ;
146 exe sub : hello.cpp ;
147 """)
148 t.write("sub/hello.cpp", "int main() {}\n")
149
150 t.run_build_system([t.adjust_suffix("hello.obj")])
151 t.expect_output_lines("*depends on itself*", False)
152 t.expect_addition("bin/$toolset/debug*/hello.obj")
153 t.expect_addition("sub/bin/$toolset/debug*/hello.obj")
154 t.expect_nothing_more()
155
156 t.cleanup()
157
158
159 ###############################################################################
160 #
161 # main()
162 # ------
163 #
164 ###############################################################################
165
166 test_building_file_from_specific_project()
167 test_building_file_from_specific_target()
168 test_building_missing_file_from_specific_target()
169 test_building_multiple_files_with_different_names()
170 test_building_multiple_files_with_the_same_name()