]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/default_build.py
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / tools / build / test / default_build.py
1 #!/usr/bin/python
2
3 # Copyright 2003 Dave Abrahams
4 # Copyright 2002, 2003 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)
7
8 # Test that default build clause actually has any effect.
9
10 import BoostBuild
11
12 t = BoostBuild.Tester(use_test_config=False)
13
14 t.write("jamroot.jam", "")
15 t.write("jamfile.jam", "exe a : a.cpp : : debug release ;")
16 t.write("a.cpp", "int main() {}\n")
17
18 t.run_build_system()
19 t.expect_addition("bin/$toolset/debug/a.exe")
20 t.expect_addition("bin/$toolset/release/a.exe")
21
22 # Check that explictly-specified build variant suppresses default-build.
23 t.rm("bin")
24 t.run_build_system(["release"])
25 t.expect_addition(BoostBuild.List("bin/$toolset/release/") * "a.exe a.obj")
26 t.expect_nothing_more()
27
28 # Now check that we can specify explicit build request and default-build will be
29 # combined with it.
30 t.run_build_system(["optimization=space"])
31 t.expect_addition("bin/$toolset/debug/optimization-space/a.exe")
32 t.expect_addition("bin/$toolset/release/optimization-space/a.exe")
33
34 # Test that default-build must be identical in all alternatives. Error case.
35 t.write("jamfile.jam", """\
36 exe a : a.cpp : : debug ;
37 exe a : b.cpp : : ;
38 """)
39 t.run_build_system(["-n", "--no-error-backtrace"], status=1)
40 t.fail_test(t.stdout().find("default build must be identical in all alternatives") == -1)
41
42 # Test that default-build must be identical in all alternatives. No Error case,
43 # empty default build.
44 t.write("jamfile.jam", """\
45 exe a : a.cpp : <variant>debug ;
46 exe a : b.cpp : <variant>release ;
47 """)
48 t.run_build_system(["-n", "--no-error-backtrace"], status=0)
49
50 # Now try a harder example: default build which contains <define> should cause
51 # <define> to be present when "b" is compiled. This happens only if
52 # "build-project b" is placed first.
53 t.write("jamfile.jam", """\
54 project : default-build <define>FOO ;
55 build-project a ;
56 build-project b ;
57 """)
58
59 t.write("a/jamfile.jam", "exe a : a.cpp ../b//b ;")
60 t.write("a/a.cpp", """\
61 #ifdef _WIN32
62 __declspec(dllimport)
63 #endif
64 void foo();
65 int main() { foo(); }
66 """)
67
68 t.write("b/jamfile.jam", "lib b : b.cpp ;")
69 t.write("b/b.cpp", """\
70 #ifdef FOO
71 #ifdef _WIN32
72 __declspec(dllexport)
73 #endif
74 void foo() {}
75 #endif
76 """)
77
78 t.run_build_system()
79
80 t.cleanup()