Skip to content

DistributedRunner hangs when not calling XUnit.runtests #20

Description

@maleadt

MWE:

runtests.jl

using XUnit, Distributed

# add workers
exeflags = Base.julia_cmd()
push!(exeflags.exec, "--startup-file=no")
push!(exeflags.exec, "--project=$(Base.active_project())")
exename = popfirst!(exeflags.exec)
withenv("JULIA_NUM_THREADS" => 1, "OPENBLAS_NUM_THREADS" => 1) do
    addprocs(2; exename, exeflags)
end

@everywhere @testset runner=DistributedTestRunner() "WIP" begin
    @testcase "test1" begin
        @test true
    end

    @testcase "test2" begin
        @test true
    end

    @testcase "test3" begin
        @test true
    end

    @testcase "test4" begin
        @test true
    end
end

Instead using the following pattern works:

runtests.jl

using XUnit, Distributed

# add workers
exeflags = Base.julia_cmd()
push!(exeflags.exec, "--startup-file=no")
push!(exeflags.exec, "--project=$(Base.active_project())")
exename = popfirst!(exeflags.exec)
withenv("JULIA_NUM_THREADS" => 1, "OPENBLAS_NUM_THREADS" => 1) do
    addprocs(2; exename, exeflags)
end

@everywhere using XUnit
runtests("tests.jl")

tests.jl

using XUnit

@testset runner=DistributedTestRunner() "WIP" begin
    @testcase "test1" begin
        @test true
    end

    @testcase "test2" begin
        @test true
    end

    @testcase "test3" begin
        @test true
    end

    @testcase "test4" begin
        @test true
    end
end

I guess XUnit.runtests sets up some required state, but it's not clear to me whether that is intended? The README doesn't even mention XUnit.runtests...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions