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 | t = Tester() |
---|
14 | |
---|
15 | t.write("project-root.jam", "") |
---|
16 | t.write("Jamfile", """ |
---|
17 | |
---|
18 | exe hello : hello.cpp ; |
---|
19 | exe hello2 : hello.cpp ; |
---|
20 | |
---|
21 | explicit hello2 ; |
---|
22 | """) |
---|
23 | t.write("hello.cpp", """ |
---|
24 | int main() |
---|
25 | { |
---|
26 | return 0; |
---|
27 | } |
---|
28 | |
---|
29 | """) |
---|
30 | |
---|
31 | t.run_build_system() |
---|
32 | t.ignore("*.tds") |
---|
33 | t.expect_addition(List("bin/$toolset/debug/hello") * [".exe", ".obj"]) |
---|
34 | t.expect_nothing_more() |
---|
35 | |
---|
36 | t.run_build_system("hello2") |
---|
37 | t.expect_addition("bin/$toolset/debug/hello2.exe") |
---|
38 | |
---|
39 | t.rm(".") |
---|
40 | |
---|
41 | |
---|
42 | # Test that 'explicit' used in a helper rule applies to the current project, |
---|
43 | # and not to the Jamfile where the helper rule is defined. |
---|
44 | t.write("Jamroot", """ |
---|
45 | rule myinstall ( name : target ) |
---|
46 | { |
---|
47 | install $(name)-bin : $(target) ; |
---|
48 | explicit $(name)-bin ; |
---|
49 | alias $(name) : $(name)-bin ; |
---|
50 | } |
---|
51 | """) |
---|
52 | |
---|
53 | t.write("sub/a.cpp", """ |
---|
54 | """) |
---|
55 | |
---|
56 | t.write("sub/Jamfile", """ |
---|
57 | myinstall dist : a.cpp ; |
---|
58 | """) |
---|
59 | |
---|
60 | t.run_build_system(subdir="sub") |
---|
61 | t.expect_addition("sub/dist-bin/a.cpp") |
---|
62 | |
---|
63 | t.rm("sub/dist-bin") |
---|
64 | |
---|
65 | t.write("sub/Jamfile", """ |
---|
66 | myinstall dist : a.cpp ; |
---|
67 | explicit dist ; |
---|
68 | |
---|
69 | """) |
---|
70 | |
---|
71 | t.run_build_system(subdir="sub") |
---|
72 | t.expect_nothing_more() |
---|
73 | |
---|
74 | |
---|
75 | t.cleanup() |
---|