aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/test/snmp_test_lib.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-04-05 12:37:19 +0200
committerMicael Karlberg <[email protected]>2019-04-11 18:55:44 +0200
commit5ac8a73af358e47666e4a3bb6bbe3edbfe98bf36 (patch)
tree5caffa22e632a35efc5b5d9ea8046a9811422986 /lib/snmp/test/snmp_test_lib.erl
parentdcd4ba6359ede0f51a2aec9c8ba536e319c36dfa (diff)
downloadotp-5ac8a73af358e47666e4a3bb6bbe3edbfe98bf36.tar.gz
otp-5ac8a73af358e47666e4a3bb6bbe3edbfe98bf36.tar.bz2
otp-5ac8a73af358e47666e4a3bb6bbe3edbfe98bf36.zip
[snmp|agent|test] More test tweaking
Improved test printouts (more with timestamps), also fixed the printouts of the (fake) local-db start result printout. Also updated the copyright end-dates.
Diffstat (limited to 'lib/snmp/test/snmp_test_lib.erl')
-rw-r--r--lib/snmp/test/snmp_test_lib.erl26
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl
index 290f1bc31a..4973630ea2 100644
--- a/lib/snmp/test/snmp_test_lib.erl
+++ b/lib/snmp/test/snmp_test_lib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2002-2015. All Rights Reserved.
+%% Copyright Ericsson AB 2002-2019. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@
-export([watchdog/3, watchdog_start/1, watchdog_start/2, watchdog_stop/1]).
-export([del_dir/1]).
-export([cover/1]).
--export([p/2, print/5, formated_timestamp/0]).
+-export([p/2, print1/2, print2/2, print/5, formated_timestamp/0]).
%% ----------------------------------------------------------------------
@@ -605,6 +605,24 @@ p(Mod, Case) when is_atom(Mod) andalso is_atom(Case) ->
p(F, A) when is_list(F) andalso is_list(A) ->
io:format(user, F ++ "~n", 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.
+
+print_format(F, A) ->
+ FTS = snmp_test_lib:formated_timestamp(),
+ io_lib:format("[~s] " ++ F ++ "~n", [FTS | A]).
+
+print1(F, A) ->
+ S = print_format(F, A),
+ io:format("~s", [S]),
+ io:format(user, "~s", [S]).
+
+print2(F, A) ->
+ S = print_format(F, A),
+ io:format("~s", [S]).
+
+
print(Prefix, Module, Line, Format, Args) ->
io:format("*** [~s] ~s ~p ~p ~p:~p *** " ++ Format ++ "~n",
[formated_timestamp(),
@@ -618,6 +636,6 @@ format_timestamp({_N1, _N2, N3} = 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)]),
+ 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).