1 | #!/usr/bin/python |
---|
2 | |
---|
3 | # Test the 'make' rule |
---|
4 | |
---|
5 | from BoostBuild import Tester |
---|
6 | from string import find |
---|
7 | |
---|
8 | t = Tester(pass_toolset=1) |
---|
9 | |
---|
10 | t.write("project-root.jam", "") |
---|
11 | t.write("Jamfile", """ |
---|
12 | |
---|
13 | rule creator ( string targets * : sources * : * ) |
---|
14 | { |
---|
15 | STRING on $(targets) = $(string) ; |
---|
16 | creator2 $(targets) : $(sources) ; |
---|
17 | } |
---|
18 | |
---|
19 | actions creator2 |
---|
20 | { |
---|
21 | echo $(STRING) > $(<) |
---|
22 | } |
---|
23 | |
---|
24 | make foo.bar : : creator foobar ; |
---|
25 | """) |
---|
26 | |
---|
27 | t.run_build_system() |
---|
28 | t.expect_addition("bin/$toolset/debug/foo.bar") |
---|
29 | t.fail_test(find(t.read("bin/$toolset/debug/foo.bar"), "foobar") == -1) |
---|
30 | |
---|
31 | # Regression test. Make sure that if main target requested two times, |
---|
32 | # and build request differ only in incidental properties, the main target |
---|
33 | # if created only once. The bug was discovered by Kirill Lapshin. |
---|
34 | |
---|
35 | t.write("Jamfile", """ |
---|
36 | # Make sure that incidental property does not |
---|
37 | # cause second creation of 'hello1.cpp'. |
---|
38 | exe a : dir//hello1.cpp ; |
---|
39 | exe b : dir//hello1.cpp/<hardcode-dll-paths>true ; |
---|
40 | """) |
---|
41 | |
---|
42 | t.write("project-root.jam", "") |
---|
43 | |
---|
44 | t.write("dir/Jamfile", """ |
---|
45 | import common ; |
---|
46 | make hello1.cpp : hello.cpp : common.copy ; |
---|
47 | |
---|
48 | """) |
---|
49 | |
---|
50 | t.write("dir/hello.cpp", """ |
---|
51 | int main() |
---|
52 | { |
---|
53 | return 1; |
---|
54 | } |
---|
55 | """) |
---|
56 | t.run_build_system("-d2") |
---|
57 | t.fail_test(t.stdout().count("common.copy") != 1) |
---|
58 | |
---|
59 | t.cleanup() |
---|