]> git.proxmox.com Git - ceph.git/blame - 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
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
92f5a8d4 9from time import sleep
7c673cae
FG
10
11
12t = BoostBuild.Tester()
13
14t.write("jamroot.jam", """
15import pch ;
16cpp-pch pch : pch.hpp : <toolset>msvc:<source>pch.cpp <include>. ;
17exe hello : hello.cpp pch : <include>. ;
18""")
19
20t.write("pch.hpp.bad", """
21THIS 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 26sleep(1)
7c673cae
FG
27t.write("pch.hpp", """
28class TestClass
29{
30public:
31 TestClass( int, int ) {}
32};
33""")
34
35t.write("pch.cpp", """#include <pch.hpp>
36""")
37
38t.write("hello.cpp", """#include <pch.hpp>
39int main() { TestClass c(1, 2); }
40""")
41
42t.run_build_system()
b32b8144 43t.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
50t.copy_preserving_timestamp("pch.hpp.bad", "pch.hpp")
51
52t.rm("bin/$toolset/debug/hello.obj")
b32b8144 53t.rm("bin/$toolset/debug/*/hello.obj")
7c673cae
FG
54
55t.run_build_system()
b32b8144 56t.expect_addition("bin/$toolset/debug*/hello.obj")
7c673cae
FG
57
58t.cleanup()