]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/clean.py
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)
10 t
= BoostBuild
.Tester(use_test_config
=False)
12 t
.write("a.cpp", "int main() {}\n")
13 t
.write("jamroot.jam", "exe a : a.cpp sub1//sub1 sub2//sub2 sub3//sub3 ;")
14 t
.write("sub1/jamfile.jam", """\
15 lib sub1 : sub1.cpp sub1_2 ../sub2//sub2 ;
16 lib sub1_2 : sub1_2.cpp ;
19 t
.write("sub1/sub1.cpp", """\
26 t
.write("sub1/sub1_2.cpp", """\
33 t
.write("sub2/jamfile.jam", "lib sub2 : sub2.cpp ;")
34 t
.write("sub2/sub2.cpp", """\
41 t
.write("sub3/jamroot.jam", "lib sub3 : sub3.cpp ;")
42 t
.write("sub3/sub3.cpp", """\
49 # 'clean' should not remove files under separate jamroot.jam.
51 t
.run_build_system(["--clean"])
52 t
.expect_removal("bin/$toolset/debug/a.obj")
53 t
.expect_removal("sub1/bin/$toolset/debug/sub1.obj")
54 t
.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj")
55 t
.expect_removal("sub2/bin/$toolset/debug/sub2.obj")
56 t
.expect_nothing("sub3/bin/$toolset/debug/sub3.obj")
58 # 'clean-all' removes everything it can reach.
60 t
.run_build_system(["--clean-all"])
61 t
.expect_removal("bin/$toolset/debug/a.obj")
62 t
.expect_removal("sub1/bin/$toolset/debug/sub1.obj")
63 t
.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj")
64 t
.expect_removal("sub2/bin/$toolset/debug/sub2.obj")
65 t
.expect_nothing("sub3/bin/$toolset/debug/sub3.obj")
67 # 'clean' together with project target removes only under that project.
69 t
.run_build_system(["sub1", "--clean"])
70 t
.expect_nothing("bin/$toolset/debug/a.obj")
71 t
.expect_removal("sub1/bin/$toolset/debug/sub1.obj")
72 t
.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj")
73 t
.expect_nothing("sub2/bin/$toolset/debug/sub2.obj")
74 t
.expect_nothing("sub3/bin/$toolset/debug/sub3.obj")
76 # 'clean-all' removes everything.
78 t
.run_build_system(["sub1", "--clean-all"])
79 t
.expect_nothing("bin/$toolset/debug/a.obj")
80 t
.expect_removal("sub1/bin/$toolset/debug/sub1.obj")
81 t
.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj")
82 t
.expect_removal("sub2/bin/$toolset/debug/sub2.obj")
83 t
.expect_nothing("sub3/bin/$toolset/debug/sub3.obj")
85 # If main target is explicitly named, we should not remove files from other
88 t
.run_build_system(["sub1//sub1", "--clean"])
89 t
.expect_removal("sub1/bin/$toolset/debug/sub1.obj")
90 t
.expect_nothing("sub1/bin/$toolset/debug/sub1_2.obj")
91 t
.expect_nothing("sub2/bin/$toolset/debug/sub2.obj")
92 t
.expect_nothing("sub3/bin/$toolset/debug/sub3.obj")
94 # Regression test: sources of the 'cast' rule were mistakenly deleted.
96 t
.write("jamroot.jam", """\
101 t
.run_build_system(["--clean"])
102 t
.expect_nothing("a.h")