File 2402-snmp-test-Add-skip-condition-for-Windows-on-WMWare.patch of Package erlang

From 4cf85876a7279923074c6adb1d6bfcbaf58ccd66 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Thu, 2 Apr 2020 11:04:23 +0200
Subject: [PATCH 02/14] [snmp|test] Add skip condition for Windows on WMWare

We have a windows host that runs in a VM. Its dog slow
and causes random failures. So add a skip condition to
init-per-suite.
---
 lib/snmp/test/snmp_test_lib.erl | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl
index fe6fef291d..52f0dfb9ed 100644
--- a/lib/snmp/test/snmp_test_lib.erl
+++ b/lib/snmp/test/snmp_test_lib.erl
@@ -467,6 +467,10 @@ os_base_skip(Skippable, OsFam, OsName) ->
 	    case lists:keysearch(OsFam, 1, Skippable) of
 		{value, {OsFam, OsName}} ->
 		    true;
+		{value, {OsFam, Check}} when is_function(Check, 0) ->
+		    Check();
+		{value, {OsFam, Check}} when is_function(Check, 1) ->
+		    Check(os:version());
 		{value, {OsFam, OsNames}} when is_list(OsNames) ->
 		    %% OsNames is a list of: 
 		    %%    [atom()|{atom(), function/0 | function/1}]
@@ -646,7 +650,19 @@ init_per_suite(Config) ->
                         true
                 end
         end,
-    COND = [{unix, [{linux, LinuxVersionVerify}]}],
+    SkipWindowsOnVirtual =
+        fun() ->
+                SysInfo = which_win_system_info(),
+                SysMan  = win_sys_info_lookup(system_manufacturer, SysInfo),
+                case string:to_lower(SysMan) of
+                    "vmware" ++ _ ->
+                        true;
+                    _ ->
+                        false
+                end
+        end,
+    COND = [{win32, SkipWindowsOnVirtual},
+            {unix,  [{linux, LinuxVersionVerify}]}],
     case os_based_skip(COND) of
         true ->
             {skip, "Unstable host and/or os (or combo thererof)"};
-- 
2.16.4

openSUSE Build Service is sponsored by