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.
()
| 244 | |
| 245 | |
| 246 | def 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 = """\ |
| 272 | import type ; |
| 273 | type.register AAA : _a ; |
| 274 | type.register BB1 : _b1 ; |
| 275 | type.register BB2 : _b2 ; |
| 276 | type.register BB3 : _b3 ; |
| 277 | type.register CCC : _c ; |
| 278 | type.register DDD : _d ; |
| 279 | |
| 280 | import appender ; |
| 281 | appender.register aaa-to-bbX : AAA : BB1%s BB2%s BB3%s ; |
| 282 | appender.register bbX-to-ccc : BB1 BB2 BB3 : CCC ; |
| 283 | appender.register ccc-to-ddd composing : CCC : DDD ; |
| 284 | |
| 285 | ddd _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") |
no test coverage detected