Skip to content

Commit f452173

Browse files
KenoKristofferC
authored andcommitted
Don't detach rr workers in SharedArrays tests
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. (cherry picked from commit ccfbc90)
1 parent b6590d4 commit f452173

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

stdlib/SharedArrays/test/runtests.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
using Test, Distributed, SharedArrays, Random
44
include(joinpath(Sys.BINDIR, "..", "share", "julia", "test", "testenv.jl"))
55

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

911
@everywhere using Test, SharedArrays

test/testenv.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@ if !@isdefined(testenv_defined)
2626
const test_exename = popfirst!(test_exeflags.exec)
2727
end
2828

29-
addprocs_with_testenv(X; kwargs...) = addprocs(X; exename=test_exename, exeflags=test_exeflags, kwargs...)
29+
if haskey(ENV, "JULIA_RR")
30+
const rr_exename = `$(Base.shell_split(ENV["JULIA_RR"]))`
31+
else
32+
const rr_exename = ``
33+
end
34+
35+
function addprocs_with_testenv(X; rr_allowed=true, kwargs...)
36+
exename = rr_allowed ? `$rr_exename $test_exename` : test_exename
37+
addprocs(X; exename=exename, exeflags=test_exeflags, kwargs...)
38+
end
3039

3140
const curmod = @__MODULE__
3241
const curmod_name = fullname(curmod)

0 commit comments

Comments
 (0)