File 4324-kernel-tcp-misc-test-Adjust-partial-recv-and-close-3.patch of Package erlang

From 8a5fc22fcf66886b9123170b14646547d6e9de9f Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Mon, 25 May 2020 13:39:01 +0200
Subject: [PATCH 24/35] [kernel|tcp|misc-test] Adjust partial-recv-and-close-3
 test case

Add a skip clause (eaddrnotavail on connect).
---
 lib/kernel/test/gen_tcp_misc_SUITE.erl | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl
index a7d6adbefd..16c8ea7df3 100644
--- a/lib/kernel/test/gen_tcp_misc_SUITE.erl
+++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl
@@ -2219,6 +2219,16 @@ do_partial_recv_and_close_2(_Config) ->
 %%% a send operation of a huge amount data when the other end closed the socket.
 %%%
 partial_recv_and_close_3(Config) when is_list(Config) ->
+    OldFlag = process_flag(trap_exit, true),
+    Res = try do_partial_recv_and_close_3(Config)
+          catch
+              throw:{skip, _} = SKIP ->
+                  SKIP
+          end,
+    process_flag(trap_exit, OldFlag),
+    Res.
+
+do_partial_recv_and_close_3(_Config) ->
     [do_partial_recv_and_close_3() || _ <- lists:seq(0, 20)],
     ok.
 
@@ -2236,14 +2246,20 @@ do_partial_recv_and_close_3() ->
 	{port,Port} -> ok
     end,
     Much = ones(8*64*1024),
-    {ok,S} = gen_tcp:connect(localhost, Port, [{active,false}]),
+    S = case gen_tcp:connect(localhost, Port, [{active, false}]) of
+            {ok, Sock} ->
+                Sock;
+        {error, eaddrnotavail = Reason} ->
+            skip(connect_failed_str(Reason))
+    end,
 
-    %% Send a lot of data (most of it will be queued). The receiver will read one byte
-    %% and close the connection. The write operation will fail.
+    %% Send a lot of data (most of it will be queued).
+    %% The receiver will read one byte and close the connection.
+    %% The write operation will fail.
     gen_tcp:send(S, Much),
 
     %% We should always get {error,closed} here.
-    {error,closed} = gen_tcp:recv(S, 0).
+    {error, closed} = gen_tcp:recv(S, 0).
     
 
 test_prio_put_get() ->
-- 
2.26.2

openSUSE Build Service is sponsored by