Skip to content

Commit 7ba2661

Browse files
committed
ssh: add CT_LOG, CT_PAL to ssh_test_lib.hrl
1 parent e96bcda commit 7ba2661

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

lib/ssh/test/ssh_test_lib.hrl

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,26 @@
8080
-define(wait_match(Pattern, FunctionCall),
8181
?wait_match(Pattern, FunctionCall, ok)).
8282

83-
%%-------------------------------------------------------------------------
84-
%% Write file into log
85-
%%-------------------------------------------------------------------------
8683
-define(ct_log_show_file(File),
8784
(fun(File__) ->
8885
{ok,Contents__} = file:read_file(File__),
8986
ct:log("~p:~p Show file~n~s =~n~s~n",
9087
[?MODULE,?LINE,File__, Contents__])
9188
end)(File)).
89+
90+
-define(SSH_TEST_LIB_FORMAT, "(~s ~p:~p in ~p) ").
91+
-define(SSH_TEST_LIB_ARGS,
92+
[erlang:pid_to_list(self()), ?MODULE, ?LINE, ?FUNCTION_NAME]).
93+
-define(CT_LOG(F),
94+
(ct:log(?SSH_TEST_LIB_FORMAT ++ F, ?SSH_TEST_LIB_ARGS, [esc_chars]))).
95+
-define(CT_LOG(F, Args),
96+
(ct:log(
97+
?SSH_TEST_LIB_FORMAT ++ F,
98+
?SSH_TEST_LIB_ARGS ++ Args,
99+
[esc_chars]))).
100+
-define(CT_PAL(F),
101+
(ct:pal(?SSH_TEST_LIB_FORMAT ++ F, ?SSH_TEST_LIB_ARGS))).
102+
-define(CT_PAL(F, Args),
103+
(ct:pal(?SSH_TEST_LIB_FORMAT ++ F, ?SSH_TEST_LIB_ARGS ++ Args))).
104+
-define(CT_FAIL(F, Args),
105+
(ct:fail(?SSH_TEST_LIB_FORMAT ++ F, ?SSH_TEST_LIB_ARGS ++ Args))).

0 commit comments

Comments
 (0)