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

Function test_generated_target_names

v2/test/generators_test.py:246–331  ·  view source on GitHub ↗

Test generator generated target names. Unless given explicitly, target names should be determined based on their specified source names. All sources for generating a target need to have matching names in order for Boost Build to be able to implicitly determine the target's name.

()

Source from the content-addressed store, hash-verified

244
245
246def test_generated_target_names():
247 """
248 Test generator generated target names. Unless given explicitly, target
249 names should be determined based on their specified source names. All
250 sources for generating a target need to have matching names in order for
251 Boost Build to be able to implicitly determine the target's name.
252
253 We use the following target generation structure with differently named
254 BBX targets:
255 /---> BB1 ---\
256 AAA --<----> BB2 ---->--> CCC --(composing)--> DDD
257 \---> BB3 ---/
258
259 The extra generator at the end is needed because generating a top-level
260 CCC target directly would requires us to explicitly specify a name for it.
261 The extra generator needs to be composing in order not to explicitly
262 request a specific name for its CCC source target based on its own target
263 name.
264
265 We also check for a regression where only the first two sources were
266 checked to see if their names match. Note that we need to try out all file
267 renaming combinations as we do not know what ordering Boost Build is going
268 to use when passing in those files as generator sources.
269
270 """
271 jamfile_template = """\
272import type ;
273type.register AAA : _a ;
274type.register BB1 : _b1 ;
275type.register BB2 : _b2 ;
276type.register BB3 : _b3 ;
277type.register CCC : _c ;
278type.register DDD : _d ;
279
280import appender ;
281appender.register aaa-to-bbX : AAA : BB1%s BB2%s BB3%s ;
282appender.register bbX-to-ccc : BB1 BB2 BB3 : CCC ;
283appender.register ccc-to-ddd composing : CCC : DDD ;
284
285ddd _xxx : _xxx._a ;
286"""
287
288 t = BoostBuild.Tester(pass_d0=False)
289 __write_appender(t, "appender.jam")
290 t.write("_xxx._a", "")
291
292 def test_one(t, rename1, rename2, rename3, status):
293 def f(rename):
294 if rename: return "(%_x)"
295 return ""
296
297 jamfile = jamfile_template % (f(rename1), f(rename2), f(rename3))
298 t.write("jamroot.jam", jamfile, wait=False)
299
300 # Remove any preexisting targets left over from a previous test run
301 # so we do not have to be careful about tracking which files have been
302 # newly added and which preexisting ones have only been modified.
303 t.rm("bin")

Callers 1

generators_test.pyFile · 0.85

Calls 4

writeMethod · 0.95
cleanupMethod · 0.95
test_oneFunction · 0.85
__write_appenderFunction · 0.70

Tested by

no test coverage detected