]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/pch.py
import new upstream nautilus stable release 14.2.8
[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 from time import sleep
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.
26 sleep(1)
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()
43 t.expect_addition("bin/$toolset/debug*/hello.exe")
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")
53 t.rm("bin/$toolset/debug/*/hello.obj")
54
55 t.run_build_system()
56 t.expect_addition("bin/$toolset/debug*/hello.obj")
57
58 t.cleanup()