1 | #!/usr/bin/python |
---|
2 | |
---|
3 | from BoostBuild import Tester, List |
---|
4 | |
---|
5 | t = Tester() |
---|
6 | |
---|
7 | t.set_tree("dependency-test") |
---|
8 | t.run_build_system() |
---|
9 | # Check that main target 'c' was able to find 'x.h' from |
---|
10 | # 'a's dependency graph |
---|
11 | t.expect_addition("bin/$toolset/debug/c.exe") |
---|
12 | |
---|
13 | # Check handling of first level includes. |
---|
14 | |
---|
15 | # Both 'a' and 'b' include "a.h" and should be updated |
---|
16 | t.touch("a.h") |
---|
17 | t.run_build_system() |
---|
18 | |
---|
19 | t.expect_touch("bin/$toolset/debug/a.exe") |
---|
20 | t.expect_touch("bin/$toolset/debug/a.obj") |
---|
21 | t.expect_touch("bin/$toolset/debug/a_c.obj") |
---|
22 | t.expect_touch("bin/$toolset/debug/b.exe") |
---|
23 | t.expect_touch("bin/$toolset/debug/b.obj") |
---|
24 | # Now, <dependency> does not add dependency. |
---|
25 | # It sound weird, but is intentional. Need |
---|
26 | # to rename <dependency> eventually. |
---|
27 | #t.expect_touch("bin/$toolset/debug/main-target-c/c.exe") |
---|
28 | t.ignore("*.tds") |
---|
29 | t.expect_nothing_more() |
---|
30 | |
---|
31 | # Only 'a' include <a.h> and should be updated |
---|
32 | t.touch("src1/a.h") |
---|
33 | t.run_build_system() |
---|
34 | |
---|
35 | t.expect_touch("bin/$toolset/debug/a.exe") |
---|
36 | t.expect_touch("bin/$toolset/debug/a.obj") |
---|
37 | t.expect_touch("bin/$toolset/debug/a_c.obj") |
---|
38 | t.ignore("*.tds") |
---|
39 | t.expect_nothing_more() |
---|
40 | |
---|
41 | # "src/a.h" includes "b.h" (in the same dir) |
---|
42 | t.touch("src1/b.h") |
---|
43 | t.run_build_system() |
---|
44 | t.expect_touch("bin/$toolset/debug/a.exe") |
---|
45 | t.expect_touch("bin/$toolset/debug/a.obj") |
---|
46 | t.expect_touch("bin/$toolset/debug/a_c.obj") |
---|
47 | t.ignore("*.tds") |
---|
48 | t.expect_nothing_more() |
---|
49 | |
---|
50 | # included by "src/b.h". We had a bug: file included via "", |
---|
51 | # like "b.h" is in this case was not scanned at all. |
---|
52 | t.touch("src1/c.h") |
---|
53 | t.run_build_system() |
---|
54 | t.expect_touch("bin/$toolset/debug/a.exe") |
---|
55 | |
---|
56 | t.touch("b.h") |
---|
57 | t.run_build_system() |
---|
58 | t.expect_nothing_more() |
---|
59 | |
---|
60 | # Test dependency on generated header. |
---|
61 | # TODO: we have also to check that generated header is found correctly |
---|
62 | # if it is different for different subvariants. Lacking any toolset |
---|
63 | # support, this check will be implemented later. |
---|
64 | t.touch("x.foo") |
---|
65 | t.run_build_system() |
---|
66 | t.expect_touch("bin/$toolset/debug/a.obj") |
---|
67 | t.expect_touch("bin/$toolset/debug/a_c.obj") |
---|
68 | |
---|
69 | # Check that generated headers are scanned for dependencies as well |
---|
70 | t.touch("src1/z.h") |
---|
71 | t.run_build_system() |
---|
72 | t.expect_touch("bin/$toolset/debug/a.obj") |
---|
73 | t.expect_touch("bin/$toolset/debug/a_c.obj") |
---|
74 | |
---|
75 | t.cleanup() |
---|