MCPcopy Create free account
hub / github.com/boostorg/build / test_conditions_on_default_toolset

Function test_conditions_on_default_toolset

v2/test/default_toolset.py:32–105  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

30###############################################################################
31
32def 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", """
50import feature ;
51ECHO "%(message_loaded)s" ;
52feature.extend toolset : %(toolset_name)s ;
53feature.subfeature toolset %(toolset_name)s : version : %(toolset_version)s %(toolset_version_unused)s ;
54rule 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", """
63import build-system ;
64import errors ;
65import feature ;
66import notfile ;
67
68build-system.set-default-toolset %(toolset_name)s : %(toolset_version)s ;
69
70feature.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.
74rule 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
84notfile testTarget
85 : @buildRule
86 :
87 :
88 <description>stand-alone
89 <toolset>%(toolset_name)s:<description>toolset

Callers 1

default_toolset.pyFile · 0.85

Calls 4

writeMethod · 0.95
run_build_systemMethod · 0.95
expect_output_linesMethod · 0.95
cleanupMethod · 0.95

Tested by

no test coverage detected