Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/tools/build/v2/test/default_build.py @ 32

Last change on this file since 32 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 2.3 KB
Line 
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
10from BoostBuild import Tester, List
11t = Tester()
12
13t.write("project-root.jam", "import gcc ;")
14t.write("Jamfile", "exe a : a.cpp : : debug release ;")
15t.write("a.cpp", "int main() { return 0; }\n")
16
17t.run_build_system()
18t.expect_addition("bin/$toolset/debug/a.exe")
19t.expect_addition("bin/$toolset/release/a.exe")
20
21# Check that explictly-specified build variant supresses
22# default-build
23t.rm("bin")
24t.run_build_system("release")
25t.expect_addition(List("bin/$toolset/release/") * "a.exe a.obj")
26t.expect_nothing_more()
27
28# Now check that we can specify explicit build request and
29# default-build will be combined with it
30t.run_build_system("optimization=space")
31t.expect_addition("bin/$toolset/debug/optimization-space/a.exe")
32t.expect_addition("bin/$toolset/release/optimization-space/a.exe")
33
34# Test that default-build must be identical in all alternatives. Error case.
35t.write("Jamfile", """
36exe a : a.cpp : : debug ;
37exe a : b.cpp : : ;
38""")
39expected="""error: default build must be identical in all alternatives
40main target is ./a
41with
42differing from previous default build <variant>debug
43
44"""
45t.run_build_system("-n --no-error-backtrace", status=1, stdout=expected)
46
47# Test that default-build must be identical in all alternatives. No Error case, empty default build.
48t.write("Jamfile", """
49exe a : a.cpp : <variant>debug ;
50exe a : b.cpp : <variant>release ;
51""")
52t.run_build_system("-n --no-error-backtrace", status=0)
53
54
55# Now try a harder example: default build which contains <define>
56# should cause <define> to be present when "b" is compiled.
57# This happens only of "build-project b" is placed first.
58t.write("Jamfile", """
59    project
60        : default-build <define>FOO
61    ;
62
63    build-project a ;
64    build-project b ;   
65""")
66
67t.write("a/Jamfile", """
68    exe a : a.cpp ../b//b ;
69""")
70t.write("a/a.cpp", """
71#ifdef _WIN32
72__declspec(dllimport)
73#endif
74void foo();
75int main() { foo(); return 0; }
76""")
77
78t.write("b/Jamfile", """
79    lib b : b.cpp ;
80""")
81t.write("b/b.cpp", """
82#ifdef FOO
83#ifdef _WIN32
84__declspec(dllexport)
85#endif
86void foo() {}
87#endif
88""")
89
90t.run_build_system()
91
92t.cleanup()
Note: See TracBrowser for help on using the repository browser.