diff options
author | Zandra Hird <[email protected]> | 2016-06-17 14:17:43 +0200 |
---|---|---|
committer | Zandra Hird <[email protected]> | 2016-06-17 14:17:43 +0200 |
commit | 700a2b6f0711ec6e0f2c456f1fb9fd9662e5097d (patch) | |
tree | 5f899dde94a7180970576fe14696bd315991cc22 /lib/kernel | |
parent | 043e53da337ea4fff51b3f40594c194d4791cd1b (diff) | |
parent | c2de9c0a64b9330b808fe1afedc3f6a1a7d7df1a (diff) | |
download | otp-700a2b6f0711ec6e0f2c456f1fb9fd9662e5097d.tar.gz otp-700a2b6f0711ec6e0f2c456f1fb9fd9662e5097d.tar.bz2 otp-700a2b6f0711ec6e0f2c456f1fb9fd9662e5097d.zip |
Merge branch 'zandra/kernel-test-cuddle'
Conflicts:
lib/kernel/test/gen_tcp_api_SUITE.erl
lib/kernel/test/gen_udp_SUITE.erl
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/test/gen_tcp_api_SUITE.erl | 18 | ||||
-rw-r--r-- | lib/kernel/test/gen_udp_SUITE.erl | 18 | ||||
-rw-r--r-- | lib/kernel/test/init_SUITE.erl | 2 |
3 files changed, 31 insertions, 7 deletions
diff --git a/lib/kernel/test/gen_tcp_api_SUITE.erl b/lib/kernel/test/gen_tcp_api_SUITE.erl index 026cbf8b28..77ec89b4f4 100644 --- a/lib/kernel/test/gen_tcp_api_SUITE.erl +++ b/lib/kernel/test/gen_tcp_api_SUITE.erl @@ -308,9 +308,7 @@ t_implicit_inet6(Host, Addr) -> implicit_inet6(S1, Loopback), ok = gen_tcp:close(S1), %% - Localhost = "localhost", - Localaddr = ok(inet:getaddr(Localhost, inet6)), - io:format("~s ~p~n", [Localhost,Localaddr]), + Localaddr = ok(get_localaddr()), S2 = ok(gen_tcp:listen(0, [{ip,Localaddr}])), implicit_inet6(S2, Localaddr), ok = gen_tcp:close(S2), @@ -593,6 +591,20 @@ ok(NotOk) -> error, {Thrown, NotOk}, tl(erlang:get_stacktrace())) end. +get_localaddr() -> + get_localaddr(["localhost", "localhost6", "ip6-localhost"]). + +get_localaddr([]) -> + {error, localaddr_not_found}; +get_localaddr([Localhost|Ls]) -> + case inet:getaddr(Localhost, inet6) of + {ok, LocalAddr} -> + io:format("~s ~p~n", [Localhost, LocalAddr]), + {ok, LocalAddr}; + _ -> + get_localaddr(Ls) + end. + getsockfd() -> undefined. closesockfd(_FD) -> undefined. diff --git a/lib/kernel/test/gen_udp_SUITE.erl b/lib/kernel/test/gen_udp_SUITE.erl index db4e174374..1029d7ef0a 100644 --- a/lib/kernel/test/gen_udp_SUITE.erl +++ b/lib/kernel/test/gen_udp_SUITE.erl @@ -724,9 +724,7 @@ implicit_inet6(Host, Addr) -> implicit_inet6(S1, Active, Loopback), ok = gen_udp:close(S1), %% - Localhost = "localhost", - Localaddr = ok(inet:getaddr(Localhost, inet6)), - io:format("~s ~p~n", [Localhost,Localaddr]), + Localaddr = ok(get_localaddr()), S2 = ok(gen_udp:open(0, [{ip,Localaddr},Active])), implicit_inet6(S2, Active, Localaddr), ok = gen_udp:close(S2), @@ -778,3 +776,17 @@ delete_local_filenames() -> filelib:wildcard( "/tmp/" ?MODULE_STRING "_" ++ os:getpid() ++ "_*")], ok. + +get_localaddr() -> + get_localaddr(["localhost", "localhost6", "ip6-localhost"]). + +get_localaddr([]) -> + {error, localaddr_not_found}; +get_localaddr([Localhost|Ls]) -> + case inet:getaddr(Localhost, inet6) of + {ok, LocalAddr} -> + io:format("~s ~p~n", [Localhost, LocalAddr]), + {ok, LocalAddr}; + _ -> + get_localaddr(Ls) + end. diff --git a/lib/kernel/test/init_SUITE.erl b/lib/kernel/test/init_SUITE.erl index a332e7966b..1370e23195 100644 --- a/lib/kernel/test/init_SUITE.erl +++ b/lib/kernel/test/init_SUITE.erl @@ -298,7 +298,7 @@ many_restarts() -> many_restarts(Config) when is_list(Config) -> {ok, Node} = loose_node:start(init_test, "", ?DEFAULT_TIMEOUT_SEC), - loop_restart(30,Node,rpc:call(Node,erlang,whereis,[error_logger])), + loop_restart(50,Node,rpc:call(Node,erlang,whereis,[error_logger])), loose_node:stop(Node), ok. |