From f9a818d0378d1e7e4e91d13b7ce1208dc2d628af Mon Sep 17 00:00:00 2001
From: Hans Bolinder This module implements an event handler that CT uses to
+%%% This module implements an event handler that CT uses to
%%% handle status and progress notifications during test runs.
%%% The notifications are handled locally (per node) and passed
%%% on to ct_master when CT runs in distributed mode. This
%%% module may be used as a template for other event handlers
-%%% that can be plugged in to handle local logging and reporting. This module exports framework callback functions which are
-%%% called from the test_server. The Execute the given The execution is also interrupted if the connection is
-%%% closed. This module contains CT internal help functions for searching
-%%% through groups specification trees and producing resulting
-%%% tests. This module is a proxy for calling and handling locks in
-%%% common test hooks. This module implements
-%%% Func
in suite Mod
crashing.
-%%% Error
specifies the reason for failing.
+%%% This function is called as the result of testcase
+%%% Func in suite Mod crashing.
+%%% Error specifies the reason for failing.
error_notification(Mod,Func,_Args,{Error,Loc}) ->
ErrorSpec = case Error of
{What={_E,_R},Trace} when is_list(Trace) ->
@@ -1049,11 +1049,11 @@ group_or_func(Func, _Config) ->
Func.
%%%-----------------------------------------------------------------
-%%% @spec get_suite(Mod, Func) -> Tests
+%%% -spec get_suite(Mod, Func) -> Tests
%%%
-%%% @doc Called from test_server for every suite (Func==all
)
-%%% and every test case. If the former, all test cases in the suite
-%%% should be returned.
+%%% Called from test_server for every suite (Func==all)
+%%% and every test case. If the former, all test cases in the suite
+%%% should be returned.
get_suite(Mod, all) ->
case catch apply(Mod, groups, []) of
@@ -1355,7 +1355,7 @@ end_per_group(GroupName, _) ->
ok.
%%%-----------------------------------------------------------------
-%%% @spec report(What,Data) -> ok
+%%% -spec report(What,Data) -> ok
report(What,Data) ->
case What of
loginfo ->
@@ -1519,14 +1519,14 @@ add_to_stats(Result) ->
ct_util:update_testdata(stats, Update).
%%%-----------------------------------------------------------------
-%%% @spec warn(What) -> true | false
+%%% -spec warn(What) -> true | false
warn(What) when What==nodes; What==processes ->
false;
warn(_What) ->
true.
%%%-----------------------------------------------------------------
-%%% @spec add_data_dir(File0, Config) -> File1
+%%% -spec add_data_dir(File0, Config) -> File1
add_data_dir(File,Config) when is_atom(File) ->
add_data_dir(atom_to_list(File),Config);
@@ -1545,7 +1545,7 @@ add_data_dir(File,Config) when is_list(File) ->
end.
%%%-----------------------------------------------------------------
-%%% @spec get_logopts() -> [LogOpt]
+%%% -spec get_logopts() -> [LogOpt]
get_logopts() ->
case ct_util:get_testdata(logopts) of
undefined ->
@@ -1555,12 +1555,12 @@ get_logopts() ->
end.
%%%-----------------------------------------------------------------
-%%% @spec format_comment(Comment) -> HtmlComment
+%%% -spec format_comment(Comment) -> HtmlComment
format_comment(Comment) ->
"" ++ Comment ++ "".
%%%-----------------------------------------------------------------
-%%% @spec get_html_wrapper(TestName, PrintLabel, Cwd) -> Header
+%%% -spec get_html_wrapper(TestName, PrintLabel, Cwd) -> Header
get_html_wrapper(TestName, PrintLabel, Cwd, TableCols) ->
get_html_wrapper(TestName, PrintLabel, Cwd, TableCols, utf8).
@@ -1568,6 +1568,6 @@ get_html_wrapper(TestName, PrintLabel, Cwd, TableCols, Encoding) ->
ct_logs:get_ts_html_wrapper(TestName, PrintLabel, Cwd, TableCols, Encoding).
%%%-----------------------------------------------------------------
-%%% @spec get_log_dir() -> {ok,LogDir}
+%%% -spec get_log_dir() -> {ok,LogDir}
get_log_dir() ->
ct_logs:get_log_dir(true).
diff --git a/lib/common_test/src/ct_gen_conn.erl b/lib/common_test/src/ct_gen_conn.erl
index 456bfd8bd1..1ab9946d96 100644
--- a/lib/common_test/src/ct_gen_conn.erl
+++ b/lib/common_test/src/ct_gen_conn.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2003-2017. All Rights Reserved.
+%% Copyright Ericsson AB 2003-2018. 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.
@@ -18,9 +18,9 @@
%% %CopyrightEnd%
%%
-%%% @doc Generic connection owner process.
+%%% Generic connection owner process.
%%%
-%%% @type handle() = pid(). A handle for using a connection implemented
+%%% -type handle() = pid(). A handle for using a connection implemented
%%% with ct_gen_conn.erl.
-module(ct_gen_conn).
@@ -48,7 +48,7 @@
ct_util_server}).
%%%-----------------------------------------------------------------
-%%% @spec start(Address,InitData,CallbackMod,Opts) ->
+%%% -spec start(Address,InitData,CallbackMod,Opts) ->
%%% {ok,Handle} | {error,Reason}
%%% Name = term()
%%% CallbackMod = atom()
@@ -58,57 +58,52 @@
%%% Opt = {name,Name} | {use_existing_connection,boolean()} |
%%% {reconnect,boolean()} | {forward_messages,boolean()}
%%%
-%%% @doc Open a connection and start the generic connection owner process.
+%%% Open a connection and start the generic connection owner process.
%%%
-%%% CallbackMod
is a specific callback module for
+%%% The CallbackMod is a specific callback module for
%%% each type of connection (e.g. telnet, ftp,...). It must export the
-%%% function init/3
which takes the arguments
-%%% Name
, Addresse
) and
-%%% InitData
and returna
-%%% {ok,ConnectionPid,State}
or
-%%% {error,Reason}
.Name
argument in init/3 will
-%%% have the value undefined
.
+%%% If no name is given, the Name argument in init/3 will
+%%% have the value undefined.
%%%
%%% The callback modules must also export
-%%% ```
+%%%
%%% handle_msg(Msg,From,State) -> {reply,Reply,State} |
%%% {noreply,State} |
%%% {stop,Reply,State}
%%% terminate(ConnectionPid,State) -> term()
%%% close(Handle) -> term()
-%%% '''
%%%
-%%% The close/1
callback function is actually a callback
+%%% The close/1 callback function is actually a callback
%%% for ct_util, for closing registered connections when
-%%% ct_util_server is terminated. Handle
is the Pid of
+%%% ct_util_server is terminated. Handle is the Pid of
%%% the ct_gen_conn process.
%%%
-%%% If option reconnect
is true
, then the
+%%% If option reconnect is true, then the
%%% callback must also export
-%%% ```
+%%%
%%% reconnect(Address,State) -> {ok,ConnectionPid,State}
-%%% '''
%%%
-%%% If option forward_messages
is Name
argument, and no Opts
argument. The
+%%% Name argument, and no Opts argument. The
%%% callback must export:
%%%
-%%% ```
%%% init(Name,Address,InitData) -> {ok,ConnectionPid,State}
%%% handle_msg(Msg,State) -> {Reply,State}
%%% reconnect(Address,State) -> {ok,ConnectionPid,State}
%%% terminate(ConnectionPid,State) -> term()
%%% close(Handle) -> term()
-%%% '''
%%%
start(Address,InitData,CallbackMod,Opts) when is_list(Opts) ->
do_start(Address,InitData,CallbackMod,Opts);
@@ -116,73 +111,73 @@ start(Name,Address,InitData,CallbackMod) ->
do_start(Address,InitData,CallbackMod,[{name,Name},{old,true}]).
%%%-----------------------------------------------------------------
-%%% @spec stop(Handle) -> ok
+%%% -spec stop(Handle) -> ok
%%% Handle = handle()
%%%
-%%% @doc Close the connection and stop the process managing it.
+%%% Close the connection and stop the process managing it.
stop(Handle) ->
call(Handle,stop,5000).
%%%-----------------------------------------------------------------
-%%% @spec get_conn_pid(Handle) -> ok
+%%% -spec get_conn_pid(Handle) -> ok
%%% Handle = handle()
%%%
-%%% @doc Return the connection pid associated with Handle
+%%% Return the connection pid associated with Handle
get_conn_pid(Handle) ->
call(Handle,get_conn_pid).
%%%-----------------------------------------------------------------
-%%% @spec log(Heading,Format,Args) -> ok
+%%% -spec log(Heading,Format,Args) -> ok
%%%
-%%% @doc Log activities on the current connection (tool-internal use only).
-%%% @see ct_logs:log/3
+%%% Log activities on the current connection (tool-internal use only).
+%%% See ct_logs:log/3
log(Heading,Format,Args) ->
log(log,[Heading,Format,Args]).
%%%-----------------------------------------------------------------
-%%% @spec start_log(Heading) -> ok
+%%% -spec start_log(Heading) -> ok
%%%
-%%% @doc Log activities on the current connection (tool-internal use only).
-%%% @see ct_logs:start_log/1
+%%% Log activities on the current connection (tool-internal use only).
+%%% See ct_logs:start_log/1
start_log(Heading) ->
log(start_log,[Heading]).
%%%-----------------------------------------------------------------
-%%% @spec cont_log(Format,Args) -> ok
+%%% -spec cont_log(Format,Args) -> ok
%%%
-%%% @doc Log activities on the current connection (tool-internal use only).
-%%% @see ct_logs:cont_log/2
+%%% Log activities on the current connection (tool-internal use only).
+%%% See ct_logs:cont_log/2
cont_log(Format,Args) ->
log(cont_log,[Format,Args]).
%%%-----------------------------------------------------------------
-%%% @spec cont_log_no_timestamp(Format,Args) -> ok
+%%% -spec cont_log_no_timestamp(Format,Args) -> ok
%%%
-%%% @doc Log activities on the current connection (tool-internal use only).
-%%% @see ct_logs:cont_log/2
+%%% Log activities on the current connection (tool-internal use only).
+%%% See ct_logs:cont_log/2
cont_log_no_timestamp(Format,Args) ->
log(cont_log_no_timestamp,[Format,Args]).
%%%-----------------------------------------------------------------
-%%% @spec end_log() -> ok
+%%% -spec end_log() -> ok
%%%
-%%% @doc Log activities on the current connection (tool-internal use only).
-%%% @see ct_logs:end_log/0
+%%% Log activities on the current connection (tool-internal use only).
+%%% See ct_logs:end_log/0
end_log() ->
log(end_log,[]).
%%%-----------------------------------------------------------------
-%%% @spec do_within_time(Fun,Timeout) -> FunResult | {error,Reason}
+%%% -spec do_within_time(Fun,Timeout) -> FunResult | {error,Reason}
%%% Fun = function()
%%% Timeout = integer()
%%%
-%%% @doc Execute a function within a limited time (tool-internal use only).
+%%% Execute a function within a limited time (tool-internal use only).
%%%
-%%% Fun
, but interrupt if it takes
-%%% more than Timeout
milliseconds.
-%%%
-%%%
This function is called by ct_util.erl when testing is -%%% started. A new directory named ct_run.<timestamp> is created -%%% and all logs are stored under this directory.
+%%% This function is called by ct_util.erl when testing is +%%% started. A new directory named ct_run.This function is called by ct_framework:init_tc/3
+%%% This function is called by ct_framework:init_tc/3 init_tc(RefreshLog) -> call({init_tc,self(),group_leader(),RefreshLog}), tc_io_format(group_leader(), xhtml("", "This function is called by ct_framework:end_tc/3
+%%% This function is called by ct_framework:end_tc/3 end_tc(TCPid) -> %% use call here so that the TC process will wait and receive %% possible exit signals from ct_logs before end_tc returns ok call({end_tc,TCPid}). %%%----------------------------------------------------------------- -%%% @spec register_groupleader(Pid,GroupLeader) -> ok +%%% -spec register_groupleader(Pid,GroupLeader) -> ok %%% -%%% @doc To enable logging to a group leader (tool-internal use only). +%%% To enable logging to a group leader (tool-internal use only). %%% -%%%This function is called by ct_framework:report/2
+%%% This function is called by ct_framework:report/2 register_groupleader(Pid,GroupLeader) -> call({register_groupleader,Pid,GroupLeader}), ok. %%%----------------------------------------------------------------- -%%% @spec unregister_groupleader(Pid) -> ok +%%% -spec unregister_groupleader(Pid) -> ok %%% -%%% @doc To disable logging to a group leader (tool-internal use only). +%%% To disable logging to a group leader (tool-internal use only). %%% -%%%This function is called by ct_framework:report/2
+%%% This function is called by ct_framework:report/2 unregister_groupleader(Pid) -> call({unregister_groupleader,Pid}), ok. %%%----------------------------------------------------------------- -%%% @spec log(Heading,Format,Args) -> ok +%%% -spec log(Heading,Format,Args) -> ok %%% -%%% @doc Log internal activity (tool-internal use only). +%%% Log internal activity (tool-internal use only). %%% -%%%This function writes an entry to the currently active log, -%%% i.e. either the CT log or a test case log.
+%%% This function writes an entry to the currently active log, +%%% i.e. either the CT log or a test case log. %%% -%%%Heading
is a short string indicating what type of
-%%% activity it is. Format
and Args
is the
-%%% data to log (as in io:format(Format,Args)
).
This function must be used in combination with
-%%% cont_log/2
and end_log/0
. The intention
-%%% is to call start_log
once, then cont_log
-%%% any number of times and finally end_log
once.
For information about the parameters, see log/3
.
Log
in the test case
+%%% Print a link to each given Log in the test case
%%% log.
%%%
-%%% The given Logs
must exist in the priv dir of the
-%%% calling test suite.
This function is called by ct
when logging
+%%% This function is called by ct when logging
%%% stuff directly from a testcase (i.e. not from within the CT
-%%% framework).
This function is used to perform asynchronous printouts +%%% This function is used to perform asynchronous printouts %%% towards the test server IO handler. This is necessary in order %%% to avoid deadlocks when e.g. the hook that handles SASL printouts %%% prints to the test case log file at the same time test server -%%% asks ct_logs for an html wrapper.
+%%% asks ct_logs for an html wrapper. tc_log_async(Category,Importance,Heading,Format,Args) -> cast({log,async,self(),group_leader(),Category,Importance, [{hd,div_header(Category,Heading),[]}, @@ -509,29 +502,29 @@ tc_log_async(Category,Importance,Heading,Format,Args) -> true}), ok. %%%----------------------------------------------------------------- -%%% @spec tc_print(Category,Format,Args) -%%% @equiv tc_print(Category,?STD_IMPORTANCE,Format,Args,[]) +%%% -spec tc_print(Category,Format,Args) +%%% Equivalent to tc_print(Category,?STD_IMPORTANCE,Format,Args,[]) tc_print(Category,Format,Args) -> tc_print(Category,?STD_IMPORTANCE,Format,Args,[]). %%%----------------------------------------------------------------- -%%% @spec tc_print(Category,Importance,Format,Args) -%%% @equiv tc_print(Category,Importance,Format,Args,[]) +%%% -spec tc_print(Category,Importance,Format,Args) +%%% Equivalent to tc_print(Category,Importance,Format,Args,[]) tc_print(Category,Importance,Format,Args) -> tc_print(Category,Importance,Format,Args,[]). %%%----------------------------------------------------------------- -%%% @spec tc_print(Category,Importance,Format,Args,Opts) -> ok +%%% -spec tc_print(Category,Importance,Format,Args,Opts) -> ok %%% Category = atom() %%% Importance = integer() %%% Format = string() %%% Args = list() %%% Opts = list() %%% -%%% @doc Console printout from a testcase. +%%% Console printout from a testcase. %%% -%%%This function is called by ct
when printing
-%%% stuff from a testcase on the user console.
This function is called by ct
when logging
+%%% This function is called by ct when logging
%%% stuff directly from a testcase. The info is written both in the
-%%% log and on the console.
This function is called by internal ct functions to -%%% force logging to the ct framework log
+%%% This function is called by internal ct functions to +%%% force logging to the ct framework log ct_log(Category,Format,Args) -> cast({ct_log,[{hd,div_header(Category),[]}, {Format,Args}, @@ -2993,13 +2986,13 @@ rm_files([]) -> ok. %%%----------------------------------------------------------------- -%%% @spec simulate() -> pid() +%%% -spec simulate() -> pid() %%% -%%% @doc Simulate the logger process. +%%% Simulate the logger process. %%% -%%%Simulate the logger process - for use when testing code using +%%% Simulate the logger process - for use when testing code using %%% ct_logs logging mechanism without using the ct -%%% environment. (E.g. when testing code with ts)
+%%% environment. (E.g. when testing code with ts) simulate() -> cast(stop), S = self(), @@ -3027,9 +3020,7 @@ simulate_logger_loop() -> end. %%%----------------------------------------------------------------- -%%% @spec notify_and_lock_file(Files) -> ok -%%% -%%% @doc +%%% -spec notify_and_lock_file(Files) -> ok %%% notify_and_lock_file(File) -> case ct_event:is_alive() of @@ -3042,9 +3033,7 @@ notify_and_lock_file(File) -> end. %%%----------------------------------------------------------------- -%%% @spec notify_and_unlock_file(Files) -> ok -%%% -%%% @doc +%%% -spec notify_and_unlock_file(Files) -> ok %%% notify_and_unlock_file(File) -> case ct_event:is_alive() of @@ -3057,9 +3046,7 @@ notify_and_unlock_file(File) -> end. %%%----------------------------------------------------------------- -%%% @spec get_run_dirs(Dir) -> [string()] | false -%%% -%%% @doc +%%% -spec get_run_dirs(Dir) -> [string()] | false %%% get_run_dirs(Dir) -> case filelib:wildcard(filename:join(Dir, "run.[1-2]*")) of @@ -3070,9 +3057,7 @@ get_run_dirs(Dir) -> end. %%%----------------------------------------------------------------- -%%% @spec xhtml(HTML, XHTML) -> HTML | XHTML -%%% -%%% @doc +%%% -spec xhtml(HTML, XHTML) -> HTML | XHTML %%% xhtml(HTML, XHTML) when is_function(HTML), is_function(XHTML) -> @@ -3087,9 +3072,7 @@ xhtml(HTML, XHTML) -> end. %%%----------------------------------------------------------------- -%%% @spec odd_or_even() -> "odd" | "even" -%%% -%%% @doc +%%% -spec odd_or_even() -> "odd" | "even" %%% odd_or_even() -> case get(odd_or_even) of @@ -3102,9 +3085,7 @@ odd_or_even() -> end. %%%----------------------------------------------------------------- -%%% @spec basic_html() -> true | false -%%% -%%% @doc +%%% -spec basic_html() -> true | false %%% basic_html() -> case application:get_env(common_test, basic_html) of @@ -3115,9 +3096,7 @@ basic_html() -> end. %%%----------------------------------------------------------------- -%%% @spec locate_priv_file(FileName) -> PrivFile -%%% -%%% @doc +%%% -spec locate_priv_file(FileName) -> PrivFile %%% locate_priv_file(FileName) -> {ok,CWD} = file:get_cwd(), @@ -3147,13 +3126,13 @@ locate_priv_file(FileName) -> end. %%%----------------------------------------------------------------- -%%% @spec make_relative(AbsDir, Cwd) -> RelDir +%%% -spec make_relative(AbsDir, Cwd) -> RelDir %%% -%%% @doc Return directory path to File (last element of AbsDir), which -%%% is the path relative to Cwd. Examples when Cwd == "/ldisk/test/logs": -%%% make_relative("/ldisk/test/logs/run/trace.log") -> "run/trace.log" -%%% make_relative("/ldisk/test/trace.log") -> "../trace.log" -%%% make_relative("/ldisk/test/logs/trace.log") -> "trace.log" +%%% Return directory path to File (last element of AbsDir), which +%%% is the path relative to Cwd. Examples when Cwd == "/ldisk/test/logs": +%%% make_relative("/ldisk/test/logs/run/trace.log") -> "run/trace.log" +%%% make_relative("/ldisk/test/trace.log") -> "../trace.log" +%%% make_relative("/ldisk/test/logs/trace.log") -> "trace.log" make_relative(AbsDir) -> {ok,Cwd} = file:get_cwd(), make_relative(AbsDir, Cwd). @@ -3177,11 +3156,9 @@ make_relative1(DirTs, CwdTs) -> Ups ++ DirTs. %%%----------------------------------------------------------------- -%%% @spec get_ts_html_wrapper(TestName, PrintLabel, Cwd, TableCols, Encoding) +%%% -spec get_ts_html_wrapper(TestName, PrintLabel, Cwd, TableCols, Encoding) %%% -> {Mode,Header,Footer} %%% -%%% @doc -%%% get_ts_html_wrapper(TestName, PrintLabel, Cwd, TableCols, Encoding) -> get_ts_html_wrapper(TestName, undefined, PrintLabel, Cwd, TableCols, Encoding). diff --git a/lib/common_test/src/ct_master_event.erl b/lib/common_test/src/ct_master_event.erl index bd4d1efc92..a6ec5a7a75 100644 --- a/lib/common_test/src/ct_master_event.erl +++ b/lib/common_test/src/ct_master_event.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2017. All Rights Reserved. +%% Copyright Ericsson AB 2006-2018. 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. @@ -18,13 +18,13 @@ %% %CopyrightEnd% %% -%%% @doc Common Test Framework Event Handler +%%% Common Test Framework Event Handler %%% -%%%This module implements an event handler that the CT Master +%%% This module implements an event handler that the CT Master %%% uses to handle status and progress notifications sent to the %%% master node during test runs. This module may be used as a %%% template for other event handlers that can be plugged in to -%%% handle logging and reporting on the master node.
+%%% handle logging and reporting on the master node. -module(ct_master_event). -behaviour(gen_event). diff --git a/lib/common_test/src/ct_master_logs.erl b/lib/common_test/src/ct_master_logs.erl index 1308720823..ea6f93b565 100644 --- a/lib/common_test/src/ct_master_logs.erl +++ b/lib/common_test/src/ct_master_logs.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2017. All Rights Reserved. +%% Copyright Ericsson AB 2006-2018. 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. @@ -18,10 +18,10 @@ %% %CopyrightEnd% %% -%%% @doc Logging functionality for Common Test Master. +%%% Logging functionality for Common Test Master. %%% -%%%This module implements a logger for the master -%%% node.
+%%% This module implements a logger for the master +%%% node. -module(ct_master_logs). -export([start/2, make_all_runs_index/0, log/3, nodedir/2, diff --git a/lib/common_test/src/ct_master_status.erl b/lib/common_test/src/ct_master_status.erl index b27fdd341e..cb01220121 100644 --- a/lib/common_test/src/ct_master_status.erl +++ b/lib/common_test/src/ct_master_status.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2017. All Rights Reserved. +%% Copyright Ericsson AB 2006-2018. 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. @@ -18,12 +18,12 @@ %% %CopyrightEnd% %% -%%% @doc Logging functionality for Common Test Master. +%%% doc Logging functionality for Common Test Master. %%% -%%%This module keeps a list of {Node,Status}
+%%% This module keeps a list of {Node,Status}
%%% tuples. It is possible to anytime during a test run get
%%% a snapshot of the test status. The module is an event
-%%% handler for the master event manager.
CtData = {@link ct_data()}
State = NewState = cb_state()
+%% CtData = ct_data()
+%% State = NewState = cb_state()
%%
%% Initialyze system before upgrade test starts.
%%
%% This function is called before the upgrade is started. All
-%% applications given in {@link upgrade/4} are already started by
+%% applications given in upgrade/4 are already started by
%% the boot script, so this callback is intended for additional
%% initialization, if necessary.
%%
-%% CtData
is an opaque data structure which shall be used
-%% in any call to ct_release_test
inside the callback.
+%% CtData is an opaque data structure which shall be used
+%% in any call to ct_release_test inside the callback.
%%
%% Example:
%%
-%% ```
%% upgrade_init(CtData,State) ->
%% {ok,{FromVsn,ToVsn}} = ct_release_test:get_app_vsns(CtData,myapp),
-%% open_connection(State).'''
-%% CtData = {@link ct_data()}
State = NewState = cb_state()
+%% CtData = ct_data()
+%% State = NewState = cb_state()
%%
%% Check that upgrade was successful.
%%
@@ -89,21 +86,19 @@
%% been made permanent. It allows application specific checks to
%% ensure that the upgrade was successful.
%%
-%% CtData
is an opaque data structure which shall be used
-%% in any call to ct_release_test
inside the callback.
+%% CtData is an opaque data structure which shall be used
+%% in any call to ct_release_test inside the callback.
%%
%% Example:
%%
-%% ```
%% upgrade_upgraded(CtData,State) ->
-%% check_connection_still_open(State).'''
-%% CtData = {@link ct_data()}
State = NewState = cb_state()
+%% CtData = ct_data()
+%% State = NewState = cb_state()
%%
%% Check that downgrade was successful.
%%
@@ -112,17 +107,13 @@
%% made permanent. It allows application specific checks to ensure
%% that the downgrade was successful.
%%
-%% CtData
is an opaque data structure which shall be used
-%% in any call to ct_release_test
inside the callback.
+%% CtData is an opaque data structure which shall be used
+%% in any call to ct_release_test inside the callback.
%%
%% Example:
%%
-%% ```
%% upgrade_downgraded(CtData,State) ->
-%% check_connection_closed(State).'''
-%% CtData
must be the first argument received in the
+%% CtData must be the first argument received in the
%% calling callback function - an opaque data structure set by
-%% ct_release_tests
.
+%% ct_release_tests.
get_app_vsns(#ct_data{from=FromApps,to=ToApps},App) ->
case {lists:keyfind(App,1,FromApps),lists:keyfind(App,1,ToApps)} of
{{App,FromVsn,_},{App,ToVsn,_}} ->
@@ -380,16 +360,16 @@ get_app_vsns(#ct_data{from=FromApps,to=ToApps},App) ->
Down :: [Instr],
Instr :: term(),
Reason :: {app_not_found,App} | {vsn_not_found,{App,From}}.
-%% @doc Get appup instructions for the given application.
+%% Get appup instructions for the given application.
%%
%% This function can be called from inside any of the callback
%% functions. It reads the appup file for the given application and
%% returns the instructions for upgrade and downgrade for the versions
%% in the test.
%%
-%% CtData
must be the first argument received in the
+%% CtData must be the first argument received in the
%% calling callback function - an opaque data structure set by
-%% ct_release_tests
.
+%% ct_release_tests.
%%
%% See reference manual for appup files for types definitions for the
%% instructions.
diff --git a/lib/common_test/src/ct_repeat.erl b/lib/common_test/src/ct_repeat.erl
index 177ef37d1f..8b1c7d47bb 100644
--- a/lib/common_test/src/ct_repeat.erl
+++ b/lib/common_test/src/ct_repeat.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2017. All Rights Reserved.
+%% Copyright Ericsson AB 2007-2018. 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.
@@ -18,14 +18,14 @@
%% %CopyrightEnd%
%%
-%%% @doc Common Test Framework module that handles repeated test runs
+%%% doc Common Test Framework module that handles repeated test runs
%%%
-%%% This module exports functions for repeating tests. The following
+%%% This module exports functions for repeating tests. The following
%%% start flags (or equivalent ct:run_test/1 options) are supported:
%%% -until
This is a support module for the Common Test Framework. It +%%% This is a support module for the Common Test Framework. It %%% implements the process ct_util_server which acts like a data -%%% holder for suite, configuration and connection data.
+%%% holder for suite, configuration and connection data. %%% -module(ct_util). @@ -83,20 +83,20 @@ %%%----------------------------------------------------------------- start() -> start(normal, ".", ?default_verbosity). -%%% @spec start(Mode) -> Pid | exit(Error) +%%% -spec start(Mode) -> Pid | exit(Error) %%% Mode = normal | interactive %%% Pid = pid() %%% -%%% @doc Start start the ct_util_server process +%%% Start start the ct_util_server process %%% (tool-internal use only). %%% -%%%This function is called from ct_run.erl. It starts and initiates
-%%% the ct_util_server
Returns the process identity of the
-%%% ct_util_server
.
This function can be called when a new connection is
+%%% This function can be called when a new connection is
%%% established. The connection data is stored in the connection
%%% table, and ct_util will close all registered connections when the
-%%% test is finished by calling Callback:close/1
.
This function should be called when a registered connection is +%%% This function should be called when a registered connection is %%% closed. It removes the connection data from the connection -%%% table.
+%%% table. unregister_connection(Handle) -> ets:delete(?conn_table,Handle), ok. %%%----------------------------------------------------------------- -%%% @spec does_connection_exist(TargetName,Address,Callback) -> +%%% -spec does_connection_exist(TargetName,Address,Callback) -> %%% {ok,Handle} | false %%% TargetName = ct:target_name() %%% Address = address %%% Callback = atom() %%% Handle = term() %%% -%%% @doc Check if a connection already exists. +%%% Check if a connection already exists. does_connection_exist(TargetName,Address,Callback) -> case ct_config:get_key_from_name(TargetName) of {ok,_Key} -> @@ -594,7 +594,7 @@ does_connection_exist(TargetName,Address,Callback) -> end. %%%----------------------------------------------------------------- -%%% @spec get_connection(TargetName,Callback) -> +%%% -spec get_connection(TargetName,Callback) -> %%% {ok,Connection} | {error,Reason} %%% TargetName = ct:target_name() %%% Callback = atom() @@ -602,8 +602,8 @@ does_connection_exist(TargetName,Address,Callback) -> %%% Handle = term() %%% Address = term() %%% -%%% @doc Return the connection forCallback
on the
-%%% given target (TargetName
).
+%%% Return the connection for Callback on the
+%%% given target (TargetName).
get_connection(TargetName,Callback) ->
%% check that TargetName is a registered alias
case ct_config:get_key_from_name(TargetName) of
@@ -624,7 +624,7 @@ get_connection(TargetName,Callback) ->
end.
%%%-----------------------------------------------------------------
-%%% @spec get_connections(ConnPid) ->
+%%% -spec get_connections(ConnPid) ->
%%% {ok,Connections} | {error,Reason}
%%% Connections = [Connection]
%%% Connection = {TargetName,Handle,Callback,Address}
@@ -633,8 +633,8 @@ get_connection(TargetName,Callback) ->
%%% Callback = atom()
%%% Address = term()
%%%
-%%% @doc Get data for all connections associated with a particular
-%%% connection pid (see Callback:init/3).
+%%% Get data for all connections associated with a particular
+%%% connection pid (see Callback:init/3).
get_connections(ConnPid) ->
Conns = ets:tab2list(?conn_table),
lists:flatmap(fun(#conn{targetref=TargetName,
@@ -654,8 +654,7 @@ get_connections(ConnPid) ->
end, Conns).
%%%-----------------------------------------------------------------
-%%% @hidden
-%%% @equiv ct:get_target_name/1
+%%% Equivalent to ct:get_target_name/1
get_target_name(Handle) ->
case ets:select(?conn_table,[{#conn{handle=Handle,targetref='$1',_='_'},
[],
@@ -667,17 +666,14 @@ get_target_name(Handle) ->
end.
%%%-----------------------------------------------------------------
-%%% @spec close_connections() -> ok
+%%% -spec close_connections() -> ok
%%%
-%%% @doc Close all open connections.
+%%% Close all open connections.
close_connections() ->
close_connections(ets:tab2list(?conn_table)),
ok.
%%%-----------------------------------------------------------------
-%%% @spec
-%%%
-%%% @doc
override_silence_all_connections() ->
Protocols = [telnet,ftp,rpc,snmp,ssh],
override_silence_connections(Protocols),
@@ -738,12 +734,12 @@ reset_silent_connections() ->
%%%-----------------------------------------------------------------
-%%% @spec stop(Info) -> ok
+%%% -spec stop(Info) -> ok
%%%
-%%% @doc Stop the ct_util_server and close all existing connections
+%%% Stop the ct_util_server and close all existing connections
%%% (tool-internal use only).
%%%
-%%% @see ct
+%%% See ct.
stop(Info) ->
case whereis(ct_util_server) of
undefined ->
@@ -757,26 +753,25 @@ stop(Info) ->
end.
%%%-----------------------------------------------------------------
-%%% @spec update_last_run_index() -> ok
+%%% -spec update_last_run_index() -> ok
%%%
-%%% @doc Update ct_run.<timestamp>/index.html
+%%% Update ct_run.This module redirects sasl and error logger info to common test log.
-%%% @end - +%%% This module redirects sasl and error logger info to common test log. %% CTH Callbacks -export([id/1, init/2, diff --git a/lib/common_test/src/cth_surefire.erl b/lib/common_test/src/cth_surefire.erl index 4407ff56c1..b0742717ae 100644 --- a/lib/common_test/src/cth_surefire.erl +++ b/lib/common_test/src/cth_surefire.erl @@ -1,7 +1,7 @@ %%-------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012-2017. All Rights Reserved. +%% Copyright Ericsson AB 2012-2018. 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. @@ -18,10 +18,10 @@ %% %CopyrightEnd% %%-------------------------------------------------------------------- -%%% @doc Common Test Framework functions handling test specifications. +%%% Common Test Framework functions handling test specifications. %%% -%%%This module creates a junit report of the test run if plugged in -%%% as a suite_callback.
+%%% This module creates a junit report of the test run if plugged in +%%% as a suite_callback. -module(cth_surefire). -- cgit v1.2.3