diff --git a/test/test_all.py b/test/test_all.py index 195dea29a..1b2ae3645 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -213,6 +213,7 @@ tests = [ "absolute_sources", "testing_support", "timedata", "unit_test", + "unused", "use_requirements", "using", "wrapper", diff --git a/test/unused.py b/test/unused.py index 9db2380cd..b44320c52 100644 --- a/test/unused.py +++ b/test/unused.py @@ -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. diff --git a/test/unused/jamroot.jam b/test/unused/jamroot.jam index 75832afd2..bc97c2b19 100644 --- a/test/unused/jamroot.jam +++ b/test/unused/jamroot.jam @@ -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) ] ;