File 0168-snmp-test-Factor-calculation-tweaking.patch of Package erlang

From d32b74792b2064b0232e5a5f9e3311a3bf7ca272 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Fri, 20 Dec 2019 14:30:50 +0100
Subject: [PATCH 08/10] [snmp|test] Factor calculation tweaking

Adjusted the factor calculation for SunOS and 'others'
(mostly Windows).
---
 lib/snmp/test/snmp_test_lib.erl | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl
index e9216a4f55..9217809b9b 100644
--- a/lib/snmp/test/snmp_test_lib.erl
+++ b/lib/snmp/test/snmp_test_lib.erl
@@ -712,7 +712,11 @@ skip(Reason, Module, Line) ->
 %% It also returns a "factor" that can be used when deciding 
 %% the load for some test cases. Such as run time or number of
 %% iteraions. This only works for some OSes.
-%% Also, mostly it just returns the factor 1.
+%%
+%% We make some calculations on Linux, OpenBSD and FreeBSD.
+%% On SunOS we always set the factor to 2 (just to be on ethe safe side)
+%% On all other os:es (mostly windows) we check the number of schedulers,
+%% but at least the factor will be 2.
 analyze_and_print_host_info() ->
     {OsFam, OsName} = os:type(),
     Version         =
@@ -732,13 +736,23 @@ analyze_and_print_host_info() ->
         {unix, sunos} ->
             io:format("Solaris: ~s"
                       "~n", [Version]),
-            1;
+            2;
         _ ->
             io:format("OS Family: ~p"
                       "~n   OS Type: ~p"
                       "~n   Version: ~p"
                       "~n", [OsFam, OsName, Version]),
-            1
+            try erlang:system_info(schedulers) of
+                1 ->
+                    10;
+                2 ->
+                    5;
+                _ ->
+                    2
+            catch
+                _:_:_ ->
+                    10
+            end
     end.
     
 analyze_and_print_linux_host_info(Version) ->
-- 
2.16.4

openSUSE Build Service is sponsored by