1 | #!/usr/bin/python |
---|
2 | |
---|
3 | # Copyright 2002, 2003 Dave Abrahams |
---|
4 | # Copyright 2002, 2003, 2004, 2006 Vladimir Prus |
---|
5 | # Distributed under the Boost Software License, Version 1.0. |
---|
6 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) |
---|
7 | |
---|
8 | from BoostBuild import Tester, List |
---|
9 | import os |
---|
10 | from string import strip |
---|
11 | |
---|
12 | t = Tester(translate_suffixes=0) |
---|
13 | |
---|
14 | # First check some startup |
---|
15 | t.set_tree("project-test3") |
---|
16 | os.remove("project-root.jam") |
---|
17 | t.run_build_system(status=1, stdout= |
---|
18 | """error: Could not find parent for project at '.' |
---|
19 | error: Did not find Jamfile or project-root.jam in any parent directory. |
---|
20 | |
---|
21 | """) |
---|
22 | |
---|
23 | t.set_tree("project-test3") |
---|
24 | t.run_build_system() |
---|
25 | |
---|
26 | t.expect_addition("bin/$toolset/debug/a.obj") |
---|
27 | t.expect_content("bin/$toolset/debug/a.obj", |
---|
28 | """$toolset/debug |
---|
29 | a.cpp |
---|
30 | """) |
---|
31 | |
---|
32 | t.expect_addition("bin/$toolset/debug/a.exe") |
---|
33 | t.expect_content("bin/$toolset/debug/a.exe", |
---|
34 | "$toolset/debug\n" + |
---|
35 | "bin/$toolset/debug/a.obj lib/bin/$toolset/debug/b.obj " + |
---|
36 | "lib2/bin/$toolset/debug/c.obj lib2/bin/$toolset/debug/d.obj " + |
---|
37 | "lib2/helper/bin/$toolset/debug/e.obj " + |
---|
38 | "lib3/bin/$toolset/debug/f.obj\n" |
---|
39 | ) |
---|
40 | |
---|
41 | t.expect_addition("lib/bin/$toolset/debug/b.obj") |
---|
42 | t.expect_content("lib/bin/$toolset/debug/b.obj", |
---|
43 | """$toolset/debug |
---|
44 | lib/b.cpp |
---|
45 | """) |
---|
46 | |
---|
47 | t.expect_addition("lib/bin/$toolset/debug/m.exe") |
---|
48 | t.expect_content("lib/bin/$toolset/debug/m.exe", |
---|
49 | """$toolset/debug |
---|
50 | lib/bin/$toolset/debug/b.obj lib2/bin/$toolset/debug/c.obj |
---|
51 | """) |
---|
52 | |
---|
53 | t.expect_addition("lib2/bin/$toolset/debug/c.obj") |
---|
54 | t.expect_content("lib2/bin/$toolset/debug/c.obj", |
---|
55 | """$toolset/debug |
---|
56 | lib2/c.cpp |
---|
57 | """) |
---|
58 | |
---|
59 | t.expect_addition("lib2/bin/$toolset/debug/d.obj") |
---|
60 | t.expect_content("lib2/bin/$toolset/debug/d.obj", |
---|
61 | """$toolset/debug |
---|
62 | lib2/d.cpp |
---|
63 | """) |
---|
64 | |
---|
65 | t.expect_addition("lib2/bin/$toolset/debug/l.exe") |
---|
66 | t.expect_content("lib2/bin/$toolset/debug/l.exe", |
---|
67 | """$toolset/debug |
---|
68 | lib2/bin/$toolset/debug/c.obj bin/$toolset/debug/a.obj |
---|
69 | """) |
---|
70 | |
---|
71 | t.expect_addition("lib2/helper/bin/$toolset/debug/e.obj") |
---|
72 | t.expect_content("lib2/helper/bin/$toolset/debug/e.obj", |
---|
73 | """$toolset/debug |
---|
74 | lib2/helper/e.cpp |
---|
75 | """) |
---|
76 | |
---|
77 | t.expect_addition("lib3/bin/$toolset/debug/f.obj") |
---|
78 | t.expect_content("lib3/bin/$toolset/debug/f.obj", |
---|
79 | """$toolset/debug |
---|
80 | lib3/f.cpp lib2/helper/bin/$toolset/debug/e.obj |
---|
81 | """) |
---|
82 | |
---|
83 | |
---|
84 | t.touch("a.cpp") |
---|
85 | t.run_build_system() |
---|
86 | t.expect_touch(["bin/$toolset/debug/a.obj", |
---|
87 | "bin/$toolset/debug/a.exe", |
---|
88 | "lib2/bin/$toolset/debug/l.exe"]) |
---|
89 | |
---|
90 | |
---|
91 | t.run_build_system(extra_args="release optimization=off,speed") |
---|
92 | t.expect_addition(["bin/$toolset/release/a.exe", |
---|
93 | "bin/$toolset/release/a.obj", |
---|
94 | "bin/$toolset/release/optimization-off/a.exe", |
---|
95 | "bin/$toolset/release/optimization-off/a.obj"]) |
---|
96 | |
---|
97 | t.run_build_system(extra_args='--clean-all') |
---|
98 | t.expect_removal(["bin/$toolset/debug/a.obj", |
---|
99 | "bin/$toolset/debug/a.exe", |
---|
100 | "lib/bin/$toolset/debug/b.obj", |
---|
101 | "lib/bin/$toolset/debug/m.exe", |
---|
102 | "lib2/bin/$toolset/debug/c.obj", |
---|
103 | "lib2/bin/$toolset/debug/d.obj", |
---|
104 | "lib2/bin/$toolset/debug/l.exe", |
---|
105 | "lib3/bin/$toolset/debug/f.obj", |
---|
106 | ]) |
---|
107 | |
---|
108 | # Now test target ids in command line |
---|
109 | t.set_tree("project-test3") |
---|
110 | t.run_build_system("lib//b.obj") |
---|
111 | t.expect_addition("lib/bin/$toolset/debug/b.obj") |
---|
112 | t.expect_nothing_more() |
---|
113 | |
---|
114 | t.run_build_system("--clean lib//b.obj") |
---|
115 | t.expect_removal("lib/bin/$toolset/debug/b.obj") |
---|
116 | t.expect_nothing_more() |
---|
117 | |
---|
118 | t.run_build_system("lib//b.obj") |
---|
119 | t.expect_addition("lib/bin/$toolset/debug/b.obj") |
---|
120 | t.expect_nothing_more() |
---|
121 | |
---|
122 | |
---|
123 | t.run_build_system("release lib2/helper//e.obj /lib3//f.obj") |
---|
124 | t.expect_addition("lib2/helper/bin/$toolset/release/e.obj") |
---|
125 | t.expect_addition("lib3/bin/$toolset/release/f.obj") |
---|
126 | t.expect_nothing_more() |
---|
127 | |
---|
128 | # Test project ids in command line work as well |
---|
129 | t.set_tree("project-test3") |
---|
130 | t.run_build_system("/lib2") |
---|
131 | t.expect_addition("lib2/bin/$toolset/debug/" * List("c.obj d.obj l.exe")) |
---|
132 | t.expect_addition("bin/$toolset/debug/a.obj") |
---|
133 | t.expect_nothing_more() |
---|
134 | |
---|
135 | |
---|
136 | t.run_build_system("lib") |
---|
137 | t.expect_addition("lib/bin/$toolset/debug/" * List("b.obj m.exe")) |
---|
138 | t.expect_nothing_more() |
---|
139 | |
---|
140 | t.cleanup() |
---|