]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/tag.py
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / build / test / tag.py
1 #!/usr/bin/python
2
3 # Copyright (C) 2003. Pedro Ferreira
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 import BoostBuild
9
10
11 ###############################################################################
12 #
13 # test_folder_with_dot_in_name()
14 # ------------------------------
15 #
16 ###############################################################################
17
18 def test_folder_with_dot_in_name(t):
19 """
20 Regression test: the 'tag' feature did not work in directories that had a
21 dot in their name.
22
23 """
24 t.write("version-1.32.0/jamroot.jam", """\
25 project test : requirements <tag>@$(__name__).tag ;
26
27 rule tag ( name : type ? : property-set )
28 {
29 # Do nothing, just make sure the rule is invoked OK.
30 ECHO The tag rule has been invoked. ;
31 }
32 exe a : a.cpp ;
33 """)
34 t.write("version-1.32.0/a.cpp", "int main() {}\n")
35
36 t.run_build_system(subdir="version-1.32.0")
37 t.expect_addition("version-1.32.0/bin/$toolset/debug*/a.exe")
38 t.expect_output_lines("The tag rule has been invoked.")
39
40
41 ###############################################################################
42 #
43 # test_tag_property()
44 # -------------------
45 #
46 ###############################################################################
47
48 def test_tag_property(t):
49 """Basic tag property test."""
50
51 t.write("jamroot.jam", """\
52 import virtual-target ;
53
54 rule tag ( name : type ? : property-set )
55 {
56 local tags ;
57 switch [ $(property-set).get <variant> ]
58 {
59 case debug : tags += d ;
60 case release : tags += r ;
61 }
62 switch [ $(property-set).get <link> ]
63 {
64 case shared : tags += s ;
65 case static : tags += t ;
66 }
67 if $(tags)
68 {
69 return [ virtual-target.add-prefix-and-suffix $(name)_$(tags:J="")
70 : $(type) : $(property-set) ] ;
71 }
72 }
73
74 # Test both fully-qualified and local name of the rule
75 exe a : a.cpp : <tag>@$(__name__).tag ;
76 lib b : a.cpp : <tag>@tag ;
77 stage c : a ;
78 """)
79
80 t.write("a.cpp", """\
81 int main() {}
82 #ifdef _MSC_VER
83 __declspec (dllexport) void x () {}
84 #endif
85 """)
86
87 file_list = (
88 BoostBuild.List("bin/$toolset/debug*/a_ds.exe") +
89 BoostBuild.List("bin/$toolset/debug*/b_ds.dll") +
90 BoostBuild.List("c/a_ds.exe") +
91 BoostBuild.List("bin/$toolset/release*/a_rs.exe") +
92 BoostBuild.List("bin/$toolset/release*/b_rs.dll") +
93 BoostBuild.List("c/a_rs.exe") +
94 BoostBuild.List("bin/$toolset/debug/link-static*/a_dt.exe") +
95 BoostBuild.List("bin/$toolset/debug/link-static*/b_dt.lib") +
96 BoostBuild.List("c/a_dt.exe") +
97 BoostBuild.List("bin/$toolset/release/link-static*/a_rt.exe") +
98 BoostBuild.List("bin/$toolset/release/link-static*/b_rt.lib") +
99 BoostBuild.List("c/a_rt.exe"))
100
101 variants = ["debug", "release", "link=static,shared"]
102
103 t.run_build_system(variants)
104 t.expect_addition(file_list)
105
106 t.run_build_system(variants + ["clean"])
107 t.expect_removal(file_list)
108
109
110 ###############################################################################
111 #
112 # main()
113 # ------
114 #
115 ###############################################################################
116
117 t = BoostBuild.Tester(use_test_config=False)
118
119 test_tag_property(t)
120 test_folder_with_dot_in_name(t)
121
122 t.cleanup()