summaryrefslogtreecommitdiff
path: root/tools/build/v2/test/load_order.py
blob: 34ceaaf44881e2234f8cc5d432f82051f3b38f5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/python

# Copyright 2004 Vladimir Prus.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

# Test that we load parent projects before loading children.

import BoostBuild
import string

t = BoostBuild.Tester()

t.write("jamroot.jam", """
use-project /child : child ;
ECHO "Setting parent requirements" ;
project : requirements <define>PASS_THE_TEST ;
alias x : child//main ;
""")

t.write("child/jamfile.jam", """
ECHO "Setting child requirements" ;
project /child ;
exe main : main.cpp ;
""")

t.write("child/main.cpp", """
#if defined(PASS_THE_TEST)
int main() {}
#endif
""")

t.run_build_system()

t.expect_addition("child/bin/$toolset/debug/main.exe")
t.fail_test(string.find(t.stdout(), "Setting child requirements") <
            string.find(t.stdout(), "Setting parent requirements"))


# Regression test: parent requirements were ignored in some cases.
t.rm(".")
t.write("jamroot.jam", """
build-project src ;
""")

t.write("src/jamfile.jam", """
project : requirements <define>EVERYTHING_OK ;
""")

t.write("src/app/jamfile.jam", """
exe test : test.cpp ;
""")

t.write("src/app/test.cpp", """
#ifdef EVERYTHING_OK
int main() {}
#endif
""")

t.run_build_system(subdir="src/app")
t.expect_addition("src/app/bin/$toolset/debug/test.exe")

t.cleanup()