Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80093 - in trunk/tools/build/v2/test: . unused
From: jurko.gospodnetic_at_[hidden]
Date: 2012-08-20 08:29:36


Author: jurko
Date: 2012-08-20 08:29:36 EDT (Mon, 20 Aug 2012)
New Revision: 80093
URL: http://svn.boost.org/trac/boost/changeset/80093

Log:
Internal Boost Build unused.py test cleanup - corrected a buggy check for target's usage reguirements being propagated even when it generates no virtual targets, inlined all the used test code into the test script so it no longer relies on any external files, now reporting more detailed compiler error messages in case of a failed compilation test without having to explicitly specify the --verbose command-line option.
Removed:
   trunk/tools/build/v2/test/unused/
Text files modified:
   trunk/tools/build/v2/test/unused.py | 63 ++++++++++++++++++++++++++++++++++++---
   1 files changed, 58 insertions(+), 5 deletions(-)

Modified: trunk/tools/build/v2/test/unused.py
==============================================================================
--- trunk/tools/build/v2/test/unused.py (original)
+++ trunk/tools/build/v2/test/unused.py 2012-08-20 08:29:36 EDT (Mon, 20 Aug 2012)
@@ -9,10 +9,57 @@
 
 import BoostBuild
 
-t = BoostBuild.Tester()
-t.set_tree("unused")
+t = BoostBuild.Tester(["-d+2"])
+
+t.write("a.cpp", "int main() {}\n")
+t.write("b.cpp", "\n")
+t.write("b.x", "")
+t.write("jamroot.jam", """\
+import "class" : new ;
+import modules ;
+import project ;
+import targets ;
+import type ;
+import virtual-target ;
+
+type.register X : x ;
+
+class test-target-class : basic-target
+{
+ rule construct ( name : source-targets * : property-set )
+ {
+ local result = [ property-set.empty ] ;
+ if ! [ modules.peek : GENERATE_NOTHING ]
+ {
+ result += [ virtual-target.from-file b.x : . : $(self.project) ] ;
+ if ! [ modules.peek : GENERATE_ONLY_UNUSABLE ]
+ {
+ result += [ virtual-target.from-file b.cpp : . : $(self.project)
+ ] ;
+ }
+ }
+ return $(result) ;
+ }
+
+ rule compute-usage-requirements ( rproperties : targets * )
+ {
+ return [ property-set.create <define>FOO ] ;
+ }
+}
+
+rule make-b-main-target
+{
+ local project = [ project.current ] ;
+ targets.main-target-alternative [ new test-target-class b : $(project) ] ;
+}
+
+exe a : a.cpp b c ;
+make-b-main-target ;
+alias c ; # Expands to nothing, intentionally.
+""")
 
 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 a warning was issued or not.
@@ -20,9 +67,15 @@
 
 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.
-t.write("a.cpp", "int main() {}\n")
+# Check that even if main target generates nothing, its usage requirements are
+# still propagated to dependants.
+t.write("a.cpp", """\
+#ifndef FOO
+ #error We refuse to compile without FOO being defined!
+ We_refuse_to_compile_without_FOO_being_defined
+#endif
+int main() {}
+""")
 t.run_build_system(["-sGENERATE_NOTHING=1"])
 
 t.cleanup()


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk