]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/pch.py
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / tools / build / test / pch.py
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
9
10
11 t = BoostBuild.Tester()
12
13 t.write("jamroot.jam", """
14 import pch ;
15 cpp-pch pch : pch.hpp : <toolset>msvc:<source>pch.cpp <include>. ;
16 exe hello : hello.cpp pch : <include>. ;
17 """)
18
19 t.write("pch.hpp.bad", """
20 THIS WILL NOT COMPILE
21 """)
22
23 # Note that pch.hpp is written after pch.hpp.bad, so its timestamp will not be
24 # less than timestamp of pch.hpp.bad.
25 t.write("pch.hpp", """
26 class TestClass
27 {
28 public:
29 TestClass( int, int ) {}
30 };
31 """)
32
33 t.write("pch.cpp", """#include <pch.hpp>
34 """)
35
36 t.write("hello.cpp", """#include <pch.hpp>
37 int main() { TestClass c(1, 2); }
38 """)
39
40 t.run_build_system()
41 t.expect_addition("bin/$toolset/debug/hello.exe")
42
43
44 # Now make the header unusable, without changing timestamp. If everything is OK,
45 # Boost.Build will not recreate PCH, and compiler will happily use pre-compiled
46 # header, not noticing that the real header is bad.
47
48 t.copy_preserving_timestamp("pch.hpp.bad", "pch.hpp")
49
50 t.rm("bin/$toolset/debug/hello.obj")
51
52 t.run_build_system()
53 t.expect_addition("bin/$toolset/debug/hello.obj")
54
55 t.cleanup()