File 0548-kernel-esock-Skip-on-slow-ubuntu.patch of Package erlang

From 10e46c0d6231818bd5fe94a9c21a20091b22653e Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Thu, 27 May 2021 17:49:28 +0200
Subject: [PATCH] [kernel|esock] Skip on slow ubuntu

---
 lib/kernel/test/socket_SUITE.erl | 38 ++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/lib/kernel/test/socket_SUITE.erl b/lib/kernel/test/socket_SUITE.erl
index 19fb6c24fc..3f3d6cad77 100644
--- a/lib/kernel/test/socket_SUITE.erl
+++ b/lib/kernel/test/socket_SUITE.erl
@@ -693,7 +693,7 @@
 -define(TPP_SMALL_NUM,  5000).
 -define(TPP_MEDIUM_NUM, 500).
 -define(TPP_LARGE_NUM,  50).
--define(TPP_NUM(Config, Base), Base div lookup(esock_factor, 1, Config)).
+-define(TPP_NUM(Config, Base), (Base) div lookup(esock_factor, 1, Config)).
 
 -define(TTEST_RUNTIME,  ?SECS(10)).
 
@@ -38132,7 +38132,8 @@ traffic_ping_pong_large_send_and_recv_tcp4(Config) when is_list(Config) ->
     Msg = l2b(?TPP_LARGE),
     Num = ?TPP_NUM(Config, ?TPP_LARGE_NUM),
     tc_try(traffic_ping_pong_large_send_and_recv_tcp4,
-           fun() -> is_old_fedora16() end,
+           fun() -> is_old_fedora16(),
+		    is_slow_ubuntu(Config) end,
            fun() ->
                    InitState = #{domain => inet,
                                  proto  => tcp,
@@ -38161,7 +38162,8 @@ traffic_ping_pong_large_send_and_recv_tcp6(Config) when is_list(Config) ->
     Num = ?TPP_NUM(Config, ?TPP_LARGE_NUM),
     tc_try(traffic_ping_pong_large_send_and_recv_tcp6,
            fun() -> is_old_fedora16(),
-                    has_support_ipv6() end,
+                    has_support_ipv6(),
+		    is_slow_ubuntu(Config) end,
            fun() ->
                    InitState = #{domain => inet6,
                                  proto  => tcp,
@@ -38222,8 +38224,11 @@ traffic_ping_pong_large_host_cond2(_) ->
     ok.
 
 
+etc_issue() ->
+    string:trim(os:cmd("cat /etc/issue")).
+
 is_old_fedora16() ->
-    is_old_fedora16(string:trim(os:cmd("cat /etc/issue"))).
+    is_old_fedora16( etc_issue() ).
 
 %% We actually only have one host running this, a slow VM.
 is_old_fedora16("Fedora release 16 " ++ _) ->
@@ -38232,6 +38237,31 @@ is_old_fedora16(_) ->
     ok.
 
 
+%% This is a bit subjective, but...
+%% ..we have some WMs that is not "fast enough", but the only
+%% thing we can test on is 'esock factor' (other than host name).
+%% This means we actually skip this on platforms where its
+%% not actually needed.
+%% The host in question is a Ubuntu 20.04...
+is_slow_ubuntu(Config) ->
+    case lookup(esock_factor, 1, Config) of
+	F when is_integer(F) andalso (F > 1) ->
+	    case os:type() of
+		{unix, linux} ->
+		    case etc_issue() of
+			"Ubuntu 20.04" ++ _ ->
+			    skip("Slow Ubuntu host");
+			_ ->
+			    ok
+		    end;
+		_ ->
+		    ok
+	    end;
+	_ ->
+	    ok
+    end.
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% This test case is intended to test that the sendto and recvfrom 
 %% functions by repeatedly sending a meassage between two entities.
-- 
2.26.2

openSUSE Build Service is sponsored by