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

Function test_user_configuration

v2/test/configuration.py:24–227  ·  view source on GitHub ↗

Test Boost Build user configuration handling. Both relative and absolute path handling is tested.

()

Source from the content-addressed store, hash-verified

22###############################################################################
23
24def test_user_configuration():
25 """
26 Test Boost Build user configuration handling. Both relative and absolute
27 path handling is tested.
28
29 """
30
31 implicitConfigLoadMessage = \
32 "notice: Loading user-config configuration file: *"
33 explicitConfigLoadMessage = \
34 "notice: Loading explicitly specified user configuration file:"
35 disabledConfigLoadMessage = \
36 "notice: User configuration file loading explicitly disabled."
37 testMessage = "_!_!_!_!_!_!_!_!_ %s _!_!_!_!_!_!_!_!_"
38 toolsetName = "__myDummyToolset__"
39 subdirName = "ASubDirectory"
40 configFileNames = ["ups_lala_1.jam", "ups_lala_2.jam",
41 os.path.join(subdirName, "ups_lala_3.jam")]
42
43 t = BoostBuild.Tester(["toolset=%s" % toolsetName,
44 "--debug-configuration"], pass_toolset=False, use_test_config=False)
45
46 for configFileName in configFileNames:
47 message = "ECHO \"%s\" ;" % testMessage % configFileName
48 # We need to double any backslashes in the message or Jam will
49 # interpret them as escape characters.
50 t.write(configFileName, message.replace("\\", "\\\\"))
51
52 # Prepare a dummy toolset so we do not get errors in case the default one
53 # is not found.
54 t.write(toolsetName + ".jam", """\
55import feature ;
56feature.extend toolset : %s ;
57rule init ( ) { }
58""" % toolsetName)
59
60 # Python version of the same dummy toolset.
61 t.write(toolsetName + ".py", """\
62from b2.build import feature
63feature.extend('toolset', ['%s'])
64def init(): pass
65""" % toolsetName)
66
67 t.write("jamroot.jam", """\
68local test-index = [ MATCH ---test-id---=(.*) : [ modules.peek : ARGV ] ] ;
69ECHO test-index: $(test-index:E=(unknown)) ;
70""")
71
72 class LocalTester:
73 def __init__(self, tester):
74 self.__tester = tester
75 self.__test_ids = []
76
77 def __assertionFailure(self, message):
78 BoostBuild.annotation("failure", "Internal test assertion failure "
79 "- %s" % message)
80 self.__tester.fail_test(1)
81

Callers 1

configuration.pyFile · 0.85

Calls 5

writeMethod · 0.95
expect_output_linesMethod · 0.95
cleanupMethod · 0.95
LocalTesterClass · 0.85
testFunction · 0.70

Tested by

no test coverage detected