aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-06-27 18:29:38 +0200
committerMicael Karlberg <[email protected]>2019-06-27 18:35:32 +0200
commit56f91a0f4b2307cd4ffe8d921b038dcb7ec85359 (patch)
tree426166caecfc2782a214eaaa3881790c78e665e8 /lib/snmp
parent9ef3a76da1eef43d2c466c0aa68c18a0863bdbc2 (diff)
downloadotp-56f91a0f4b2307cd4ffe8d921b038dcb7ec85359.tar.gz
otp-56f91a0f4b2307cd4ffe8d921b038dcb7ec85359.tar.bz2
otp-56f91a0f4b2307cd4ffe8d921b038dcb7ec85359.zip
[snmp|agent|test] Add another "skip point"
Try to detect if the test case function skip's, end re-exit so that "eventually" the test case runner detects it in turn re-exit...#@!!£##!...
Diffstat (limited to 'lib/snmp')
-rw-r--r--lib/snmp/test/snmp_agent_test_lib.erl31
-rw-r--r--lib/snmp/test/snmp_test_server.erl4
2 files changed, 18 insertions, 17 deletions
diff --git a/lib/snmp/test/snmp_agent_test_lib.erl b/lib/snmp/test/snmp_agent_test_lib.erl
index 5ff79cb3a9..07600bbaf7 100644
--- a/lib/snmp/test/snmp_agent_test_lib.erl
+++ b/lib/snmp/test/snmp_agent_test_lib.erl
@@ -362,6 +362,15 @@ await_tc_runner_done(Runner, OldFlag) ->
"~n", [Reason, SysEvs]),
skip([{reason, Reason}, {system_events, SysEvs}])
end;
+ {tc_runner_done, Runner, {'EXIT', {skip, Reason}}, Loc} ->
+ ?PRINT2("call -> done with skip: "
+ "~n Reason: ~p"
+ "~n Loc: ~p"
+ "~n", [Reason, Loc]),
+ trap_exit(OldFlag),
+ unlink_and_flush_exit(Runner),
+ put(test_server_loc, Loc),
+ skip(Reason);
{tc_runner_done, Runner, {'EXIT', Rn}, Loc} ->
?PRINT2("call -> done with exit: "
"~n Rn: ~p"
@@ -466,28 +475,20 @@ tc_run(Mod, Func, Args, Opts) ->
{mibs, mibs(StdM, M)}]) of
{ok, _Pid} ->
case (catch apply(Mod, Func, Args)) of
+ {'EXIT', {skip, Reason}} ->
+ ?EPRINT2("apply skip detected: "
+ "~n ~p", [Reason]),
+ (catch snmp_test_mgr:stop()),
+ ?SKIP(Reason);
{'EXIT', Reason} ->
+ ?EPRINT2("apply exit catched: "
+ "~n ~p", [Reason]),
(catch snmp_test_mgr:stop()),
?FAIL({apply_failed, {Mod, Func, Args}, Reason});
Res ->
(catch snmp_test_mgr:stop()),
Res
end;
- %% try apply(Mod, Func, Args) of
- %% Res ->
- %% (catch snmp_test_mgr:stop()),
- %% Res
- %% catch
- %% throw:Res ->
- %% Res;
- %% C:E:S ->
- %% ?EPRINT2("Failed (tc) apply: "
- %% "~n Class: ~p"
- %% "~n Error: ~p"
- %% "~n Stack: ~p", [C, E, S]),
- %% (catch snmp_test_mgr:stop()),
- %% ?FAIL({apply_failed, {Mod, Func, Args}, {C, E, S}})
- %% end;
{error, Reason} ->
?EPRINT2("Failed starting (test) manager: "
diff --git a/lib/snmp/test/snmp_test_server.erl b/lib/snmp/test/snmp_test_server.erl
index a77bdc142c..ab7dbbbaa0 100644
--- a/lib/snmp/test/snmp_test_server.erl
+++ b/lib/snmp/test/snmp_test_server.erl
@@ -207,7 +207,7 @@ do_subcases(Mod, Fun, [{conf, Init, Cases, Finish}|SubCases], Config, Acc)
[{failed, {Mod, Fun}, Error}]
end,
do_subcases(Mod, Fun, SubCases, Config, [R|Acc]);
-do_subcases(Mod, Fun, [SubCase|SubCases], Config, Acc) when atom(SubCase) ->
+do_subcases(Mod, Fun, [SubCase|SubCases], Config, Acc) when is_atom(SubCase) ->
R = do_case(Mod, SubCase, Config),
do_subcases(Mod, Fun, SubCases,Config, [R|Acc]).
@@ -407,7 +407,7 @@ d(_, _, _, _) ->
ok.
timestamp() ->
- {Date, Time} = calendar:now_to_datetime( now() ),
+ {Date, Time} = calendar:now_to_datetime( erlang:timestamp() ),
{YYYY, MM, DD} = Date,
{Hour, Min, Sec} = Time,
FormatDate =