Imported Upstream version 1.57.0
[platform/upstream/boost.git] / tools / build / test / remove_requirement.py
1 #!/usr/bin/python
2
3 # Copyright (C) Vladimir Prus 2006.
4 # Distributed under the Boost Software License, Version 1.0. (See
5 # accompanying file LICENSE_1_0.txt or copy at
6 # http://www.boost.org/LICENSE_1_0.txt)
7
8 import BoostBuild
9
10 t = BoostBuild.Tester(use_test_config=False)
11
12
13 t.write("jamroot.jam", """
14 project : requirements <threading>multi <variant>debug:<link>static ;
15
16 build-project sub ;
17 build-project sub2 ;
18 build-project sub3 ;
19 build-project sub4 ;
20 """)
21
22 t.write("sub/jamfile.jam", """
23 exe hello : hello.cpp : -<threading>multi ;
24 """)
25
26 t.write("sub/hello.cpp", """
27 int main() {}
28 """)
29
30 t.write("sub2/jamfile.jam", """
31 project : requirements -<threading>multi ;
32 exe hello : hello.cpp ;
33 """)
34
35 t.write("sub2/hello.cpp", """
36 int main() {}
37 """)
38
39 t.write("sub3/hello.cpp", """
40 int main() {}
41 """)
42
43 t.write("sub3/jamfile.jam", """
44 exe hello : hello.cpp : -<variant>debug:<link>static ;
45 """)
46
47 t.write("sub4/hello.cpp", """
48 int main() {}
49 """)
50
51 t.write("sub4/jamfile.jam", """
52 project : requirements -<variant>debug:<link>static ;
53 exe hello : hello.cpp ;
54 """)
55
56 t.run_build_system()
57
58 t.expect_addition("sub/bin/$toolset/debug/link-static/hello.exe")
59 t.expect_addition("sub2/bin/$toolset/debug/link-static/hello.exe")
60 t.expect_addition("sub3/bin/$toolset/debug/threading-multi/hello.exe")
61 t.expect_addition("sub4/bin/$toolset/debug/threading-multi/hello.exe")
62
63 t.rm(".")
64
65 # Now test that path requirements can be removed as well.
66 t.write("jamroot.jam", """
67 build-project sub ;
68 """)
69
70 t.write("sub/jamfile.jam", """
71 project : requirements <include>broken ;
72 exe hello : hello.cpp : -<include>broken ;
73 """)
74
75 t.write("sub/hello.cpp", """
76 #include "math.h"
77 int main() {}
78 """)
79
80 t.write("sub/broken/math.h", """
81 Broken
82 """)
83
84
85 t.run_build_system()
86
87 t.expect_addition("sub/bin/$toolset/debug/hello.exe")
88
89 t.cleanup()