Skip to content

Commit

Permalink
Distributed test suite: wrap another thread-unsafe test in `poll_wh…
Browse files Browse the repository at this point in the history
…ile` (#45037)
  • Loading branch information
DilumAluthge authored Apr 21, 2022
1 parent 4340d23 commit 4dfef57
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions stdlib/Distributed/test/distributed_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function _getenv_include_thread_unsafe()
return b
end
const _env_include_thread_unsafe = _getenv_include_thread_unsafe()
function include_thread_unsafe()
function include_thread_unsafe_tests()
if Threads.nthreads() > 1
if _env_include_thread_unsafe
return true
Expand Down Expand Up @@ -260,8 +260,7 @@ remotecall_fetch(f25847, id_other, f)

finalize(f)
yield() # flush gc msgs
@test false == remotecall_fetch(chk_rrid->(yield(); haskey(Distributed.PGRP.refs, chk_rrid)), id_other, rrid)

@test poll_while(() -> remotecall_fetch(chk_rrid->(yield(); haskey(Distributed.PGRP.refs, chk_rrid)), id_other, rrid))

# Distributed GC tests for RemoteChannels
function test_remoteref_dgc(id)
Expand All @@ -288,12 +287,12 @@ let wid1 = workers()[1],
fstore = RemoteChannel(wid2)

put!(fstore, rr)
if include_thread_unsafe()
if include_thread_unsafe_tests()
@test remotecall_fetch(k -> haskey(Distributed.PGRP.refs, k), wid1, rrid) == true
end
finalize(rr) # finalize locally
yield() # flush gc msgs
if include_thread_unsafe()
if include_thread_unsafe_tests()
@test remotecall_fetch(k -> haskey(Distributed.PGRP.refs, k), wid1, rrid) == true
end
remotecall_fetch(r -> (finalize(take!(r)); yield(); nothing), wid2, fstore) # finalize remotely
Expand Down

0 comments on commit 4dfef57

Please sign in to comment.