2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 12:22:17 +00:00
Files
build/test/unused.py
Vladimir Prus 90dbefd759 Refactorings. Now usage requirements that should be propagated to dependents
are communiated via return value of 'abstract-target.generate', not as
attribute of virtual target. The advantage is that we can return usage
requirements, even if no targets were created.

Also, usage requirements is not really attribute of virtual target. If several
virtual targets are created for one main target, the previous code would set
the same usage requirements on all virtual targets.


[SVN r18689]
2003-06-06 09:02:36 +00:00

33 lines
804 B
Python

#!/usr/bin/python
# Test that unused sources are at least reported.
from BoostBuild import Tester
from string import find
t = Tester()
t.set_tree("unused")
t.run_build_system()
# The second invocation should do nothing, and produce
# no warning. The previous invocation might have printed
# executed actions and other things, so it's not easy
# to check if warning was issued or not.
t.run_build_system()
t.fail_test(t.stdout() != '')
t.run_build_system("-sGENERATE_ONLY_UNUSABLE=1")
t.fail_test(find(t.stdout(), "warning: Unused source b in main target ./a") == -1)
# Now check that even if main target generates nothing, its
# usage requirements are still propagated to dependents.
t.write("a.cpp","""
#ifdef FOO
int main() {}
#endif
""")
t.run_build_system("-sGENERATE_NOTHING=1")
t.cleanup()