Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/tools/build/v2/test/dependency_test.py @ 32

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

updated boost from 1_33_1 to 1_34_1

File size: 2.6 KB
Line 
1#!/usr/bin/python
2
3from BoostBuild import Tester, List
4
5t = Tester()
6
7t.set_tree("dependency-test")
8t.run_build_system()
9# Check that main target 'c' was able to find 'x.h' from
10# 'a's dependency graph
11t.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
16t.touch("a.h")
17t.run_build_system()
18
19t.expect_touch("bin/$toolset/debug/a.exe")
20t.expect_touch("bin/$toolset/debug/a.obj")
21t.expect_touch("bin/$toolset/debug/a_c.obj")
22t.expect_touch("bin/$toolset/debug/b.exe")
23t.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")
28t.ignore("*.tds")
29t.expect_nothing_more()
30
31# Only 'a' include <a.h> and should be updated
32t.touch("src1/a.h")
33t.run_build_system()
34
35t.expect_touch("bin/$toolset/debug/a.exe")
36t.expect_touch("bin/$toolset/debug/a.obj")
37t.expect_touch("bin/$toolset/debug/a_c.obj")
38t.ignore("*.tds")
39t.expect_nothing_more()
40
41# "src/a.h" includes "b.h" (in the same dir)
42t.touch("src1/b.h")
43t.run_build_system()
44t.expect_touch("bin/$toolset/debug/a.exe")
45t.expect_touch("bin/$toolset/debug/a.obj")
46t.expect_touch("bin/$toolset/debug/a_c.obj")
47t.ignore("*.tds")
48t.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.
52t.touch("src1/c.h")
53t.run_build_system()
54t.expect_touch("bin/$toolset/debug/a.exe")
55
56t.touch("b.h")
57t.run_build_system()
58t.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.
64t.touch("x.foo")
65t.run_build_system()
66t.expect_touch("bin/$toolset/debug/a.obj")
67t.expect_touch("bin/$toolset/debug/a_c.obj")
68
69# Check that generated headers are scanned for dependencies as well
70t.touch("src1/z.h")
71t.run_build_system()
72t.expect_touch("bin/$toolset/debug/a.obj")
73t.expect_touch("bin/$toolset/debug/a_c.obj")
74
75# Regression test: on windows, <includes> with absolute paths
76# were not considered when scanning dependencies.
77
78t.rm(".")
79
80t.write("Jamroot", """
81path-constant TOP : . ;
82exe app : main.cpp
83        : <include>$(TOP)/include
84         ;
85""");
86
87t.write("main.cpp", """
88#include <dir/header.h>
89
90int main() { return 0; }
91
92""")
93
94t.write("include/dir/header.h", "")
95t.run_build_system()
96t.expect_addition("bin/$toolset/debug/main.obj")
97
98t.touch("include/dir/header.h")
99t.run_build_system()
100t.expect_touch("bin/$toolset/debug/main.obj")
101
102
103
104t.cleanup()
Note: See TracBrowser for help on using the repository browser.