Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/build/v2/test/default_build.py @ 12

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

added boost

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