Imported Upstream version 1.51.0
[platform/upstream/boost.git] / tools / build / v2 / test / standalone.py
1 #!/usr/bin/python
2
3 # Copyright 2003 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 import BoostBuild
8
9 t = BoostBuild.Tester()
10
11
12 # Regression tests: standalone project were not able to refer to targets
13 # declared in themselves.
14
15 t.write("a.cpp", """
16 int main() {}
17 """)
18
19 t.write("jamroot.jam", """
20 import standalone ;
21 """)
22
23 t.write("standalone.jam", """
24 import project ;
25
26 project.initialize $(__name__) ;
27 project standalone ;
28
29 local pwd = [ PWD ] ;
30
31 alias x : $(pwd)/../a.cpp ;
32 alias runtime : x ;
33 """)
34
35 t.write("standalone.py", """
36 from b2.manager import get_manager
37
38 # FIXME: this is ugly as death
39 get_manager().projects().initialize(__name__)
40
41 import os ;
42
43 # This use of list as parameter is also ugly.
44 project(['standalone'])
45
46 pwd = os.getcwd()
47 alias('x', [os.path.join(pwd, '../a.cpp')])
48 alias('runtime', ['x'])
49 """)
50
51
52 t.write("sub/jamfile.jam", """
53 stage bin : /standalone//runtime ;
54 """)
55
56 t.run_build_system(subdir="sub")
57 t.expect_addition("sub/bin/a.cpp")
58
59 t.cleanup()