]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/test/pch.py
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / build / test / pch.py
CommitLineData
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
8import BoostBuild
9
10
11t = BoostBuild.Tester()
12
13t.write("jamroot.jam", """
14import pch ;
15cpp-pch pch : pch.hpp : <toolset>msvc:<source>pch.cpp <include>. ;
16exe hello : hello.cpp pch : <include>. ;
17""")
18
19t.write("pch.hpp.bad", """
20THIS 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.
25t.write("pch.hpp", """
26class TestClass
27{
28public:
29 TestClass( int, int ) {}
30};
31""")
32
33t.write("pch.cpp", """#include <pch.hpp>
34""")
35
36t.write("hello.cpp", """#include <pch.hpp>
37int main() { TestClass c(1, 2); }
38""")
39
40t.run_build_system()
b32b8144 41t.expect_addition("bin/$toolset/debug*/hello.exe")
7c673cae
FG
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
48t.copy_preserving_timestamp("pch.hpp.bad", "pch.hpp")
49
50t.rm("bin/$toolset/debug/hello.obj")
b32b8144 51t.rm("bin/$toolset/debug/*/hello.obj")
7c673cae
FG
52
53t.run_build_system()
b32b8144 54t.expect_addition("bin/$toolset/debug*/hello.obj")
7c673cae
FG
55
56t.cleanup()