From 0d125432b4a33c0f4ef1e179e60a8e842125227c Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 5 Apr 2019 18:12:15 +0200 Subject: [snmp|agent|test] Timestamps and test manager Added common (formated) timestamp function(s). Made use of these in the verbosity module (for debug printouts) and in the test suite(s). I also *think* I found the cause for some if the test case failures (timeouts). For v3 (agent) test cases the test manager makes use of parts of the agent code: snmp_framework_mib and snmp_user_based_sm_mib. And since they store their data in snmpa_local_db, that also needs to be running. And this was the problem (I think). On some (slow) machines, the snmpa_local_db process from the *previous* test case might still be running when the we tried to start it. That meant that no new snmpa_local_db was started. Instead the old one, still running but terminating, was retain. For a while. Until it actually finally stopped. So the next operation towards snmpa_local_db, insert, simply hanged until the process terminated. This in combination with the fact that the packet server process, which was started using proc_lib, previously called init_ack before this init was actually done, could actually start and then at a much later time hang because some operation timed out (the packet server was hanging). Yuckety yuck-yuck. --- lib/snmp/test/snmp_test_lib.erl | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'lib/snmp/test/snmp_test_lib.erl') diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl index 4973630ea2..33f7b89974 100644 --- a/lib/snmp/test/snmp_test_lib.erl +++ b/lib/snmp/test/snmp_test_lib.erl @@ -607,7 +607,8 @@ p(F, A) when is_list(F) andalso is_list(A) -> %% This is just a bog standard printout, with a (formatted) timestamp %% prefix and a newline after. -%% print1 prints to both standard_ío and to user. print2 just to standard_ío. +%% print1 - prints to both standard_io and user. +%% print2 - prints to just standard_io. print_format(F, A) -> FTS = snmp_test_lib:formated_timestamp(), @@ -629,13 +630,5 @@ print(Prefix, Module, Line, Format, Args) -> Prefix, node(), self(), Module, Line|Args]). formated_timestamp() -> - format_timestamp(os:timestamp()). - -format_timestamp({_N1, _N2, N3} = Now) -> - {Date, Time} = calendar:now_to_datetime(Now), - {YYYY,MM,DD} = Date, - {Hour,Min,Sec} = Time, - FormatDate = - io_lib:format("~.4w:~.2.0w:~.2.0w-~.2.0w:~.2.0w:~.2.0w.~w", - [YYYY, MM, DD, Hour, Min, Sec, round(N3/1000)]), - lists:flatten(FormatDate). + snmp_misc:formated_timestamp(). + -- cgit v1.2.3