]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/usr/bin/python |
2 | ||
3 | # Copyright 2004 Vladimir Prus. | |
4 | # Distributed under the Boost Software License, Version 1.0. | |
1e59de90 TL |
5 | # (See accompanying file LICENSE.txt or copy at |
6 | # https://www.bfgroup.xyz/b2/LICENSE.txt) | |
7c673cae FG |
7 | |
8 | # Test that we load parent projects before loading children. | |
9 | ||
10 | import BoostBuild | |
11 | ||
12 | t = BoostBuild.Tester(use_test_config=False) | |
13 | ||
14 | t.write("jamroot.jam", """\ | |
15 | use-project /child : child ; | |
16 | ECHO "Setting parent requirements" ; | |
17 | project : requirements <define>PASS_THE_TEST ; | |
18 | alias x : child//main ; | |
19 | """) | |
20 | ||
21 | t.write("child/jamfile.jam", """\ | |
22 | ECHO "Setting child requirements" ; | |
23 | project /child ; | |
24 | exe main : main.cpp ; | |
25 | """) | |
26 | ||
27 | t.write("child/main.cpp", """\ | |
28 | #if defined(PASS_THE_TEST) | |
29 | int main() {} | |
30 | #endif | |
31 | """) | |
32 | ||
33 | t.run_build_system() | |
34 | ||
b32b8144 | 35 | t.expect_addition("child/bin/$toolset/debug*/main.exe") |
7c673cae FG |
36 | t.fail_test(t.stdout().find("Setting child requirements") < t.stdout().find( |
37 | "Setting parent requirements")) | |
38 | ||
39 | ||
40 | # Regression test: parent requirements were ignored in some cases. | |
41 | t.rm(".") | |
42 | t.write("jamroot.jam", "build-project src ;") | |
43 | t.write("src/jamfile.jam", "project : requirements <define>EVERYTHING_OK ;") | |
44 | t.write("src/app/jamfile.jam", "exe test : test.cpp ;") | |
45 | t.write("src/app/test.cpp", """\ | |
46 | #ifdef EVERYTHING_OK | |
47 | int main() {} | |
48 | #endif | |
49 | """) | |
50 | ||
51 | t.run_build_system(subdir="src/app") | |
b32b8144 | 52 | t.expect_addition("src/app/bin/$toolset/debug*/test.exe") |
7c673cae FG |
53 | |
54 | ||
55 | # child/child2 used to be loaded before child | |
56 | t.rm(".") | |
57 | t.write("jamroot.jam", """\ | |
58 | use-project /child/child2 : child/child2 ; | |
59 | rule parent-rule ( ) | |
60 | { | |
61 | ECHO "Running parent-rule" ; | |
62 | } | |
63 | """) | |
64 | t.write("child/jamfile.jam", "") | |
65 | t.write("child/child1/jamfile.jam", "") | |
66 | t.write("child/child2/jamfile.jam", "parent-rule ;") | |
67 | ||
68 | t.run_build_system(subdir="child/child1") | |
69 | t.expect_output_lines("Running parent-rule") | |
70 | ||
71 | t.cleanup() |