Skip to content

Commit c09b034

Browse files
IanButterworthJamesWrigley
authored andcommitted
enable excluded threadunsafe tests
1 parent 3da81c6 commit c09b034

File tree

1 file changed

+8
-29
lines changed

1 file changed

+8
-29
lines changed

test/distributed_exec.jl

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -151,27 +151,6 @@ function poll_while(f::Function; timeout_seconds::Integer = 120)
151151
return true
152152
end
153153

154-
function _getenv_include_thread_unsafe()
155-
environment_variable_name = "JULIA_TEST_INCLUDE_THREAD_UNSAFE"
156-
default_value = "false"
157-
environment_variable_value = strip(get(ENV, environment_variable_name, default_value))
158-
b = parse(Bool, environment_variable_value)::Bool
159-
return b
160-
end
161-
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
174-
175154
# Distributed GC tests for Futures
176155
function test_futures_dgc(id)
177156
f = remotecall(myid, id)
@@ -294,16 +273,16 @@ let wid1 = workers()[1],
294273
fstore = RemoteChannel(wid2)
295274

296275
put!(fstore, rr)
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
276+
277+
# timedwait() is necessary because wid1 is asynchronously informed of
278+
# the existence of rr/rrid through the call to `put!(fstore, rr)`.
279+
@test timedwait(() -> remotecall_fetch(k -> haskey(Distributed.PGRP.refs, k), wid1, rrid), 10) === :ok
280+
302281
finalize(rr) # finalize locally
303282
yield() # flush gc msgs
304-
if include_thread_unsafe_tests()
305-
@test remotecall_fetch(k -> haskey(Distributed.PGRP.refs, k), wid1, rrid) == true
306-
end
283+
284+
@test timedwait(() -> remotecall_fetch(k -> haskey(Distributed.PGRP.refs, k), wid1, rrid), 10) === :ok
285+
307286
remotecall_fetch(r -> (finalize(take!(r)); yield(); nothing), wid2, fstore) # finalize remotely
308287
sleep(0.5) # to ensure that wid2 messages have been executed on wid1
309288
@test poll_while(() -> remotecall_fetch(k -> haskey(Distributed.PGRP.refs, k), wid1, rrid))

0 commit comments

Comments
 (0)