aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-09-26 19:13:03 +0200
committerLukas Larsson <[email protected]>2011-09-29 17:31:28 +0200
commita176db06b4de2354a385813409a3340c85c3b341 (patch)
tree1f60eed30b48c14330be57de02996896b931cf25 /lib/kernel/test
parent8b06e8921f7e2f9d907df7edd8daf11ee24a0a1e (diff)
downloadotp-a176db06b4de2354a385813409a3340c85c3b341.tar.gz
otp-a176db06b4de2354a385813409a3340c85c3b341.tar.bz2
otp-a176db06b4de2354a385813409a3340c85c3b341.zip
Use static port for old solaris versions
Solaris version before 10 have some problem with releasing addresses after doing a gen_udp:open, which causes inet_res to get a econnrefused. With this fix we hope that the static port will not collide with anything.
Diffstat (limited to 'lib/kernel/test')
-rw-r--r--lib/kernel/test/inet_res_SUITE.erl12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/kernel/test/inet_res_SUITE.erl b/lib/kernel/test/inet_res_SUITE.erl
index 6064a9b2d9..8a3d220e46 100644
--- a/lib/kernel/test/inet_res_SUITE.erl
+++ b/lib/kernel/test/inet_res_SUITE.erl
@@ -117,9 +117,15 @@ ns_init(ZoneDir, PrivDir, DataDir) ->
case os:type() of
{unix,_} when ZoneDir =:= undefined -> undefined;
{unix,_} ->
- {ok,S} = gen_udp:open(0, [{reuseaddr,true}]),
- {ok,PortNum} = inet:port(S),
- gen_udp:close(S),
+ PortNum = case {os:type(),os:version()} of
+ {{unix,solaris},{M,V,_}} when M =< 5, V < 10 ->
+ 11895 + random:uniform(100);
+ _ ->
+ {ok,S} = gen_udp:open(0, [{reuseaddr,true}]),
+ {ok,PNum} = inet:port(S),
+ gen_udp:close(S),
+ PNum
+ end,
RunNamed = filename:join(DataDir, ?RUN_NAMED),
NS = {{127,0,0,1},PortNum},
P = erlang:open_port({spawn_executable,RunNamed},