Boost logo

Boost-Commit :

From: jurko.gospodnetic_at_[hidden]
Date: 2008-01-08 09:40:24


Author: jurko
Date: 2008-01-08 09:40:24 EST (Tue, 08 Jan 2008)
New Revision: 42613
URL: http://svn.boost.org/trac/boost/changeset/42613

Log:
Added a new test making sure properties conditioned on multiple different feature values are handled correctly. This especially includes testing the case when one of those features is <toolset> and the value given for it includes a toolset version.
Added:
   trunk/tools/build/v2/test/conditionals_multiple.py (contents, props changed)
Text files modified:
   trunk/tools/build/v2/test/test_all.py | 1 +
   1 files changed, 1 insertions(+), 0 deletions(-)

Added: trunk/tools/build/v2/test/conditionals_multiple.py
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/conditionals_multiple.py 2008-01-08 09:40:24 EST (Tue, 08 Jan 2008)
@@ -0,0 +1,296 @@
+#!/usr/bin/python
+
+# Copyright 2008 Jurko Gospodnetic
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+# Tests that properties conditioned on more than one other property work as
+# expected.
+
+import BoostBuild
+
+
+################################################################################
+#
+# test_multiple_conditions()
+# --------------------------
+#
+################################################################################
+
+def test_multiple_conditions():
+ """Basic tests for properties conditioned on multiple other properties.
+ """
+
+ t = BoostBuild.Tester("--ignore-regular-config toolset=testToolset", pass_toolset=False, use_test_config=False)
+
+ t.write("testToolset.jam", """
+import feature ;
+feature.extend toolset : testToolset ;
+rule init ( ) { }
+""")
+
+ t.write("Jamroot.jam", """
+import feature ;
+import notfile ;
+import toolset ;
+
+feature.feature description : : free incidental ;
+feature.feature aaa : 1 0 : incidental ;
+feature.feature bbb : 1 0 : incidental ;
+feature.feature ccc : 1 0 : incidental ;
+
+rule buildRule ( name : targets ? : properties * )
+{
+ for local description in [ feature.get-values description : $(properties) ]
+ {
+ ECHO "description:" /$(description)/ ;
+ }
+}
+
+notfile testTarget1 : @buildRule : :
+ <description>d
+ <aaa>0:<description>a0
+ <aaa>1:<description>a1
+ <aaa>0,<bbb>0:<description>a0-b0
+ <aaa>0,<bbb>1:<description>a0-b1
+ <aaa>1,<bbb>0:<description>a1-b0
+ <aaa>1,<bbb>1:<description>a1-b1
+ <aaa>0,<bbb>0,<ccc>0:<description>a0-b0-c0
+ <aaa>0,<bbb>0,<ccc>1:<description>a0-b0-c1
+ <aaa>0,<bbb>1,<ccc>1:<description>a0-b1-c1
+ <aaa>1,<bbb>0,<ccc>1:<description>a1-b0-c1
+ <aaa>1,<bbb>1,<ccc>0:<description>a1-b1-c0
+ <aaa>1,<bbb>1,<ccc>1:<description>a1-b1-c1 ;
+""")
+
+ t.run_build_system("aaa=1 bbb=1 ccc=1")
+ t.expect_output_line("description: /d/" )
+ t.expect_output_line("description: /a0/" , False)
+ t.expect_output_line("description: /a1/" )
+ t.expect_output_line("description: /a0-b0/" , False)
+ t.expect_output_line("description: /a0-b1/" , False)
+ t.expect_output_line("description: /a1-b0/" , False)
+ t.expect_output_line("description: /a1-b1/" )
+ t.expect_output_line("description: /a0-b0-c0/", False)
+ t.expect_output_line("description: /a0-b0-c1/", False)
+ t.expect_output_line("description: /a0-b1-c1/", False)
+ t.expect_output_line("description: /a1-b0-c1/", False)
+ t.expect_output_line("description: /a1-b1-c0/", False)
+ t.expect_output_line("description: /a1-b1-c1/" )
+
+ t.run_build_system("aaa=0 bbb=0 ccc=1")
+ t.expect_output_line("description: /d/" )
+ t.expect_output_line("description: /a0/" )
+ t.expect_output_line("description: /a1/" , False)
+ t.expect_output_line("description: /a0-b0/" )
+ t.expect_output_line("description: /a0-b1/" , False)
+ t.expect_output_line("description: /a1-b0/" , False)
+ t.expect_output_line("description: /a1-b1/" , False)
+ t.expect_output_line("description: /a0-b0-c0/", False)
+ t.expect_output_line("description: /a0-b0-c1/" )
+ t.expect_output_line("description: /a0-b1-c1/", False)
+ t.expect_output_line("description: /a1-b0-c1/", False)
+ t.expect_output_line("description: /a1-b1-c0/", False)
+ t.expect_output_line("description: /a1-b1-c1/", False)
+
+ t.run_build_system("aaa=0 bbb=0 ccc=0")
+ t.expect_output_line("description: /d/" )
+ t.expect_output_line("description: /a0/" )
+ t.expect_output_line("description: /a1/" , False)
+ t.expect_output_line("description: /a0-b0/" )
+ t.expect_output_line("description: /a0-b1/" , False)
+ t.expect_output_line("description: /a1-b0/" , False)
+ t.expect_output_line("description: /a1-b1/" , False)
+ t.expect_output_line("description: /a0-b0-c0/" )
+ t.expect_output_line("description: /a0-b0-c1/", False)
+ t.expect_output_line("description: /a0-b1-c1/", False)
+ t.expect_output_line("description: /a1-b0-c1/", False)
+ t.expect_output_line("description: /a1-b1-c0/", False)
+ t.expect_output_line("description: /a1-b1-c1/", False)
+
+ t.cleanup()
+
+
+################################################################################
+#
+# test_multiple_conditions_with_toolset_version()
+# -----------------------------------------------
+#
+################################################################################
+
+def test_multiple_conditions_with_toolset_version():
+ """Regression tests for properties conditioned on the toolset version
+ subfeature and some additional properties.
+ """
+
+ toolset = "testToolset" ;
+
+ t = BoostBuild.Tester("--ignore-regular-config", pass_toolset=False, use_test_config=False)
+
+ t.write( toolset + ".jam", """
+import feature ;
+feature.extend toolset : %(toolset)s ;
+feature.subfeature toolset %(toolset)s : version : 0 1 ;
+rule init ( version ? ) { }
+""" % {"toolset": toolset})
+
+ t.write("Jamroot.jam", """
+import feature ;
+import notfile ;
+import toolset ;
+
+toolset.using testToolset ;
+
+feature.feature description : : free incidental ;
+feature.feature aaa : 0 1 : incidental ;
+feature.feature bbb : 0 1 : incidental ;
+feature.feature ccc : 0 1 : incidental ;
+
+rule buildRule ( name : targets ? : properties * )
+{
+ local ttt = [ feature.get-values toolset : $(properties) ] ;
+ local vvv = [ feature.get-values toolset-testToolset:version : $(properties) ] ;
+ local aaa = [ feature.get-values aaa : $(properties) ] ;
+ local bbb = [ feature.get-values bbb : $(properties) ] ;
+ local ccc = [ feature.get-values ccc : $(properties) ] ;
+ ECHO "toolset:" /$(ttt)/ "version:" /$(vvv)/ "aaa/bbb/ccc:" /$(aaa)/$(bbb)/$(ccc)/ ;
+ for local description in [ feature.get-values description : $(properties) ]
+ {
+ ECHO "description:" /$(description)/ ;
+ }
+}
+
+notfile testTarget1 : @buildRule : :
+ <toolset>testToolset,<aaa>0:<description>t-a0
+ <toolset>testToolset,<aaa>1:<description>t-a1
+
+ <toolset>testToolset-0,<aaa>0:<description>t0-a0
+ <toolset>testToolset-0,<aaa>1:<description>t0-a1
+ <toolset>testToolset-1,<aaa>0:<description>t1-a0
+ <toolset>testToolset-1,<aaa>1:<description>t1-a1
+
+ <toolset>testToolset,<aaa>0,<bbb>0:<description>t-a0-b0
+ <toolset>testToolset,<aaa>0,<bbb>1:<description>t-a0-b1
+ <toolset>testToolset,<aaa>1,<bbb>0:<description>t-a1-b0
+ <toolset>testToolset,<aaa>1,<bbb>1:<description>t-a1-b1
+
+ <aaa>0,<toolset>testToolset,<bbb>0:<description>a0-t-b0
+ <aaa>0,<toolset>testToolset,<bbb>1:<description>a0-t-b1
+ <aaa>1,<toolset>testToolset,<bbb>0:<description>a1-t-b0
+ <aaa>1,<toolset>testToolset,<bbb>1:<description>a1-t-b1
+
+ <aaa>0,<bbb>0,<toolset>testToolset:<description>a0-b0-t
+ <aaa>0,<bbb>1,<toolset>testToolset:<description>a0-b1-t
+ <aaa>1,<bbb>0,<toolset>testToolset:<description>a1-b0-t
+ <aaa>1,<bbb>1,<toolset>testToolset:<description>a1-b1-t
+
+ <toolset>testToolset-0,<aaa>0,<bbb>0:<description>t0-a0-b0
+ <toolset>testToolset-0,<aaa>0,<bbb>1:<description>t0-a0-b1
+ <toolset>testToolset-0,<aaa>1,<bbb>0:<description>t0-a1-b0
+ <toolset>testToolset-0,<aaa>1,<bbb>1:<description>t0-a1-b1
+ <toolset>testToolset-1,<aaa>0,<bbb>0:<description>t1-a0-b0
+ <toolset>testToolset-1,<aaa>0,<bbb>1:<description>t1-a0-b1
+ <toolset>testToolset-1,<aaa>1,<bbb>0:<description>t1-a1-b0
+ <toolset>testToolset-1,<aaa>1,<bbb>1:<description>t1-a1-b1
+
+ <aaa>0,<toolset>testToolset-1,<bbb>0:<description>a0-t1-b0
+ <aaa>0,<toolset>testToolset-1,<bbb>1:<description>a0-t1-b1
+ <aaa>1,<toolset>testToolset-0,<bbb>0:<description>a1-t0-b0
+ <aaa>1,<toolset>testToolset-0,<bbb>1:<description>a1-t0-b1
+
+ <bbb>0,<aaa>1,<toolset>testToolset-0:<description>b0-a1-t0
+ <bbb>0,<aaa>0,<toolset>testToolset-1:<description>b0-a0-t1
+ <bbb>0,<aaa>1,<toolset>testToolset-1:<description>b0-a1-t1
+ <bbb>1,<aaa>0,<toolset>testToolset-1:<description>b1-a0-t1
+ <bbb>1,<aaa>1,<toolset>testToolset-0:<description>b1-a1-t0
+ <bbb>1,<aaa>1,<toolset>testToolset-1:<description>b1-a1-t1 ;
+""")
+
+ t.run_build_system("aaa=1 bbb=1 ccc=1 toolset=%s-0" % toolset)
+ t.expect_output_line("description: /t-a0/" , False)
+ t.expect_output_line("description: /t-a1/" )
+ t.expect_output_line("description: /t0-a0/" , False)
+ t.expect_output_line("description: /t0-a1/" )
+ t.expect_output_line("description: /t1-a0/" , False)
+ t.expect_output_line("description: /t1-a1/" , False)
+ t.expect_output_line("description: /t-a0-b0/" , False)
+ t.expect_output_line("description: /t-a0-b1/" , False)
+ t.expect_output_line("description: /t-a1-b0/" , False)
+ t.expect_output_line("description: /t-a1-b1/" )
+ t.expect_output_line("description: /a0-t-b0/" , False)
+ t.expect_output_line("description: /a0-t-b1/" , False)
+ t.expect_output_line("description: /a1-t-b0/" , False)
+ t.expect_output_line("description: /a1-t-b1/" )
+ t.expect_output_line("description: /a0-b0-t/" , False)
+ t.expect_output_line("description: /a0-b1-t/" , False)
+ t.expect_output_line("description: /a1-b0-t/" , False)
+ t.expect_output_line("description: /a1-b1-t/" )
+ t.expect_output_line("description: /t0-a0-b0/", False)
+ t.expect_output_line("description: /t0-a0-b1/", False)
+ t.expect_output_line("description: /t0-a1-b0/", False)
+ t.expect_output_line("description: /t0-a1-b1/" )
+ t.expect_output_line("description: /t1-a0-b0/", False)
+ t.expect_output_line("description: /t1-a0-b1/", False)
+ t.expect_output_line("description: /t1-a1-b0/", False)
+ t.expect_output_line("description: /t1-a1-b1/", False)
+ t.expect_output_line("description: /a0-t1-b0/", False)
+ t.expect_output_line("description: /a0-t1-b1/", False)
+ t.expect_output_line("description: /a1-t0-b0/", False)
+ t.expect_output_line("description: /a1-t0-b1/", False)
+ t.expect_output_line("description: /b0-a1-t0/", False)
+ t.expect_output_line("description: /b0-a0-t1/", False)
+ t.expect_output_line("description: /b0-a1-t1/", False)
+ t.expect_output_line("description: /b1-a0-t1/", False)
+ t.expect_output_line("description: /b1-a1-t0/" )
+ t.expect_output_line("description: /b1-a1-t1/", False)
+
+ t.run_build_system("aaa=1 bbb=1 ccc=1 toolset=%s-1" % toolset)
+ t.expect_output_line("description: /t-a0/" , False)
+ t.expect_output_line("description: /t-a1/" )
+ t.expect_output_line("description: /t0-a0/" , False)
+ t.expect_output_line("description: /t0-a1/" , False)
+ t.expect_output_line("description: /t1-a0/" , False)
+ t.expect_output_line("description: /t1-a1/" )
+ t.expect_output_line("description: /t-a0-b0/" , False)
+ t.expect_output_line("description: /t-a0-b1/" , False)
+ t.expect_output_line("description: /t-a1-b0/" , False)
+ t.expect_output_line("description: /t-a1-b1/" )
+ t.expect_output_line("description: /a0-t-b0/" , False)
+ t.expect_output_line("description: /a0-t-b1/" , False)
+ t.expect_output_line("description: /a1-t-b0/" , False)
+ t.expect_output_line("description: /a1-t-b1/" )
+ t.expect_output_line("description: /a0-b0-t/" , False)
+ t.expect_output_line("description: /a0-b1-t/" , False)
+ t.expect_output_line("description: /a1-b0-t/" , False)
+ t.expect_output_line("description: /a1-b1-t/" )
+ t.expect_output_line("description: /t0-a0-b0/", False)
+ t.expect_output_line("description: /t0-a0-b1/", False)
+ t.expect_output_line("description: /t0-a1-b0/", False)
+ t.expect_output_line("description: /t0-a1-b1/", False)
+ t.expect_output_line("description: /t1-a0-b0/", False)
+ t.expect_output_line("description: /t1-a0-b1/", False)
+ t.expect_output_line("description: /t1-a1-b0/", False)
+ t.expect_output_line("description: /t1-a1-b1/" )
+ t.expect_output_line("description: /a0-t1-b0/", False)
+ t.expect_output_line("description: /a0-t1-b1/", False)
+ t.expect_output_line("description: /a1-t0-b0/", False)
+ t.expect_output_line("description: /a1-t0-b1/", False)
+ t.expect_output_line("description: /b0-a1-t0/", False)
+ t.expect_output_line("description: /b0-a0-t1/", False)
+ t.expect_output_line("description: /b0-a1-t1/", False)
+ t.expect_output_line("description: /b1-a0-t1/", False)
+ t.expect_output_line("description: /b1-a1-t0/", False)
+ t.expect_output_line("description: /b1-a1-t1/" )
+
+ t.cleanup()
+
+
+################################################################################
+#
+# main()
+# ------
+#
+################################################################################
+
+test_multiple_conditions()
+test_multiple_conditions_with_toolset_version()

Modified: trunk/tools/build/v2/test/test_all.py
==============================================================================
--- trunk/tools/build/v2/test/test_all.py (original)
+++ trunk/tools/build/v2/test/test_all.py 2008-01-08 09:40:24 EST (Tue, 08 Jan 2008)
@@ -109,6 +109,7 @@
           "conditionals",
           "conditionals2",
           "conditionals3",
+ "conditionals_multiple",
           "configuration",
           "indirect_conditional",
           "stage",


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