Skip to content

Commit e57bd11

Browse files
Revert "make excluded threadunsafe tests threadsafe"
This reverts commit 17441cc.
1 parent 30fa8b1 commit e57bd11

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

test/distributed_exec.jl

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@ function _getenv_include_thread_unsafe()
159159
return b
160160
end
161161
const _env_include_thread_unsafe = _getenv_include_thread_unsafe()
162+
function include_thread_unsafe_tests()
163+
if Threads.maxthreadid() > 1
164+
if _env_include_thread_unsafe
165+
return true
166+
end
167+
msg = "Skipping a thread-unsafe test because `Threads.maxthreadid() > 1`"
168+
@warn msg Threads.maxthreadid()
169+
Test.@test_broken false
170+
return false
171+
end
172+
return true
173+
end
162174

163175
# Distributed GC tests for Futures
164176
function test_futures_dgc(id)
@@ -282,14 +294,16 @@ let wid1 = workers()[1],
282294
fstore = RemoteChannel(wid2)
283295

284296
put!(fstore, rr)
285-
# timedwait() is necessary because wid1 is asynchronously informed of
286-
# the existence of rr/rrid through the call to `put!(fstore, rr)`.
287-
@test timedwait(() -> remotecall_fetch(k -> haskey(Distributed.PGRP.refs, k), wid1, rrid), 10) === :ok
288-
297+
if include_thread_unsafe_tests()
298+
# timedwait() is necessary because wid1 is asynchronously informed of
299+
# the existence of rr/rrid through the call to `put!(fstore, rr)`.
300+
@test timedwait(() -> remotecall_fetch(k -> haskey(Distributed.PGRP.refs, k), wid1, rrid), 10) === :ok
301+
end
289302
finalize(rr) # finalize locally
290303
yield() # flush gc msgs
291-
@test timedwait(() -> remotecall_fetch(k -> haskey(Distributed.PGRP.refs, k), wid1, rrid), 10) === :ok
292-
304+
if include_thread_unsafe_tests()
305+
@test remotecall_fetch(k -> haskey(Distributed.PGRP.refs, k), wid1, rrid) == true
306+
end
293307
remotecall_fetch(r -> (finalize(take!(r)); yield(); nothing), wid2, fstore) # finalize remotely
294308
sleep(0.5) # to ensure that wid2 messages have been executed on wid1
295309
@test poll_while(() -> remotecall_fetch(k -> haskey(Distributed.PGRP.refs, k), wid1, rrid))

0 commit comments

Comments
 (0)