Skip to content

Commit 5a8add7

Browse files
committed
fixup! debug
1 parent be5accf commit 5a8add7

File tree

1 file changed

+47
-46
lines changed

1 file changed

+47
-46
lines changed

test/topology.jl

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -70,29 +70,29 @@ using Random
7070
end
7171
end
7272

73-
addprocs_with_testenv(TopoTestManager(8); topology="custom")
73+
# addprocs_with_testenv(TopoTestManager(8); topology="custom")
7474

75-
while true
76-
if any(x->get(map_pid_ident, x, 0)==0, workers())
77-
yield()
78-
else
79-
break
80-
end
81-
end
75+
# while true
76+
# if any(x->get(map_pid_ident, x, 0)==0, workers())
77+
# yield()
78+
# else
79+
# break
80+
# end
81+
# end
8282

83-
let p1, p2
84-
for p1 in workers()
85-
for p2 in workers()
86-
i1 = map_pid_ident[p1]
87-
i2 = map_pid_ident[p2]
88-
if (iseven(i1) && iseven(i2)) || (isodd(i1) && isodd(i2))
89-
@test p2 == remotecall_fetch(p->remotecall_fetch(myid, p), p1, p2)
90-
else
91-
@test_throws RemoteException remotecall_fetch(p->remotecall_fetch(myid, p), p1, p2)
92-
end
93-
end
94-
end
95-
end
83+
# let p1, p2
84+
# for p1 in workers()
85+
# for p2 in workers()
86+
# i1 = map_pid_ident[p1]
87+
# i2 = map_pid_ident[p2]
88+
# if (iseven(i1) && iseven(i2)) || (isodd(i1) && isodd(i2))
89+
# @test p2 == remotecall_fetch(p->remotecall_fetch(myid, p), p1, p2)
90+
# else
91+
# @test_throws RemoteException remotecall_fetch(p->remotecall_fetch(myid, p), p1, p2)
92+
# end
93+
# end
94+
# end
95+
# end
9696

9797
@info "finished TopoTestManager"
9898
remove_workers_and_test()
@@ -110,36 +110,37 @@ using Random
110110
addprocs_with_testenv(8)
111111
def_count_conn()
112112

113-
# @info "10 random combinations"
114-
# # Test for 10 random combinations
115-
# wl = workers()
116-
# combinations = []
117-
# while length(combinations) < 10
118-
# from = rand(wl)
119-
# to = rand(wl)
120-
# if from == to || ((from,to) in combinations) || ((to,from) in combinations)
121-
# continue
122-
# else
123-
# push!(combinations, (from,to))
124-
# end
125-
# end
113+
@info "10 random combinations"
114+
# Test for 10 random combinations
115+
wl = workers()
116+
combinations = []
117+
while length(combinations) < 10
118+
from = rand(wl)
119+
to = rand(wl)
120+
if from == to || ((from,to) in combinations) || ((to,from) in combinations)
121+
continue
122+
else
123+
push!(combinations, (from,to))
124+
end
125+
end
126126

127-
# # Initially only master-worker connections ought to be setup
128-
# expected_num_conns = 8
129-
# let num_conns = sum(asyncmap(p->remotecall_fetch(count_connected_workers,p), workers()))
130-
# @test num_conns == expected_num_conns
131-
# end
127+
# Initially only master-worker connections ought to be setup
128+
expected_num_conns = 8
129+
let num_conns = sum(asyncmap(p->remotecall_fetch(count_connected_workers,p), workers()))
130+
@test num_conns == expected_num_conns
131+
end
132132

133-
# for (i, (from,to)) in enumerate(combinations)
134-
# remotecall_wait(topid->remotecall_fetch(myid, topid), from, to)
135-
# expected_num_conns += 2 # one connection endpoint on both from and to
136-
# let num_conns = sum(asyncmap(p->remotecall_fetch(count_connected_workers,p), workers()))
137-
# @test num_conns == expected_num_conns
138-
# end
139-
# end
133+
for (i, (from,to)) in enumerate(combinations)
134+
remotecall_wait(topid->remotecall_fetch(myid, topid), from, to)
135+
expected_num_conns += 2 # one connection endpoint on both from and to
136+
let num_conns = sum(asyncmap(p->remotecall_fetch(count_connected_workers,p), workers()))
137+
@test num_conns == expected_num_conns
138+
end
139+
end
140140

141141
@info "finished master-worker"
142142
# With lazy=false, all connections ought to be setup during `addprocs`
143+
@show workers()
143144
nprocs() > 1 && rmprocs(workers())
144145
addprocs_with_testenv(8; lazy=false)
145146
def_count_conn()

0 commit comments

Comments
 (0)