aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-05-13 14:35:30 +0200
committerMicael Karlberg <[email protected]>2019-05-29 13:47:40 +0200
commit04d84bbf6af32c475c2477217b87259eff264dca (patch)
tree3b1f070bc83da8affcc4896c8caa139ec9a37495
parentb6f949e3e95fd7a908aad64a9f03e7a4e2711286 (diff)
downloadotp-04d84bbf6af32c475c2477217b87259eff264dca.tar.gz
otp-04d84bbf6af32c475c2477217b87259eff264dca.tar.bz2
otp-04d84bbf6af32c475c2477217b87259eff264dca.zip
[esock|test] Add (dgram) sendmsg and recvmsg test case for local
Add a sendmsg and recvmsg test case for a unix domain (dgram) socket. OTP-15822
-rw-r--r--erts/emulator/test/socket_SUITE.erl49
1 files changed, 48 insertions, 1 deletions
diff --git a/erts/emulator/test/socket_SUITE.erl b/erts/emulator/test/socket_SUITE.erl
index a548d81467..a7add0bd0d 100644
--- a/erts/emulator/test/socket_SUITE.erl
+++ b/erts/emulator/test/socket_SUITE.erl
@@ -75,6 +75,7 @@
api_b_sendto_and_recvfrom_udp4/1,
api_b_sendto_and_recvfrom_udpL/1,
api_b_sendmsg_and_recvmsg_udp4/1,
+ api_b_sendmsg_and_recvmsg_udpL/1,
api_b_send_and_recv_tcp4/1,
api_b_send_and_recv_tcpL/1,
api_b_sendmsg_and_recvmsg_tcp4/1,
@@ -598,6 +599,7 @@ api_basic_cases() ->
api_b_sendto_and_recvfrom_udp4,
api_b_sendto_and_recvfrom_udpL,
api_b_sendmsg_and_recvmsg_udp4,
+ api_b_sendmsg_and_recvmsg_udpL,
api_b_send_and_recv_tcp4,
api_b_send_and_recv_tcpL,
api_b_sendmsg_and_recvmsg_tcp4,
@@ -1693,7 +1695,7 @@ api_b_sendto_and_recvfrom_udp4(_Config) when is_list(_Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Basically send and receive on an IPv4 UDP (dgram) socket using
-%% sendto and recvfrom..
+%% sendto and recvfrom.
api_b_sendto_and_recvfrom_udpL(suite) ->
[];
api_b_sendto_and_recvfrom_udpL(doc) ->
@@ -1763,6 +1765,51 @@ api_b_sendmsg_and_recvmsg_udp4(_Config) when is_list(_Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Basically send and receive on an IPv4 UDP (dgram) socket
+%% using sendmsg and recvmsg.
+api_b_sendmsg_and_recvmsg_udpL(suite) ->
+ [];
+api_b_sendmsg_and_recvmsg_udpL(doc) ->
+ [];
+api_b_sendmsg_and_recvmsg_udpL(_Config) when is_list(_Config) ->
+ ?TT(?SECS(5)),
+ tc_try(api_b_sendmsg_and_recvmsg_udpL,
+ fun() -> supports_unix_domain_socket() end,
+ fun() ->
+ Send = fun(Sock, Data, Dest) ->
+ %% We need tests for this,
+ %% but this is not the place it.
+ %% CMsgHdr = #{level => ip,
+ %% type => tos,
+ %% data => reliability},
+ %% CMsgHdrs = [CMsgHdr],
+ MsgHdr = #{addr => Dest,
+ %% ctrl => CMsgHdrs,
+ iov => [Data]},
+ socket:sendmsg(Sock, MsgHdr)
+ end,
+ Recv = fun(Sock) ->
+ %% We have some issues on old darwing...
+ %% socket:setopt(Sock, otp, debug, true),
+ case socket:recvmsg(Sock) of
+ {ok, #{addr := Source,
+ iov := [Data]}} ->
+ %% socket:setopt(Sock, otp, debug, false),
+ {ok, {Source, Data}};
+ {error, _} = ERROR ->
+ ERROR
+ end
+ end,
+ InitState = #{domain => local,
+ proto => default,
+ send => Send,
+ recv => Recv},
+ ok = api_b_send_and_recv_udp(InitState)
+ end).
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
api_b_send_and_recv_udp(InitState) ->
Seq =
[