Skip to content

Commit 75a9d87

Browse files
committed
[snmp|test] Node start cleanup
1 parent 6693915 commit 75a9d87

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

lib/snmp/test/snmp_test_lib.erl

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,10 @@ fail(Reason, Mod, Line) ->
10431043
skip(Reason, Module, Line) ->
10441044
String = lists:flatten(io_lib:format("Skipping ~p(~p): ~p~n",
10451045
[Module, Line, Reason])),
1046-
exit({skip, String}).
1046+
skip(String).
1047+
1048+
skip(Reason) ->
1049+
exit({skip, Reason}).
10471050

10481051

10491052
%% This function prints various host info, which might be useful
@@ -3164,25 +3167,34 @@ trap_exit(Flag) ->
31643167
%% Node utility functions
31653168
%%
31663169

3170+
%% This hinges on an updated peer verbose start
3171+
%% -define(VERBOSE_PEER_START, true).
3172+
3173+
-ifdef(VERBOSE_PEER_START).
3174+
-define(MAYBE_VERBOSE_START(SO), (SO)#{verbose => true}).
31673175
-define(START_OPTIONS(SO), (SO)#{connection => standard_io}).
3168-
%% -define(START_OPTIONS(SO), SO).
3176+
-else.
3177+
-define(MAYBE_VERBOSE_START(SO), SO).
3178+
-define(START_OPTIONS(SO), SO).
3179+
-endif.
31693180

31703181
start_node(Name, Unlink) ->
31713182
Args = ["-s", "snmp_test_sys_monitor", "start", "-s", "global", "sync"],
31723183
%% Note that the 'verbose' option may not exist...
31733184
%% If it does not exist, this (verbose => true) "should" do nothing...
3174-
BaseStartOptions = #{name => Name,
3175-
args => Args,
3176-
verbose => true},
3177-
StartOptions = ?START_OPTIONS(BaseStartOptions),
3185+
BaseStartOptions = #{name => Name,
3186+
args => Args},
3187+
StartOptions0 = ?MAYBE_VERBOSE_START(BaseStartOptions),
3188+
StartOptions = ?START_OPTIONS(StartOptions0),
31783189
case ?CT_PEER(StartOptions) of
31793190
{ok, Peer, Node} ->
31803191
%% Must unlink, otherwise peer will exit before test case
31813192
maybe_unlink(Unlink, Peer),
31823193
global:sync(),
31833194
{Peer, Node};
31843195
{error, Reason} ->
3185-
throw({skip, {failed_starting_node, Name, Reason}})
3196+
%%% throw({skip, {failed_starting_node, Name, Reason}})
3197+
skip({failed_starting_node, Name, Reason})
31863198
end.
31873199

31883200
maybe_unlink(true, Pid) ->

0 commit comments

Comments
 (0)