diff options
author | Micael Karlberg <[email protected]> | 2019-07-23 16:21:12 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-07-23 16:21:12 +0200 |
commit | bf89fa2a64d5df1a1701e12bbc13d1825a12df2a (patch) | |
tree | ac37d34dd7e5443df9f5a9ff3f97612e5a533209 /lib | |
parent | 103c1ea8ee98f0c6c3e7817e88f427bcceda122d (diff) | |
download | otp-bf89fa2a64d5df1a1701e12bbc13d1825a12df2a.tar.gz otp-bf89fa2a64d5df1a1701e12bbc13d1825a12df2a.tar.bz2 otp-bf89fa2a64d5df1a1701e12bbc13d1825a12df2a.zip |
[snmp|manager|test] Fixed notify test case
The (second) notify test case had a faulty "condition" test
(which skipped the case in all cases except when it was
supposed to be skipped :)
Also, the test start and stop of the manager during the
test case has been adjusted. We try to keep track of how
long time each start and stop takes. And also, if they takes
to long, we skip the case.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/snmp/test/snmp_manager_test.erl | 44 | ||||
-rw-r--r-- | lib/snmp/test/snmp_test_lib.erl | 5 |
2 files changed, 32 insertions, 17 deletions
diff --git a/lib/snmp/test/snmp_manager_test.erl b/lib/snmp/test/snmp_manager_test.erl index 2546ee7edd..d49ab53c9f 100644 --- a/lib/snmp/test/snmp_manager_test.erl +++ b/lib/snmp/test/snmp_manager_test.erl @@ -990,25 +990,23 @@ notify_started02(Config) when is_list(Config) -> %% <CONDITIONAL-SKIP> %% The point of this is to catch machines running - %% SLES9 (2.6.5) + %% SLES9 (2.6.5). LinuxVersionVerify = fun() -> case os:cmd("uname -m") of "i686" ++ _ -> -%% io:format("found an i686 machine, " -%% "now check version~n", []), case os:version() of {2, 6, Rev} when Rev >= 16 -> - true; + false; {2, Min, _} when Min > 6 -> - true; + false; {Maj, _, _} when Maj > 2 -> - true; + false; _ -> - false + true end; _ -> - true + false end end, Skippable = [{unix, [{linux, LinuxVersionVerify}]}], @@ -1103,7 +1101,7 @@ ns02_client_await_approx_runtime(Pid) -> "~n ~p", [Pid, Reason]), {error, Reason} - after 15000 -> + after 30000 -> %% Either something is *really* wrong or this machine %% is dog slow. Either way, this is a skip-reason... {skip, approx_runtime_timeout} @@ -1181,19 +1179,33 @@ ns02_ctrl_loop(Opts, N) -> p("entry when N: ~p", [N]), ?SLEEP(2000), p("start manager"), - %% snmpm:start(Opts), - {Pid, MRef} = erlang:spawn_monitor(fun() -> exit(snmpm:start(Opts)) end), + TS1 = erlang:system_time(millisecond), + {StarterPid, StarterMRef} = + erlang:spawn_monitor(fun() -> exit(snmpm:start(Opts)) end), receive - {'DOWN', MRef, process, Pid, ok} -> + {'DOWN', StarterMRef, process, StarterPid, ok} -> + TS2 = erlang:system_time(millisecond), + p("manager started: ~w ms", [TS2-TS1]), ok after 5000 -> - p("start manager (~p) timeout - kill"), - exit(Pid, kill), - exit({skip, timeout}) + p("manager (~p) start timeout - kill", [StarterPid]), + exit(StarterPid, kill), + exit({skip, start_timeout}) end, ?SLEEP(2000), p("stop manager"), - snmpm:stop(), + ?SLEEP(100), % Give the verbosity to take effect... + TS3 = erlang:system_time(millisecond), + case snmpm:stop(5000) of + ok -> + TS4 = erlang:system_time(millisecond), + p("manager stopped: ~p ms", [TS4-TS3]), + ok; + {error, timeout} -> + p("manager stop timeout - kill (cleanup) and skip"), + exit(whereis(snmpm_supervisor), kill), + exit({skip, stop_timeout}) + end, ns02_ctrl_loop(Opts, N-1). diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl index 35bc535a80..a05040e281 100644 --- a/lib/snmp/test/snmp_test_lib.erl +++ b/lib/snmp/test/snmp_test_lib.erl @@ -202,11 +202,14 @@ non_pc_tc_maybe_skip(Config, Condition, File, Line) %% test-server... ok; _ -> - case Condition() of + try Condition() of true -> skip(non_pc_testcase, File, Line); false -> ok + catch + C:E:S -> + skip({condition, C, E, S}, File, Line) end end end. |