File 2413-snmp-agent-test-Fixed-agent-mibs-post-tc-fun.patch of Package erlang

From e0631b9f19458f11ba529580bf4aa66192e7d43e Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Fri, 17 Apr 2020 12:10:19 +0200
Subject: [PATCH 13/14] [snmp|agent|test] Fixed agent mibs post tc fun

The post fun was supposed to perform a node cleanup,
but assumed the wrong input. So, exec of the fun crashed.
But since the call was catched it was not visible.
The result was the the tmp nodes was left running,
thereby consuming resources of the host. This is not
a problem for new machines, by we have some really old
and slow kit...
---
 lib/snmp/test/snmp_agent_mibs_SUITE.erl | 40 +++++++++++++++++++++------------
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/lib/snmp/test/snmp_agent_mibs_SUITE.erl b/lib/snmp/test/snmp_agent_mibs_SUITE.erl
index 150e015554..13734cbf79 100644
--- a/lib/snmp/test/snmp_agent_mibs_SUITE.erl
+++ b/lib/snmp/test/snmp_agent_mibs_SUITE.erl
@@ -172,29 +172,28 @@ init_per_testcase2(size_check_ets2_bad_file1, Config) when is_list(Config) ->
     %% Create a bad file
     ok = file:write_file(join(DbDir, "snmpa_symbolic_store.db"), 
 			 "calvin and hoppes play chess"),
+    Factor = ?config(snmp_factor, Config),
+    ct:timetrap(?MINS(1 + (Factor div 2))),
     Config;
 init_per_testcase2(size_check_ets3_bad_file1, Config) when is_list(Config) ->
     DbDir = ?config(db_dir, Config),
     %% Create a bad file
     ok = file:write_file(join(DbDir, "snmpa_symbolic_store.db"), 
 			 "calvin and hoppes play chess"),
+    Factor = ?config(snmp_factor, Config),
+    ct:timetrap(?MINS(1 + (Factor div 2))),
     Config;
 init_per_testcase2(size_check_mnesia, Config) when is_list(Config) ->
+    Factor = ?config(snmp_factor, Config),
+    ct:timetrap(?MINS(1 + (Factor div 2))),
     Config;
 init_per_testcase2(cache_test, Config) when is_list(Config) ->
-    Min = ?MINS(10), 
-    Timeout =
-	case lists:keysearch(tc_timeout, 1, Config) of
-	    {value, {tc_timeout, TcTimeout}} when TcTimeout < Min ->
-		Min; 
-	    {value, {tc_timeout, TcTimeout}} ->
-		TcTimeout; 
-	    _ ->
-		Min
-	end,
-    Dog = test_server:timetrap(Timeout), 
-    [{watchdog, Dog} | Config];
+    Factor = ?config(snmp_factor, Config),
+    ct:timetrap(?MINS(5 + (Factor div 2))),
+    Config;
 init_per_testcase2(_Case, Config) when is_list(Config) ->
+    Factor = ?config(snmp_factor, Config),
+    ct:timetrap(?MINS(1 + (Factor div 3))),
     Config.
 
 
@@ -365,6 +364,10 @@ do_size_check(Name, Config) ->
     do_size_check(Name, Init, Config).
 
 do_size_check(Name, Init, Config) ->
+    io:format("do_size_check -> entry with"
+              "~n   Name:   ~p"
+              "~n   Config: ~p"
+              "~n", [Name, Config]),
     Pre = fun() ->
                   {ok, Node} = ?ALIB:start_node(unique(Name)),
                   ok = run_on(Node, Init),
@@ -387,9 +390,18 @@ do_size_check(Name, Init, Config) ->
                            exit(Reason)
                    end
            end,
-    Post = fun({Node, _}) ->
-                   ?STOP_NODE(Node)
+    Post = fun(Node) ->
+                   monitor_node(Node, true),
+                   ?NPRINT("try stop node ~p", [Node]),
+                   ?STOP_NODE(Node),
+                   receive
+                       {nodedown, Node} ->
+                           ?NPRINT("node ~p stopped", [Node]),
+                           ok
+                   end
            end,
+    io:format("do_size_check -> do test"
+              "~n", []),
     ?TC_TRY(Name, Pre, Case, Post).
 
 run_on(Node, F) when is_atom(Node) andalso is_function(F, 0) ->
-- 
2.16.4

openSUSE Build Service is sponsored by