]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/absolute_sources.py
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / build / test / absolute_sources.py
1 #!/usr/bin/python
2
3 # Copyright 2003, 2004 Vladimir Prus
4 # Distributed under the Boost Software License, Version 1.0.
5 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7 # Test that sources with absolute names are handled OK.
8
9 import BoostBuild
10
11 t = BoostBuild.Tester(use_test_config=False)
12
13 t.write("jamroot.jam", "path-constant TOP : . ;")
14 t.write("jamfile.jam", """\
15 local pwd = [ PWD ] ;
16 ECHO $(pwd) XXXXX ;
17 exe hello : $(pwd)/hello.cpp $(TOP)/empty.cpp ;
18 """)
19 t.write("hello.cpp", "int main() {}\n")
20 t.write("empty.cpp", "\n")
21
22 t.run_build_system()
23 t.expect_addition("bin/$toolset/debug*/hello.exe")
24 t.rm(".")
25
26 # Test a contrived case in which an absolute name is used in a standalone
27 # project (not Jamfile). Moreover, the target with an absolute name is returned
28 # via an 'alias' and used from another project.
29 t.write("a.cpp", "int main() {}\n")
30 t.write("jamfile.jam", "exe a : /standalone//a ;")
31 t.write("jamroot.jam", "import standalone ;")
32 t.write("standalone.jam", """\
33 import project ;
34 project.initialize $(__name__) ;
35 project standalone ;
36 local pwd = [ PWD ] ;
37 alias a : $(pwd)/a.cpp ;
38 """)
39
40 t.write("standalone.py", """
41 from b2.manager import get_manager
42
43 # FIXME: this is ugly as death
44 get_manager().projects().initialize(__name__)
45
46 import os ;
47
48 # This use of list as parameter is also ugly.
49 project(['standalone'])
50
51 pwd = os.getcwd()
52 alias('a', [os.path.join(pwd, 'a.cpp')])
53 """)
54
55 t.run_build_system()
56 t.expect_addition("bin/$toolset/debug*/a.exe")
57
58 # Test absolute path in target ids.
59 t.rm(".")
60
61 t.write("d1/jamroot.jam", "")
62 t.write("d1/jamfile.jam", "exe a : a.cpp ;")
63 t.write("d1/a.cpp", "int main() {}\n")
64 t.write("d2/jamroot.jam", "")
65 t.write("d2/jamfile.jam", """\
66 local pwd = [ PWD ] ;
67 alias x : $(pwd)/../d1//a ;
68 """)
69
70 t.run_build_system(subdir="d2")
71 t.expect_addition("d1/bin/$toolset/debug*/a.exe")
72
73 t.cleanup()