Test that toolset and toolset subfeature conditioned properties get applied correctly when the toolset is selected by default. Implicitly tests that we can use the set-default-toolset rule to set the default toolset to be used by Boost Build.
()
| 30 | ############################################################################### |
| 31 | |
| 32 | def test_conditions_on_default_toolset(): |
| 33 | """Test that toolset and toolset subfeature conditioned properties get |
| 34 | applied correctly when the toolset is selected by default. Implicitly tests |
| 35 | that we can use the set-default-toolset rule to set the default toolset to |
| 36 | be used by Boost Build. |
| 37 | """ |
| 38 | |
| 39 | t = BoostBuild.Tester("--user-config= --ignore-site-config", |
| 40 | pass_toolset=False, use_test_config=False) |
| 41 | |
| 42 | toolset_name = "myCustomTestToolset" |
| 43 | toolset_version = "v" |
| 44 | toolset_version_unused = "v_unused" |
| 45 | message_loaded = "Toolset '%s' loaded." % toolset_name |
| 46 | message_initialized = "Toolset '%s' initialized." % toolset_name ; |
| 47 | |
| 48 | # Custom toolset. |
| 49 | t.write(toolset_name + ".jam", """ |
| 50 | import feature ; |
| 51 | ECHO "%(message_loaded)s" ; |
| 52 | feature.extend toolset : %(toolset_name)s ; |
| 53 | feature.subfeature toolset %(toolset_name)s : version : %(toolset_version)s %(toolset_version_unused)s ; |
| 54 | rule init ( version ) { ECHO "%(message_initialized)s" ; } |
| 55 | """ % {'message_loaded' : message_loaded , |
| 56 | 'message_initialized' : message_initialized, |
| 57 | 'toolset_name' : toolset_name , |
| 58 | 'toolset_version' : toolset_version , |
| 59 | 'toolset_version_unused': toolset_version_unused}) |
| 60 | |
| 61 | # Main Boost Build project script. |
| 62 | t.write("jamroot.jam", """ |
| 63 | import build-system ; |
| 64 | import errors ; |
| 65 | import feature ; |
| 66 | import notfile ; |
| 67 | |
| 68 | build-system.set-default-toolset %(toolset_name)s : %(toolset_version)s ; |
| 69 | |
| 70 | feature.feature description : : free incidental ; |
| 71 | |
| 72 | # We use a rule instead of an action to avoid problems with action output not |
| 73 | # getting piped to stdout by the testing system. |
| 74 | rule buildRule ( names : targets ? : properties * ) |
| 75 | { |
| 76 | local descriptions = [ feature.get-values description : $(properties) ] ; |
| 77 | ECHO "descriptions:" /$(descriptions)/ ; |
| 78 | local toolset = [ feature.get-values toolset : $(properties) ] ; |
| 79 | ECHO "toolset:" /$(toolset)/ ; |
| 80 | local toolset-version = [ feature.get-values "toolset-$(toolset):version" : $(properties) ] ; |
| 81 | ECHO "toolset-version:" /$(toolset-version)/ ; |
| 82 | } |
| 83 | |
| 84 | notfile testTarget |
| 85 | : @buildRule |
| 86 | : |
| 87 | : |
| 88 | <description>stand-alone |
| 89 | <toolset>%(toolset_name)s:<description>toolset |
no test coverage detected