Skip to content

Commit

Permalink
Run reuseport tests only if SO_REUSEPORT is supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
amitmurthy committed May 22, 2017
1 parent a99ac7e commit 1719e14
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions test/distributed_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ include("testenv.jl")

addprocs_with_testenv(4)

# Test that the client port is reused. SO_REUSEPORT may not be supported on
# all UNIX platforms, Linux kernels prior to 3.9 and older versions of OSX
if is_unix()
function reuseport_tests()
# Run the test on all processes.
results = asyncmap(procs()) do p
remotecall_fetch(p) do
Expand Down Expand Up @@ -47,6 +45,19 @@ if is_unix()
@test all(p -> p in results, procs())
end

# Test that the client port is reused. SO_REUSEPORT may not be supported on
# all UNIX platforms, Linux kernels prior to 3.9 and older versions of OSX
if is_unix()
# Run reuse client port tests only if SO_REUSEPORT is supported.
s = TCPSocket(delay = false)
is_linux() && bind_client_port(s)
if ccall(:jl_tcp_reuseport, Int32, (Ptr{Void},), s.handle) == 0
reuseport_tests()
else
info("SO_REUSEPORT is unsupported, skipping reuseport tests.")
end
end

id_me = myid()
id_other = filter(x -> x != id_me, procs())[rand(1:(nprocs()-1))]

Expand Down

0 comments on commit 1719e14

Please sign in to comment.