]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/build_dir.py
3 # Copyright 2003 Dave Abrahams
4 # Copyright 2002, 2003, 2005 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)
8 # Test that we can change build directory using the 'build-dir' project
15 t
= BoostBuild
.Tester(use_test_config
=False)
18 # Test that top-level project can affect build dir.
19 t
.write("jamroot.jam", "import gcc ;")
20 t
.write("jamfile.jam", """\
21 project : build-dir build ;
26 t
.write("a.cpp", "int main() {}\n")
28 t
.write("src/jamfile.jam", "exe b : b.cpp ; ")
30 t
.write("src/b.cpp", "int main() {}\n")
34 t
.expect_addition(["build/$toolset/debug/a.exe",
35 "build/src/$toolset/debug/b.exe"])
37 # Test that building from child projects work.
38 t
.run_build_system(subdir
='src')
39 t
.ignore("build/config.log")
40 t
.ignore("build/project-cache.jam")
41 t
.expect_nothing_more()
43 # Test that project can override build dir.
44 t
.write("jamfile.jam", """\
49 t
.write("src/jamfile.jam", """\
50 project : build-dir build ;
55 t
.expect_addition(["bin/$toolset/debug/a.exe",
56 "src/build/$toolset/debug/b.exe"])
58 # Now test the '--build-dir' option.
60 t
.write("jamroot.jam", "")
62 # Test that we get an error when no project id is specified.
63 t
.run_build_system(["--build-dir=foo"])
64 t
.fail_test(string
.find(t
.stdout(),
65 "warning: the --build-dir option will be ignored") == -1)
67 t
.write("jamroot.jam", """\
72 t
.write("a.cpp", "int main() {}\n")
73 t
.write("sub/jamfile.jam", "exe b : b.cpp ;\n")
74 t
.write("sub/b.cpp", "int main() {}\n")
76 t
.run_build_system(["--build-dir=build"])
77 t
.expect_addition(["build/foo/$toolset/debug/a.exe",
78 "build/foo/sub/$toolset/debug/b.exe"])
80 t
.write("jamroot.jam", """\
81 project foo : build-dir bin.v2 ;
86 t
.run_build_system(["--build-dir=build"])
87 t
.expect_addition(["build/foo/bin.v2/$toolset/debug/a.exe",
88 "build/foo/bin.v2/sub/$toolset/debug/b.exe"])
90 # Try building in subdir. We expect that the entire build tree with be in
91 # 'sub/build'. Today, I am not sure if this is what the user expects, but let
94 t
.run_build_system(["--build-dir=build"], subdir
="sub")
95 t
.expect_addition(["sub/build/foo/bin.v2/sub/$toolset/debug/b.exe"])
97 t
.write("jamroot.jam", """\
98 project foo : build-dir %s ;
101 """ % string
.replace(os
.getcwd(), '\\', '\\\\'))
103 t
.run_build_system(["--build-dir=build"], status
=1)
104 t
.fail_test(string
.find(t
.stdout(),
105 "Absolute directory specified via 'build-dir' project attribute") == -1)