]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/test/default_build.py
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / build / test / default_build.py
CommitLineData
7c673cae
FG
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
10import BoostBuild
11
12t = BoostBuild.Tester(use_test_config=False)
13
14t.write("jamroot.jam", "")
15t.write("jamfile.jam", "exe a : a.cpp : : debug release ;")
16t.write("a.cpp", "int main() {}\n")
17
18t.run_build_system()
b32b8144
FG
19t.expect_addition("bin/$toolset/debug*/a.exe")
20t.expect_addition("bin/$toolset/release*/a.exe")
7c673cae
FG
21
22# Check that explictly-specified build variant suppresses default-build.
23t.rm("bin")
24t.run_build_system(["release"])
b32b8144 25t.expect_addition(BoostBuild.List("bin/$toolset/release*/") * "a.exe a.obj")
7c673cae
FG
26t.expect_nothing_more()
27
28# Now check that we can specify explicit build request and default-build will be
29# combined with it.
30t.run_build_system(["optimization=space"])
b32b8144
FG
31t.expect_addition("bin/$toolset/debug/optimization-space*/a.exe")
32t.expect_addition("bin/$toolset/release/optimization-space*/a.exe")
7c673cae
FG
33
34# Test that default-build must be identical in all alternatives. Error case.
35t.write("jamfile.jam", """\
36exe a : a.cpp : : debug ;
37exe a : b.cpp : : ;
38""")
39t.run_build_system(["-n", "--no-error-backtrace"], status=1)
40t.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.
44t.write("jamfile.jam", """\
45exe a : a.cpp : <variant>debug ;
46exe a : b.cpp : <variant>release ;
47""")
48t.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.
53t.write("jamfile.jam", """\
54project : default-build <define>FOO ;
55build-project a ;
56build-project b ;
57""")
58
59t.write("a/jamfile.jam", "exe a : a.cpp ../b//b ;")
60t.write("a/a.cpp", """\
61#ifdef _WIN32
62__declspec(dllimport)
63#endif
64void foo();
65int main() { foo(); }
66""")
67
68t.write("b/jamfile.jam", "lib b : b.cpp ;")
69t.write("b/b.cpp", """\
70#ifdef FOO
71#ifdef _WIN32
72__declspec(dllexport)
73#endif
74void foo() {}
75#endif
76""")
77
78t.run_build_system()
79
80t.cleanup()