File 0165-snmp-agent-test-slave-Node-start-cleanup.patch of Package erlang

From 2f0a68da94703a779079c47df6b0433be03d0d8b Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Wed, 18 Dec 2019 18:35:01 +0100
Subject: [PATCH 05/10] [snmp|agent|test] (slave) Node start cleanup

Cleaned up the (slave) node start. Failure was not
reported well. Also there was still some clearcase
specific code (eep!).
---
 lib/snmp/test/snmp_agent_test_lib.erl | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/lib/snmp/test/snmp_agent_test_lib.erl b/lib/snmp/test/snmp_agent_test_lib.erl
index c0da47dc4c..5dc544d1a7 100644
--- a/lib/snmp/test/snmp_agent_test_lib.erl
+++ b/lib/snmp/test/snmp_agent_test_lib.erl
@@ -1518,7 +1518,7 @@ get_req(Id, Vars) ->
 
 get_next_req(Vars) ->
     ?DBG("get_next_req -> entry with"
-	 "~n   Vars: ~p",[Vars]),
+	 "~n   Vars: ~p", [Vars]),
     snmp_test_mgr:gn(Vars),
     ?DBG("get_next_req -> await response",[]),
     Response = snmp_test_mgr:receive_response(),
@@ -1534,36 +1534,31 @@ start_node(Name) ->
 	 "~n when"
 	 "~n   hostname of this node: ~p",
 	 [Name, list_to_atom(?HOSTNAME(node()))]),
+
     Pa = filename:dirname(code:which(?MODULE)),
-    ?DBG("start_node -> Pa: ~p",[Pa]),
-
-    Args = case init:get_argument('CC_TEST') of
-	       {ok, [[]]} ->
-		   " -pa /clearcase/otp/libraries/snmp/ebin ";
-	       {ok, [[Path]]} ->
-		   " -pa " ++ Path;
-	       error ->
-		      ""
-	      end,
-    %% Do not use start_link!!! (the proc that calls this one is tmp)
-    ?DBG("start_node -> Args: ~p~n", [Args]),
-    A = Args ++ " -pa " ++ Pa ++ 
+    ?DBG("start_node -> Pa: ~p", [Pa]),
+
+    A = " -pa " ++ Pa ++ 
         " -s " ++ atom_to_list(snmp_test_sys_monitor) ++ " start" ++ 
         " -s global sync",
-    case (catch ?START_NODE(Name, A)) of
+    case ?START_NODE(Name, A) of
 	{ok, Node} ->
-	    %% Tell the test_server to not clean up things it never started.
-	    ?DBG("start_node -> Node: ~p",[Node]),
+	    ?DBG("start_node -> Node: ~p", [Node]),
             global:sync(),
 	    {ok, Node};
+	{error, Reason}  -> 
+	    ?ERR("start_node -> failed starting node ~p:"
+                 "~n      Reason: ~p", [Name, Reason]),
+	    ?line ?SKIP({failed_start_node, Reason});
 	Else  -> 
-	    ?ERR("start_node -> failed with(other): Else: ~p",[Else]),
+	    ?ERR("start_node -> failed starting node ~p:"
+                 "~n      ~p", [Name, Else]),
 	    ?line ?FAIL(Else)
     end.
 
 
 stop_node(Node) ->
-    ?LOG("stop_node -> Node: ~p",[Node]),
+    ?LOG("stop_node -> Node: ~p", [Node]),
     rpc:cast(Node, erlang, halt, []).
 
 
-- 
2.16.4

openSUSE Build Service is sponsored by