Imported Upstream version 1.57.0
[platform/upstream/boost.git] / tools / build / test / direct_request_test.py
1 #!/usr/bin/python
2
3 import BoostBuild
4
5 t = BoostBuild.Tester(use_test_config=False)
6
7 # First check some startup.
8
9 t.write("jamroot.jam", "")
10 t.write("jamfile.jam", """\
11 exe a : a.cpp b ;
12 lib b : b.cpp ;
13 """)
14
15 t.write("a.cpp", """\
16 void
17 # ifdef _WIN32
18 __declspec(dllimport)
19 # endif
20 foo();
21 int main() { foo(); }
22 """)
23
24 t.write("b.cpp", """\
25 #ifdef MACROS
26 void
27 # ifdef _WIN32
28 __declspec(dllexport)
29 # endif
30 foo() {}
31 #endif
32
33 # ifdef _WIN32
34 int __declspec(dllexport) force_implib_creation;
35 # endif
36 """)
37
38 t.run_build_system(["define=MACROS"])
39 t.expect_addition("bin/$toolset/debug/"
40                   * (BoostBuild.List("a.obj b.obj b.dll a.exe")))
41
42
43 # When building a debug version, the 'define' still applies.
44 t.rm("bin")
45 t.run_build_system(["debug", "define=MACROS"])
46 t.expect_addition("bin/$toolset/debug/"
47                   * (BoostBuild.List("a.obj b.obj b.dll a.exe")))
48
49
50 # When building a release version, the 'define' still applies.
51 t.write("jamfile.jam", """\
52 exe a : a.cpp b : <variant>debug ;
53 lib b : b.cpp ;
54 """)
55 t.rm("bin")
56 t.run_build_system(["release", "define=MACROS"])
57
58
59 # Regression test: direct build request was not working when there was more
60 # than one level of 'build-project'.
61 t.rm(".")
62 t.write("jamroot.jam", "")
63 t.write("jamfile.jam", "build-project a ;")
64 t.write("a/jamfile.jam", "build-project b ;")
65 t.write("a/b/jamfile.jam", "")
66 t.run_build_system(["release"])
67
68 t.cleanup()