Skip to content

Commit

Permalink
Don't detach rr workers in SharedArrays tests
Browse files Browse the repository at this point in the history
By default, I'm having the test suite set up to put any workers spawned
with addprocs into their own rr sessions. This doesn't work with SharedArrays,
because those workers share memory with the main process. Add a new JULIA_RR
environment variable that specifies which rr to use for the test suite and
a flag to the testsuite's addprocs command to determine whether or not to
detach the workers from the current rr session.
  • Loading branch information
Keno committed Dec 19, 2020
1 parent 6ae3ded commit ccfbc90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion stdlib/SharedArrays/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
using Test, Distributed, SharedArrays, Random
include(joinpath(Sys.BINDIR, "..", "share", "julia", "test", "testenv.jl"))

addprocs_with_testenv(4)
# These processes explicitly want to share memory, we can't have
# them in separate rr sessions
addprocs_with_testenv(4; rr_allowed=false)
@test nprocs() == 5

@everywhere using Test, SharedArrays
Expand Down
11 changes: 10 additions & 1 deletion test/testenv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ if !@isdefined(testenv_defined)
const test_exename = popfirst!(test_exeflags.exec)
end

addprocs_with_testenv(X; kwargs...) = addprocs(X; exename=test_exename, exeflags=test_exeflags, kwargs...)
if haskey(ENV, "JULIA_RR")
const rr_exename = `$(Base.shell_split(ENV["JULIA_RR"]))`
else
const rr_exename = ``
end

function addprocs_with_testenv(X; rr_allowed=true, kwargs...)
exename = rr_allowed ? `$rr_exename $test_exename` : test_exename
addprocs(X; exename=exename, exeflags=test_exeflags, kwargs...)
end

const curmod = @__MODULE__
const curmod_name = fullname(curmod)
Expand Down

0 comments on commit ccfbc90

Please sign in to comment.