Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79718 - trunk/tools/build/v2/test
From: jurko.gospodnetic_at_[hidden]
Date: 2012-07-24 05:44:30


Author: jurko
Date: 2012-07-24 05:44:29 EDT (Tue, 24 Jul 2012)
New Revision: 79718
URL: http://svn.boost.org/trac/boost/changeset/79718

Log:
Cleaned up the internal Boost Build indirect_conditional.py test and updated it to test the project context under which indirect conditionals are run (using the glob rule).
Text files modified:
   trunk/tools/build/v2/test/indirect_conditional.py | 79 +++++++++++++++++++++++++--------------
   1 files changed, 51 insertions(+), 28 deletions(-)

Modified: trunk/tools/build/v2/test/indirect_conditional.py
==============================================================================
--- trunk/tools/build/v2/test/indirect_conditional.py (original)
+++ trunk/tools/build/v2/test/indirect_conditional.py 2012-07-24 05:44:29 EDT (Tue, 24 Jul 2012)
@@ -1,17 +1,17 @@
 #!/usr/bin/python
 
-# Copyright (C) Vladimir Prus 2006.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
+# Copyright (C) 2006. Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)
 
 import BoostBuild
 
-t = BoostBuild.Tester()
+def test_basic():
+ t = BoostBuild.Tester()
 
-t.write("jamroot.jam", """
+ t.write("jamroot.jam", """\
 exe a1 : a1.cpp : <conditional>@a1-rule ;
-
 rule a1-rule ( properties * )
 {
     if <variant>debug in $(properties)
@@ -22,7 +22,6 @@
 
 exe a2 : a2.cpp : <conditional>@$(__name__).a2-rule
     <variant>debug:<optimization>speed ;
-
 rule a2-rule ( properties * )
 {
     if <optimization>speed in $(properties)
@@ -31,9 +30,9 @@
     }
 }
 
-exe a3 : a3.cpp : <conditional>@$(__name__).a3-rule-1
+exe a3 : a3.cpp :
+ <conditional>@$(__name__).a3-rule-1
     <conditional>@$(__name__).a3-rule-2 ;
-
 rule a3-rule-1 ( properties * )
 {
     if <optimization>speed in $(properties)
@@ -41,7 +40,6 @@
         return <define>OK ;
     }
 }
-
 rule a3-rule-2 ( properties * )
 {
     if <variant>debug in $(properties)
@@ -51,28 +49,53 @@
 }
 """)
 
-t.write("a1.cpp", """
-#ifdef OK
-int main() {}
-#endif
-""")
+ t.write("a1.cpp", "#ifdef OK\nint main() {}\n#endif\n")
+ t.write("a2.cpp", "#ifdef OK\nint main() {}\n#endif\n")
+ t.write("a3.cpp", "#ifdef OK\nint main() {}\n#endif\n")
 
-t.write("a2.cpp", """
-#ifdef OK
-int main() {}
-#endif
-""")
+ t.run_build_system()
+
+ t.expect_addition("bin/$toolset/debug/a1.exe")
+ t.expect_addition("bin/$toolset/debug/optimization-speed/a2.exe")
+ t.expect_addition("bin/$toolset/debug/optimization-speed/a3.exe")
 
-t.write("a3.cpp", """
-#ifdef OK
-int main() {}
+ t.cleanup()
+
+
+def test_glob_in_indirect_conditional():
+ """
+ Regression test: glob run inside an indirect conditional should work in
+ the correct project context, i.e. in the correct folder.
+
+ """
+ t = BoostBuild.Tester()
+
+ t.write("jamroot.jam", """\
+use-project /library-example/foo : util/foo ;
+build-project app ;
+""")
+ t.write("app/app.cpp", "int main() {}\n");
+ t.write("app/jamfile.jam", "exe app : app.cpp /library-example/foo//bar ;")
+ t.write("util/foo/bar.cpp", """\
+#ifdef _WIN32
+__declspec(dllexport)
 #endif
+void foo() {}
 """)
+ t.write("util/foo/jamfile.jam", """\
+rule print-my-sources ( properties * )
+{
+ ECHO My sources: ;
+ ECHO [ glob *.cpp ] ;
+}
+lib bar : bar.cpp : <conditional>@print-my-sources ;
+""")
+
+ t.run_build_system()
+ t.expect_output_lines("My sources:\nbar.cpp")
 
-t.run_build_system()
+ t.cleanup()
 
-t.expect_addition("bin/$toolset/debug/a1.exe")
-t.expect_addition("bin/$toolset/debug/optimization-speed/a2.exe")
-t.expect_addition("bin/$toolset/debug/optimization-speed/a3.exe")
 
-t.cleanup()
+test_basic()
+test_glob_in_indirect_conditional()


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