File: project_test3.py

package info (click to toggle)
boost-build 2.0-m12-2
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 8,692 kB
  • ctags: 6,963
  • sloc: ansic: 39,914; sh: 9,086; python: 6,120; xml: 5,524; cpp: 1,467; yacc: 456; asm: 353; makefile: 184
file content (140 lines) | stat: -rw-r--r-- 4,121 bytes parent folder | download | duplicates (2)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/python

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

from BoostBuild import Tester, List
import os
from string import strip

t = Tester(translate_suffixes=0)

# First check some startup
t.set_tree("project-test3")
os.remove("project-root.jam")
t.run_build_system(status=1, stdout=
"""error: Could not find parent for project at '.'
error: Did not find Jamfile or project-root.jam in any parent directory.

""")

t.set_tree("project-test3")
t.run_build_system()

t.expect_addition("bin/$toolset/debug/a.obj")
t.expect_content("bin/$toolset/debug/a.obj",
"""$toolset/debug
a.cpp
""")

t.expect_addition("bin/$toolset/debug/a.exe")
t.expect_content("bin/$toolset/debug/a.exe",
"$toolset/debug\n" +
"bin/$toolset/debug/a.obj lib/bin/$toolset/debug/b.obj " +
"lib2/bin/$toolset/debug/c.obj lib2/bin/$toolset/debug/d.obj " +
"lib2/helper/bin/$toolset/debug/e.obj " +
"lib3/bin/$toolset/debug/f.obj\n"
)

t.expect_addition("lib/bin/$toolset/debug/b.obj")
t.expect_content("lib/bin/$toolset/debug/b.obj",
"""$toolset/debug
lib/b.cpp
""")

t.expect_addition("lib/bin/$toolset/debug/m.exe")
t.expect_content("lib/bin/$toolset/debug/m.exe",
"""$toolset/debug
lib/bin/$toolset/debug/b.obj lib2/bin/$toolset/debug/c.obj
""")

t.expect_addition("lib2/bin/$toolset/debug/c.obj")
t.expect_content("lib2/bin/$toolset/debug/c.obj",
"""$toolset/debug
lib2/c.cpp
""")

t.expect_addition("lib2/bin/$toolset/debug/d.obj")
t.expect_content("lib2/bin/$toolset/debug/d.obj",
"""$toolset/debug
lib2/d.cpp
""")

t.expect_addition("lib2/bin/$toolset/debug/l.exe")
t.expect_content("lib2/bin/$toolset/debug/l.exe",
"""$toolset/debug
lib2/bin/$toolset/debug/c.obj bin/$toolset/debug/a.obj
""")

t.expect_addition("lib2/helper/bin/$toolset/debug/e.obj")
t.expect_content("lib2/helper/bin/$toolset/debug/e.obj",
"""$toolset/debug
lib2/helper/e.cpp
""")

t.expect_addition("lib3/bin/$toolset/debug/f.obj")
t.expect_content("lib3/bin/$toolset/debug/f.obj",
"""$toolset/debug
lib3/f.cpp lib2/helper/bin/$toolset/debug/e.obj
""")
                 

t.touch("a.cpp")
t.run_build_system()
t.expect_touch(["bin/$toolset/debug/a.obj",
                "bin/$toolset/debug/a.exe",
                "lib2/bin/$toolset/debug/l.exe"])


t.run_build_system(extra_args="release optimization=off,speed")
t.expect_addition(["bin/$toolset/release/a.exe", 
                  "bin/$toolset/release/a.obj", 
                  "bin/$toolset/release/optimization-off/a.exe", 
                  "bin/$toolset/release/optimization-off/a.obj"])

t.run_build_system(extra_args='--clean-all')
t.expect_removal(["bin/$toolset/debug/a.obj",
                 "bin/$toolset/debug/a.exe",
                 "lib/bin/$toolset/debug/b.obj",
                 "lib/bin/$toolset/debug/m.exe",
                 "lib2/bin/$toolset/debug/c.obj",
                 "lib2/bin/$toolset/debug/d.obj",
                 "lib2/bin/$toolset/debug/l.exe",
                 "lib3/bin/$toolset/debug/f.obj",
                  ])

# Now test target ids in command line
t.set_tree("project-test3")
t.run_build_system("lib//b.obj")
t.expect_addition("lib/bin/$toolset/debug/b.obj")
t.expect_nothing_more()

t.run_build_system("--clean lib//b.obj")
t.expect_removal("lib/bin/$toolset/debug/b.obj")
t.expect_nothing_more()

t.run_build_system("lib//b.obj")
t.expect_addition("lib/bin/$toolset/debug/b.obj")
t.expect_nothing_more()


t.run_build_system("release lib2/helper//e.obj /lib3//f.obj")
t.expect_addition("lib2/helper/bin/$toolset/release/e.obj")
t.expect_addition("lib3/bin/$toolset/release/f.obj")
t.expect_nothing_more()

# Test project ids in command line work as well
t.set_tree("project-test3")
t.run_build_system("/lib2")
t.expect_addition("lib2/bin/$toolset/debug/" * List("c.obj d.obj l.exe"))
t.expect_addition("bin/$toolset/debug/a.obj")
t.expect_nothing_more()


t.run_build_system("lib")
t.expect_addition("lib/bin/$toolset/debug/" * List("b.obj m.exe"))
t.expect_nothing_more()

t.cleanup()