File 3182-esock-test-sctp-Add-another-stream-SCTP-test-case.patch of Package erlang

From 4b9c193648980560309dc310a9fef616e608f4eb Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Thu, 23 May 2024 07:31:45 +0200
Subject: [PATCH 02/10] [esock|test|sctp] Add another (stream) SCTP test case

---
 lib/kernel/test/socket_SUITE.erl | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/lib/kernel/test/socket_SUITE.erl b/lib/kernel/test/socket_SUITE.erl
index 85d4052c22..c7e200fb6b 100644
--- a/lib/kernel/test/socket_SUITE.erl
+++ b/lib/kernel/test/socket_SUITE.erl
@@ -134,6 +134,7 @@
          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_stream_sctp4/1,
          api_b_sendv_and_recv_tcp4/1,
          api_b_send_and_recv_tcpL/1,
          api_b_send_and_recv_seqpL/1,
@@ -1021,6 +1022,7 @@ api_basic_cases() ->
      api_b_sendmsg_and_recvmsg_udp4,
      api_b_sendmsg_and_recvmsg_udpL,
      api_b_send_and_recv_tcp4,
+     api_b_send_and_recv_stream_sctp4,
      api_b_sendv_and_recv_tcp4,
      api_b_send_and_recv_tcpL,
      api_b_send_and_recv_seqpL,
@@ -3680,6 +3682,33 @@ api_b_send_and_recv_tcp4(_Config) when is_list(_Config) ->
            end).
 
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% Basically send and receive using the "common" functions (send and recv)
+%% on an IPv4 SCTP (stream) socket.
+api_b_send_and_recv_stream_sctp4(_Config) when is_list(_Config) ->
+    ?TT(?SECS(10)),
+    tc_try(?FUNCTION_NAME,
+           fun() ->
+                   has_support_sctp(),
+                   has_support_ipv4()
+           end,
+           fun() ->
+                   Send = fun(Sock, Data) ->
+                                  socket:send(Sock, Data)
+                          end,
+                   Recv = fun(Sock) ->
+                                  socket:recv(Sock)
+                          end,
+                   InitState = #{domain => inet,
+                                 type   => stream,
+                                 proto  => sctp,
+                                 send   => Send,
+                                 recv   => Recv},
+                   ok = api_b_send_and_recv_conn(InitState)
+           end).
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 %% Basically send and receive using the sendv and recv functions
-- 
2.35.3

openSUSE Build Service is sponsored by