Imported Upstream version 1.51.0
[platform/upstream/boost.git] / tools / build / v2 / test / unused.py
1 #!/usr/bin/python
2
3 # Copyright 2003 Vladimir Prus 
4 # Distributed under the Boost Software License, Version 1.0. 
5 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 
6
7 # Test that unused sources are at least reported.
8
9 import BoostBuild
10 from string import find
11
12 t = BoostBuild.Tester()
13
14 t.set_tree("unused")
15
16 t.run_build_system()
17 # The second invocation should do nothing, and produce no warning. The previous
18 # invocation might have printed executed actions and other things, so it is not
19 # easy to check if warning was issued or not.
20 t.run_build_system(stdout="")
21
22 t.run_build_system("-sGENERATE_ONLY_UNUSABLE=1", stdout="")
23
24 # Now check that even if main target generates nothing, its usage requirements
25 # are still propagated to dependants.
26 t.write("a.cpp", """
27 #ifdef FOO
28 int main() {}
29 #endif
30 """)
31 t.run_build_system("-sGENERATE_NOTHING=1")
32
33 t.cleanup()