Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/tools/build/v2/test/clean.py @ 32

Last change on this file since 32 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 3.0 KB
Line 
1#!/usr/bin/python
2
3#  Copyright (C) Vladimir Prus 2006.
4#  Distributed under the Boost Software License, Version 1.0. (See
5#  accompanying file LICENSE_1_0.txt or copy at
6#  http://www.boost.org/LICENSE_1_0.txt)
7
8from BoostBuild import Tester, List
9import string
10
11t = Tester()
12
13t.write("a.cpp", """
14int main() {}
15
16""")
17
18t.write("Jamroot", """
19exe a : a.cpp sub1//sub1 sub2//sub2 sub3//sub3 ;
20""")
21
22t.write("sub1/Jamfile", """
23lib sub1 : sub1.cpp sub1_2 ../sub2//sub2 ;
24lib sub1_2 : sub1_2.cpp ;
25""")
26
27t.write("sub1/sub1.cpp", """
28#ifdef _WIN32
29__declspec(dllexport)
30#endif
31void sub1() {}
32
33""")
34
35t.write("sub1/sub1_2.cpp", """
36#ifdef _WIN32
37__declspec(dllexport)
38#endif
39void sub1() {}
40
41""")
42
43
44t.write("sub2/Jamfile", """
45lib sub2 : sub2.cpp ;
46""")
47
48t.write("sub2/sub2.cpp", """
49#ifdef _WIN32
50__declspec(dllexport)
51#endif
52void sub2() {}
53
54""")
55
56t.write("sub3/Jamroot", """
57lib sub3 : sub3.cpp ;
58""")
59
60t.write("sub3/sub3.cpp", """
61#ifdef _WIN32
62__declspec(dllexport)
63#endif
64void sub3() {}
65
66""")
67
68
69# The 'clean' should not remove files under separate Jamroot.
70t.run_build_system()
71t.run_build_system("--clean")
72t.expect_removal("bin/$toolset/debug/a.obj")
73t.expect_removal("sub1/bin/$toolset/debug/sub1.obj")
74t.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj")
75t.expect_removal("sub2/bin/$toolset/debug/sub2.obj")
76t.expect_nothing("sub3/bin/$toolset/debug/sub3.obj")
77
78# The 'clean-all' removes everything it can reach.
79t.run_build_system()
80t.run_build_system("--clean")
81t.expect_removal("bin/$toolset/debug/a.obj")
82t.expect_removal("sub1/bin/$toolset/debug/sub1.obj")
83t.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj")
84t.expect_removal("sub2/bin/$toolset/debug/sub2.obj")
85t.expect_nothing("sub3/bin/$toolset/debug/sub3.obj")
86
87# The 'clean' together with project target removes
88# only under that probject
89t.run_build_system()
90t.run_build_system("sub1 --clean")
91t.expect_nothing("bin/$toolset/debug/a.obj")
92t.expect_removal("sub1/bin/$toolset/debug/sub1.obj")
93t.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj")
94t.expect_nothing("sub2/bin/$toolset/debug/sub2.obj")
95t.expect_nothing("sub3/bin/$toolset/debug/sub3.obj")
96
97# And clean-all removes everything.
98t.run_build_system()
99t.run_build_system("sub1 --clean-all")
100t.expect_nothing("bin/$toolset/debug/a.obj")
101t.expect_removal("sub1/bin/$toolset/debug/sub1.obj")
102t.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj")
103t.expect_removal("sub2/bin/$toolset/debug/sub2.obj")
104t.expect_nothing("sub3/bin/$toolset/debug/sub3.obj")
105
106# If main target is explicitly named, we should not remove
107# files from other targets.
108
109t.run_build_system()
110t.run_build_system("sub1//sub1 --clean")
111t.expect_removal("sub1/bin/$toolset/debug/sub1.obj")
112t.expect_nothing("sub1/bin/$toolset/debug/sub1_2.obj")
113t.expect_nothing("sub2/bin/$toolset/debug/sub2.obj")
114t.expect_nothing("sub3/bin/$toolset/debug/sub3.obj")
115
116
117# Regression test: sources of the 'cast' rule were mistakenly
118# deleted.
119t.rm(".")
120t.write("Jamroot", """
121import cast ;
122cast a cpp : a.h ;
123""")
124t.write("a.h", "")
125
126t.run_build_system("--clean")
127t.expect_nothing("a.h")
128
129t.cleanup()
130
Note: See TracBrowser for help on using the repository browser.