]> git.proxmox.com Git - ceph.git/blame - 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
CommitLineData
7c673cae
FG
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
12import BoostBuild
13
14
15###############################################################################
16#
17# test_building_file_from_specific_project()
18# ------------------------------------------
19#
20###############################################################################
21
22def test_building_file_from_specific_project():
23 t = BoostBuild.Tester(use_test_config=False)
24
25 t.write("jamroot.jam", """\
26exe hello : hello.cpp ;
27exe hello2 : hello.cpp ;
28build-project sub ;
29""")
30 t.write("hello.cpp", "int main() {}\n")
31 t.write("sub/jamfile.jam", """
32exe hello : hello.cpp ;
33exe hello2 : hello.cpp ;
34exe 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)
b32b8144 40 t.expect_addition("sub/bin/$toolset/debug*/hello.obj")
7c673cae
FG
41 t.expect_nothing_more()
42
43 t.cleanup()
44
45
46###############################################################################
47#
48# test_building_file_from_specific_target()
49# -----------------------------------------
50#
51###############################################################################
52
53def test_building_file_from_specific_target():
54 t = BoostBuild.Tester(use_test_config=False)
55
56 t.write("jamroot.jam", """\
57exe hello1 : hello1.cpp ;
58exe hello2 : hello2.cpp ;
59exe 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")])
b32b8144 66 t.expect_addition("bin/$toolset/debug*/hello1.obj")
7c673cae
FG
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
79def test_building_missing_file_from_specific_target():
80 t = BoostBuild.Tester(use_test_config=False)
81
82 t.write("jamroot.jam", """\
83exe hello1 : hello1.cpp ;
84exe hello2 : hello2.cpp ;
85exe 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
106def test_building_multiple_files_with_different_names():
107 t = BoostBuild.Tester(use_test_config=False)
108
109 t.write("jamroot.jam", """\
110exe hello1 : hello1.cpp ;
111exe hello2 : hello2.cpp ;
112exe 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")])
b32b8144
FG
120 t.expect_addition("bin/$toolset/debug*/hello1.obj")
121 t.expect_addition("bin/$toolset/debug*/hello2.obj")
7c673cae
FG
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
134def test_building_multiple_files_with_the_same_name():
135 t = BoostBuild.Tester(use_test_config=False)
136
137 t.write("jamroot.jam", """\
138exe hello : hello.cpp ;
139exe hello2 : hello.cpp ;
140build-project sub ;
141""")
142 t.write("hello.cpp", "int main() {}\n")
143 t.write("sub/jamfile.jam", """
144exe hello : hello.cpp ;
145exe hello2 : hello.cpp ;
146exe 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)
b32b8144
FG
152 t.expect_addition("bin/$toolset/debug*/hello.obj")
153 t.expect_addition("sub/bin/$toolset/debug*/hello.obj")
7c673cae
FG
154 t.expect_nothing_more()
155
156 t.cleanup()
157
158
159###############################################################################
160#
161# main()
162# ------
163#
164###############################################################################
165
166test_building_file_from_specific_project()
167test_building_file_from_specific_target()
168test_building_missing_file_from_specific_target()
169test_building_multiple_files_with_different_names()
170test_building_multiple_files_with_the_same_name()