|
315 | 315 | P("x86_64", "linux"; libgfortran_version=v"5") => "linux8",
|
316 | 316 |
|
317 | 317 | # Ambiguity test
|
318 |
| - P("aarch64", "linux"; libgfortran_version=v"3") => "linux4", |
| 318 | + P("aarch64", "linux"; libgfortran_version=v"3") => "linux3", |
319 | 319 | P("aarch64", "linux"; libgfortran_version=v"3", libstdcxx_version=v"3.4.18") => "linux5",
|
| 320 | + P("aarch64", "linux"; libgfortran_version=v"3", libstdcxx_version=v"3.4.18", foo="bar") => "linux9", |
320 | 321 |
|
321 | 322 | # OS test
|
322 | 323 | P("x86_64", "macos"; libgfortran_version=v"3") => "mac4",
|
|
327 | 328 | @test select_platform(platforms, P("x86_64", "linux"; libgfortran_version=v"4")) == "linux7"
|
328 | 329 |
|
329 | 330 | # Ambiguity test
|
330 |
| - @test select_platform(platforms, P("aarch64", "linux")) == "linux5" |
331 |
| - @test select_platform(platforms, P("aarch64", "linux"; libgfortran_version=v"3")) == "linux5" |
| 331 | + @test select_platform(platforms, P("aarch64", "linux")) == "linux3" |
| 332 | + @test select_platform(platforms, P("aarch64", "linux"; libgfortran_version=v"3")) == "linux3" |
| 333 | + # This one may be surprising, but we still match `linux3`, and since linux3 is shorter, we choose it. |
| 334 | + @test select_platform(platforms, P("aarch64", "linux"; libgfortran_version=v"3", libstdcxx_version=v"3.4.18")) === "linux3" |
332 | 335 | @test select_platform(platforms, P("aarch64", "linux"; libgfortran_version=v"4")) === nothing
|
333 | 336 |
|
334 | 337 | @test select_platform(platforms, P("x86_64", "macos")) == "mac4"
|
|
339 | 342 |
|
340 | 343 | # Sorry, Alex. ;)
|
341 | 344 | @test select_platform(platforms, P("x86_64", "freebsd")) === nothing
|
| 345 | + |
| 346 | + # The new "prefer shortest matching" algorithm is meant to be used to resolve ambiguities such as the following: |
| 347 | + platforms = Dict( |
| 348 | + # Typical binning test |
| 349 | + P("x86_64", "linux") => "good", |
| 350 | + P("x86_64", "linux"; sanitize="memory") => "bad", |
| 351 | + ) |
| 352 | + @test select_platform(platforms, P("x86_64", "linux")) == "good" |
342 | 353 | end
|
343 | 354 |
|
344 | 355 | @testset "Custom comparators" begin
|
|
0 commit comments