]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/usr/bin/python |
2 | ||
3 | # Copyright 2006 Vladimir Prus. | |
4 | # Distributed under the Boost Software License, Version 1.0. (See | |
5 | # accompanying file LICENSE_1_0.txt or copy at | |
6 | # http://www.boost.org/LICENSE_1_0.txt) | |
7 | ||
8 | import BoostBuild | |
92f5a8d4 | 9 | from time import sleep |
7c673cae FG |
10 | |
11 | ||
12 | t = BoostBuild.Tester() | |
13 | ||
14 | t.write("jamroot.jam", """ | |
15 | import pch ; | |
16 | cpp-pch pch : pch.hpp : <toolset>msvc:<source>pch.cpp <include>. ; | |
17 | exe hello : hello.cpp pch : <include>. ; | |
18 | """) | |
19 | ||
20 | t.write("pch.hpp.bad", """ | |
21 | THIS WILL NOT COMPILE | |
22 | """) | |
23 | ||
24 | # Note that pch.hpp is written after pch.hpp.bad, so its timestamp will not be | |
25 | # less than timestamp of pch.hpp.bad. | |
92f5a8d4 | 26 | sleep(1) |
7c673cae FG |
27 | t.write("pch.hpp", """ |
28 | class TestClass | |
29 | { | |
30 | public: | |
31 | TestClass( int, int ) {} | |
32 | }; | |
33 | """) | |
34 | ||
35 | t.write("pch.cpp", """#include <pch.hpp> | |
36 | """) | |
37 | ||
38 | t.write("hello.cpp", """#include <pch.hpp> | |
39 | int main() { TestClass c(1, 2); } | |
40 | """) | |
41 | ||
42 | t.run_build_system() | |
b32b8144 | 43 | t.expect_addition("bin/$toolset/debug*/hello.exe") |
7c673cae FG |
44 | |
45 | ||
46 | # Now make the header unusable, without changing timestamp. If everything is OK, | |
47 | # Boost.Build will not recreate PCH, and compiler will happily use pre-compiled | |
48 | # header, not noticing that the real header is bad. | |
49 | ||
50 | t.copy_preserving_timestamp("pch.hpp.bad", "pch.hpp") | |
51 | ||
52 | t.rm("bin/$toolset/debug/hello.obj") | |
b32b8144 | 53 | t.rm("bin/$toolset/debug/*/hello.obj") |
7c673cae FG |
54 | |
55 | t.run_build_system() | |
b32b8144 | 56 | t.expect_addition("bin/$toolset/debug*/hello.obj") |
7c673cae FG |
57 | |
58 | t.cleanup() |