mirror of
https://github.com/boostorg/build.git
synced 2026-02-12 12:02:24 +00:00
Update unused.py and add it to test_all.py.
[SVN r75879]
This commit is contained in:
@@ -213,6 +213,7 @@ tests = [ "absolute_sources",
|
||||
"testing_support",
|
||||
"timedata",
|
||||
"unit_test",
|
||||
"unused",
|
||||
"use_requirements",
|
||||
"using",
|
||||
"wrapper",
|
||||
|
||||
@@ -17,11 +17,9 @@ 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 is not
|
||||
# easy to check if warning was issued or not.
|
||||
t.run_build_system()
|
||||
t.fail_test(find(t.stdout(), "warning: Unused source { b.X } in main target ./a") == -1)
|
||||
t.run_build_system(stdout="")
|
||||
|
||||
t.run_build_system("-sGENERATE_ONLY_UNUSABLE=1")
|
||||
t.fail_test(find(t.stdout(), "warning: Unused source { b.X } in main target ./a") == -1)
|
||||
t.run_build_system("-sGENERATE_ONLY_UNUSABLE=1", stdout="")
|
||||
|
||||
# Now check that even if main target generates nothing, its usage requirements
|
||||
# are still propagated to dependants.
|
||||
|
||||
@@ -10,6 +10,7 @@ import virtual-target ;
|
||||
import "class" : new ;
|
||||
import modules ;
|
||||
import targets ;
|
||||
import project ;
|
||||
|
||||
|
||||
type.register X : x ;
|
||||
@@ -21,21 +22,23 @@ class test-target-class : basic-target
|
||||
basic-target.__init__ $(name) : $(project) ;
|
||||
}
|
||||
|
||||
rule construct ( source-targets * : property-set )
|
||||
rule construct ( name : source-targets * : property-set )
|
||||
{
|
||||
if [ modules.peek : GENERATE_NOTHING ]
|
||||
{
|
||||
return ;
|
||||
return [ property-set.empty ] ;
|
||||
}
|
||||
else if [ modules.peek : GENERATE_ONLY_UNUSABLE ]
|
||||
{
|
||||
return [ virtual-target.from-file b.x : $(self.project) ]
|
||||
return [ property-set.empty ]
|
||||
[ virtual-target.from-file b.x : . : $(self.project) ]
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
return [ virtual-target.from-file b.x : $(self.project) ]
|
||||
[ virtual-target.from-file b.cpp : $(self.project) ]
|
||||
return [ property-set.empty ]
|
||||
[ virtual-target.from-file b.x : . : $(self.project) ]
|
||||
[ virtual-target.from-file b.cpp : . : $(self.project) ]
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -48,7 +51,7 @@ class test-target-class : basic-target
|
||||
|
||||
rule make-b-main-target
|
||||
{
|
||||
local project = [ CALLER_MODULE ] ;
|
||||
local project = [ project.current ] ;
|
||||
|
||||
targets.main-target-alternative
|
||||
[ new test-target-class b : $(project) ] ;
|
||||
|
||||
Reference in New Issue
Block a user