]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/default_build.py
update ceph source to reef 18.1.2
[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.txt or https://www.bfgroup.xyz/b2/LICENSE.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.ignore_addition('bin/*/a.rsp')
27 t.expect_nothing_more()
28
29 # Now check that we can specify explicit build request and default-build will be
30 # combined with it.
31 t.run_build_system(["optimization=space"])
32 t.expect_addition("bin/$toolset/debug/optimization-space*/a.exe")
33 t.expect_addition("bin/$toolset/release/optimization-space*/a.exe")
34
35 # Test that default-build must be identical in all alternatives. Error case.
36 t.write("jamfile.jam", """\
37 exe a : a.cpp : : debug ;
38 exe a : b.cpp : : ;
39 """)
40 t.run_build_system(["-n", "--no-error-backtrace"], status=1)
41 t.fail_test(t.stdout().find("default build must be identical in all alternatives") == -1)
42
43 # Test that default-build must be identical in all alternatives. No Error case,
44 # empty default build.
45 t.write("jamfile.jam", """\
46 exe a : a.cpp : <variant>debug ;
47 exe a : b.cpp : <variant>release ;
48 """)
49 t.run_build_system(["-n", "--no-error-backtrace"], status=0)
50
51 # Now try a harder example: default build which contains <define> should cause
52 # <define> to be present when "b" is compiled. This happens only if
53 # "build-project b" is placed first.
54 t.write("jamfile.jam", """\
55 project : default-build <define>FOO ;
56 build-project a ;
57 build-project b ;
58 """)
59
60 t.write("a/jamfile.jam", "exe a : a.cpp ../b//b ;")
61 t.write("a/a.cpp", """\
62 #ifdef _WIN32
63 __declspec(dllimport)
64 #endif
65 void foo();
66 int main() { foo(); }
67 """)
68
69 t.write("b/jamfile.jam", "lib b : b.cpp ;")
70 t.write("b/b.cpp", """\
71 #ifdef FOO
72 #ifdef _WIN32
73 __declspec(dllexport)
74 #endif
75 void foo() {}
76 #endif
77 """)
78
79 t.run_build_system()
80
81 t.cleanup()