Imported Upstream version 1.51.0
[platform/upstream/boost.git] / tools / build / v2 / test / make_rule.py
1 #!/usr/bin/python
2
3 # Copyright 2003 Dave Abrahams
4 # Copyright 2003, 2006 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 the 'make' rule.
9
10 import BoostBuild
11 import string
12
13 t = BoostBuild.Tester(pass_toolset=1)
14
15 t.write("jamroot.jam", """
16 import feature ;
17 feature.feature test_feature : : free ;
18
19 import toolset ;
20 toolset.flags creator STRING : <test_feature> ;
21
22 actions creator
23 {
24     echo $(STRING) > $(<)
25 }
26
27 make foo.bar : : creator : <test_feature>12345678 ;
28 """)
29
30 t.run_build_system()
31 t.expect_addition("bin/$toolset/debug/foo.bar")
32 t.fail_test(string.find(t.read("bin/$toolset/debug/foo.bar"), "12345678") == -1)
33
34
35 # Regression test. Make sure that if a main target is requested two times, and
36 # build requests differ only in incidental properties, the main target is
37 # created only once. The bug was discovered by Kirill Lapshin.
38 t.write("jamroot.jam", """
39 # Make sure that incidental property does not cause second creation of
40 # 'hello1.cpp'.
41 exe a : dir//hello1.cpp ;
42 exe b : dir//hello1.cpp/<hardcode-dll-paths>true ;
43 """)
44
45 t.write("dir/jamfile.jam", """
46 import common ;
47 make hello1.cpp : hello.cpp : common.copy ;
48 """)
49
50 t.write("dir/hello.cpp", """
51 int main() {}
52 """)
53
54 # Show only action names.
55 t.run_build_system("-d1 -n")
56 t.fail_test(t.stdout().count("copy") != 1)
57
58 t.cleanup()