1 | #!/usr/bin/python |
---|
2 | |
---|
3 | # Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and |
---|
4 | # distribute this software is granted provided this copyright notice appears in |
---|
5 | # all copies. This software is provided "as is" without express or implied |
---|
6 | # warranty, and with no claim as to its suitability for any purpose. |
---|
7 | |
---|
8 | # This file is template for Boost.Build tests. It creates a simple |
---|
9 | # project that builds one exe from one source, and checks that the exe |
---|
10 | # is really created. |
---|
11 | from BoostBuild import Tester, List |
---|
12 | |
---|
13 | |
---|
14 | t = Tester() |
---|
15 | |
---|
16 | t.write("a.cpp", """ |
---|
17 | #ifdef CF_IS_OFF |
---|
18 | int main() { return 0; } |
---|
19 | #endif |
---|
20 | |
---|
21 | """) |
---|
22 | |
---|
23 | t.write("b.cpp", """ |
---|
24 | #ifdef CF_1 |
---|
25 | int main() { return 0; } |
---|
26 | #endif |
---|
27 | |
---|
28 | """) |
---|
29 | |
---|
30 | t.write("c.cpp", """ |
---|
31 | #ifdef FOO |
---|
32 | int main() { return 0; } |
---|
33 | #endif |
---|
34 | |
---|
35 | """) |
---|
36 | |
---|
37 | |
---|
38 | t.write("Jamfile", """ |
---|
39 | # See if default value of composite feature 'cf' |
---|
40 | # will be expanded to <define>CF_IS_OFF |
---|
41 | exe a : a.cpp ; |
---|
42 | |
---|
43 | # See if subfeature in requirements in expanded. |
---|
44 | exe b : b.cpp : <cf>on-1 ; |
---|
45 | |
---|
46 | # See if conditional requirements are recursively expanded. |
---|
47 | exe c : c.cpp : <toolset>$toolset:<variant>release <variant>release:<define>FOO ; |
---|
48 | """) |
---|
49 | |
---|
50 | t.write("project-root.jam", """ |
---|
51 | import feature ; |
---|
52 | |
---|
53 | feature.feature cf : off on : composite incidental ; |
---|
54 | |
---|
55 | feature.compose <cf>off : <define>CF_IS_OFF ; |
---|
56 | |
---|
57 | feature.subfeature cf on : version : 1 2 : composite optional incidental ; |
---|
58 | |
---|
59 | feature.compose <cf-on:version>1 : <define>CF_1 ; |
---|
60 | |
---|
61 | """) |
---|
62 | |
---|
63 | t.expand_toolset("Jamfile") |
---|
64 | |
---|
65 | t.run_build_system() |
---|
66 | t.expect_addition(["bin/$toolset/debug/a.exe", |
---|
67 | "bin/$toolset/debug/b.exe", |
---|
68 | "bin/$toolset/release/c.exe", |
---|
69 | ]) |
---|
70 | |
---|
71 | t.rm("bin") |
---|
72 | |
---|
73 | # Test for issue BB60 |
---|
74 | t.write("test.cpp", """ |
---|
75 | #include "header.h" |
---|
76 | int main() { return 0; } |
---|
77 | """) |
---|
78 | t.write("Jamfile", """ |
---|
79 | project |
---|
80 | : requirements <toolset>$toolset:<include>foo |
---|
81 | ; |
---|
82 | exe test : test.cpp : <toolset>$toolset ; |
---|
83 | """) |
---|
84 | t.expand_toolset("Jamfile") |
---|
85 | t.write("foo/header.h", """ |
---|
86 | """) |
---|
87 | t.write("project-root.jam", "") |
---|
88 | t.run_build_system() |
---|
89 | t.expect_addition("bin/$toolset/debug/test.exe") |
---|
90 | |
---|
91 | t.cleanup() |
---|
92 | |
---|