diff options
author | Micael Karlberg <[email protected]> | 2019-07-08 17:47:59 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-07-08 17:47:59 +0200 |
commit | 70c800fc3d899d14cc2ca50e433082b5b2193990 (patch) | |
tree | abfedfb27da34bd3572696e3fa9b005e4016ff5d | |
parent | 9c1ddc058fa95d263bfd02a3835bd1a797202601 (diff) | |
download | otp-70c800fc3d899d14cc2ca50e433082b5b2193990.tar.gz otp-70c800fc3d899d14cc2ca50e433082b5b2193990.tar.bz2 otp-70c800fc3d899d14cc2ca50e433082b5b2193990.zip |
[esock|test] Add async IPv6 test case
OTP-15897
-rw-r--r-- | erts/emulator/test/socket_SUITE.erl | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/erts/emulator/test/socket_SUITE.erl b/erts/emulator/test/socket_SUITE.erl index 50db7b2486..073979d881 100644 --- a/erts/emulator/test/socket_SUITE.erl +++ b/erts/emulator/test/socket_SUITE.erl @@ -86,6 +86,7 @@ %% *** API async *** api_a_connect_tcp4/1, + api_a_connect_tcp6/1, api_a_sendto_and_recvfrom_udp4/1, api_a_sendmsg_and_recvmsg_udp4/1, api_a_send_and_recv_tcp4/1, @@ -709,6 +710,7 @@ api_basic_cases() -> api_async_cases() -> [ api_a_connect_tcp4, + api_a_connect_tcp6, api_a_sendto_and_recvfrom_udp4, api_a_sendmsg_and_recvmsg_udp4, api_a_send_and_recv_tcp4, @@ -2776,7 +2778,7 @@ api_b_send_and_recv_tcp(InitState) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Basically establish a TCP connection via an async connect. +%% Basically establish a TCP connection via an async connect. IPv4. api_a_connect_tcp4(suite) -> []; @@ -2786,25 +2788,48 @@ api_a_connect_tcp4(_Config) when is_list(_Config) -> ?TT(?SECS(10)), tc_try(api_a_connect_tcp4, fun() -> - Connect = fun(Sock, SockAddr) -> - socket:connect(Sock, SockAddr, nowait) - end, - Send = fun(Sock, Data) -> - socket:send(Sock, Data) - end, - Recv = fun(Sock) -> - socket:recv(Sock) - end, - InitState = #{domain => inet, - connect => Connect, - send => Send, - recv => Recv}, - ok = api_a_connect_tcp(InitState) + ok = api_a_connect_tcpD(inet) end). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Basically establish a TCP connection via an async connect. IPv6. + +api_a_connect_tcp6(suite) -> + []; +api_a_connect_tcp6(doc) -> + []; +api_a_connect_tcp6(_Config) when is_list(_Config) -> + ?TT(?SECS(10)), + tc_try(api_a_connect_tcp6, + fun() -> has_support_ipv6() end, + fun() -> + ok = api_a_connect_tcpD(inet6) + end). + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +api_a_connect_tcpD(Domain) -> + Connect = fun(Sock, SockAddr) -> + socket:connect(Sock, SockAddr, nowait) + end, + Send = fun(Sock, Data) -> + socket:send(Sock, Data) + end, + Recv = fun(Sock) -> + socket:recv(Sock) + end, + InitState = #{domain => Domain, + connect => Connect, + send => Send, + recv => Recv}, + api_a_connect_tcp(InitState). + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + api_a_connect_tcp(InitState) -> process_flag(trap_exit, true), ServerSeq = |