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