|
527 | 527 | @test i386_at !== nothing && setup_at !== nothing && first(i386_at) < first(setup_at) |
528 | 528 | end |
529 | 529 |
|
| 530 | +@testset "Linux x86 PoCL worker limit" begin |
| 531 | + workflows = joinpath(@__DIR__, "..", ".github", "workflows") |
| 532 | + tests = read(joinpath(workflows, "tests.yml"), String) |
| 533 | + grouped = read(joinpath(workflows, "grouped-tests.yml"), String) |
| 534 | + input = r"(?m)^ linux-x86-pocl-workers:\n(?: [^\n]*\n)*? default: 0\n" |
| 535 | + @test occursin(input, tests) |
| 536 | + @test occursin(input, grouped) |
| 537 | + @test occursin("linux-x86-pocl-workers: \${{ inputs.linux-x86-pocl-workers }}", grouped) |
| 538 | + |
| 539 | + step = match(r"(?ms)^ - name: \"Configure PoCL workers for 32-bit Linux\"\n(.*?)^ - ", tests) |
| 540 | + @test step !== nothing |
| 541 | + if step !== nothing |
| 542 | + @test step.offset < first(findfirst("uses: julia-actions/setup-julia", tests)) |
| 543 | + @test occursin("inputs.linux-x86-pocl-workers != 0 && runner.os == 'Linux'", step.match) |
| 544 | + @test occursin("""contains(fromJSON('["x86", "i686"]'), inputs.julia-arch || runner.arch)""", step.match) |
| 545 | + shell = last(split(step.captures[1], " run: |\n"; limit = 2)) |
| 546 | + settings = ("POCL_CPU_MAX_CU_COUNT", "POCL_MAX_PTHREAD_COUNT", "POCL_MAX_COMPUTE_UNITS", "JULIA_KA_CPU_THREADS") |
| 547 | + function configure(limit, overrides...) |
| 548 | + return mktemp() do file, io |
| 549 | + close(io) |
| 550 | + env = Dict(k => v for (k, v) in ENV if k ∉ settings) |
| 551 | + merge!(env, Dict("GITHUB_ENV" => file, "POCL_WORKERS" => limit), Dict(overrides...)) |
| 552 | + cmd = setenv(`bash -eu -c $shell`, env) |
| 553 | + ok = success(pipeline(cmd; stdout = devnull, stderr = devnull)) |
| 554 | + return ok, read(file, String) |
| 555 | + end |
| 556 | + end |
| 557 | + @test configure("2") == (true, "POCL_CPU_MAX_CU_COUNT=2\n") |
| 558 | + for setting in settings |
| 559 | + @test configure("2", setting => "5") == (true, "") |
| 560 | + end |
| 561 | + for invalid in ("-1", "1.5", "2147483648") |
| 562 | + @test configure(invalid) == (false, "") |
| 563 | + end |
| 564 | + end |
| 565 | +end |
| 566 | + |
530 | 567 | # develop_sources.jl: the [sources] develop helper used by tests.yml on Julia |
531 | 568 | # <1.11. The pure path-collection (collect_source_paths) is tested here without |
532 | 569 | # mutating any environment. |
|
0 commit comments