Skip to content

Commit e472a09

Browse files
committed
Hack around SharedArray tests -- it appears as though they don't allow workers to create views/reshapes
1 parent 149fb89 commit e472a09

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

stdlib/SharedArrays/test/runtests.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function check_pids_all(S::SharedArray)
3434
parentindices(D.loc_subarr_1d)[1]
3535
end
3636
@test all(sdata(S)[idxes_in_p] .== p)
37-
pidtested[idxes_in_p] = true
37+
pidtested[idxes_in_p] .= true
3838
end
3939
@test all(pidtested)
4040
end
@@ -124,7 +124,7 @@ finalize(S)
124124

125125
# Creating a new file
126126
fn2 = tempname()
127-
S = SharedArray{Int,2}(fn2, sz, init=D->D[localindices(D)] = myid())
127+
S = SharedArray{Int,2}(fn2, sz, init=D->(for i in localindices(D); D[i] = myid(); end))
128128
@test S == filedata
129129
filedata2 = similar(Atrue)
130130
read!(fn2, filedata2)
@@ -134,7 +134,7 @@ finalize(S)
134134
# Appending to a file
135135
fn3 = tempname()
136136
write(fn3, fill(0x1, 4))
137-
S = SharedArray{UInt8}(fn3, sz, 4, mode="a+", init=D->D[localindices(D)]=0x02)
137+
S = SharedArray{UInt8}(fn3, sz, 4, mode="a+", init=D->(for i in localindices(D); D[i] = 0x02; end))
138138
len = prod(sz)+4
139139
@test filesize(fn3) == len
140140
filedata = Vector{UInt8}(uninitialized, len)
@@ -190,11 +190,12 @@ s = copy(sdata(d))
190190
ds = deepcopy(d)
191191
@test ds == d
192192
pids_d = procs(d)
193-
remotecall_fetch(setindex!, pids_d[findfirst(id->(id != myid()), pids_d)::Int], d, 1.0, 1:10)
193+
@everywhere bcast_setindex!(S, v, I) = (for i in I; S[i] = v; end; S)
194+
remotecall_fetch(bcast_setindex!, pids_d[findfirst(id->(id != myid()), pids_d)::Int], d, 1.0, 1:10)
194195
@test ds != d
195196
@test s != d
196197
copyto!(d, s)
197-
@everywhere setid!(A) = A[localindices(A)] = myid()
198+
@everywhere setid!(A) = (for i in localindices(A); A[i] = myid(); end; A)
198199
@everywhere procs(ds) setid!($ds)
199200
@test d == s
200201
@test ds != s
@@ -207,8 +208,8 @@ copyto!(d, s)
207208
a = d[1:5]
208209
@test_throws BoundsError d[-1:5]
209210
a = d[1,1,1:3:end]
210-
d[2:4] = 7
211-
d[5,1:2:4,8] = 19
211+
d[2:4] .= 7
212+
d[5,1:2:4,8] .= 19
212213

213214
AA = rand(4,2)
214215
A = @inferred(convert(SharedArray, AA))

0 commit comments

Comments
 (0)