aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-02-09 15:49:32 +0100
committerLukas Larsson <[email protected]>2011-02-17 16:59:39 +0100
commitade343808a1a634bd39ab1c94ecadfd070a189de (patch)
tree8a1b63857edbb91e1f21cc57de129393fdd7748b
parentff8d3f0f39b0d1347cd94e1d0d3ab422ad7b06d7 (diff)
downloadotp-ade343808a1a634bd39ab1c94ecadfd070a189de.tar.gz
otp-ade343808a1a634bd39ab1c94ecadfd070a189de.tar.bz2
otp-ade343808a1a634bd39ab1c94ecadfd070a189de.zip
Rename Suite Callback to Common Test Hook in code and testcases
-rw-r--r--lib/common_test/src/Makefile4
-rw-r--r--lib/common_test/src/ct.erl8
-rw-r--r--lib/common_test/src/ct_framework.erl40
-rw-r--r--lib/common_test/src/ct_hooks.erl (renamed from lib/common_test/src/ct_suite_callback.erl)131
-rw-r--r--lib/common_test/src/ct_hooks_lock.erl (renamed from lib/common_test/src/ct_suite_callback_lock.erl)5
-rw-r--r--lib/common_test/src/ct_run.erl110
-rw-r--r--lib/common_test/src/ct_testspec.erl24
-rw-r--r--lib/common_test/src/ct_util.erl14
-rw-r--r--lib/common_test/src/ct_util.hrl2
-rw-r--r--lib/common_test/test/Makefile2
-rw-r--r--lib/common_test/test/ct_error_SUITE_data/error/test/empty_scb.erl187
-rw-r--r--lib/common_test/test/ct_hooks_SUITE.erl1021
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_id_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_id_scb.erl)6
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_init_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_init_scb.erl)6
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_empty_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scb_empty_SUITE.erl)2
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_one_skip_one_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scb_fail_one_skip_one_SUITE.erl)2
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_per_suite_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scb_fail_per_suite_SUITE.erl)2
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_exit_in_init_scope_suite_cth_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_exit_in_init_scope_suite_scb_SUITE.erl)4
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_cth_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_group_scb_SUITE.erl)4
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_state_cth_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_group_state_scb_SUITE.erl)4
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_cth_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_suite_scb_SUITE.erl)4
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_state_cth_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_suite_state_scb_SUITE.erl)4
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_tc_cth_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_tc_scb_SUITE.erl)4
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_cth_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_suite_scb_SUITE.erl)4
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_state_cth_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_suite_state_scb_SUITE.erl)4
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_update_config_SUITE.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_update_config_SUITE.erl)0
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/empty_scb.erl)58
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_post_suite_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_pre_suite_scb.erl)34
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_pre_suite_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_post_suite_scb.erl)34
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/id_no_init_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/id_no_init_scb.erl)6
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_scb.erl)6
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_terminate_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_terminate_scb.erl)8
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/recover_post_suite_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/recover_post_suite_scb.erl)34
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/same_id_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/same_id_scb.erl)34
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_post_suite_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_post_suite_scb.erl)32
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_suite_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_pre_suite_scb.erl)32
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/state_update_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/state_update_scb.erl)32
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/undef_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/undef_scb.erl)30
-rw-r--r--lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl (renamed from lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/update_config_scb.erl)32
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE.erl1021
40 files changed, 1403 insertions, 1588 deletions
diff --git a/lib/common_test/src/Makefile b/lib/common_test/src/Makefile
index abf7816a91..378a7ba08c 100644
--- a/lib/common_test/src/Makefile
+++ b/lib/common_test/src/Makefile
@@ -68,8 +68,8 @@ MODULES= \
ct_config_plain \
ct_config_xml \
ct_slave \
- ct_suite_callback\
- ct_suite_callback_lock
+ ct_hooks\
+ ct_hooks_lock
TARGET_MODULES= $(MODULES:%=$(EBIN)/%)
diff --git a/lib/common_test/src/ct.erl b/lib/common_test/src/ct.erl
index eb0eceeb46..b0a92dcc15 100644
--- a/lib/common_test/src/ct.erl
+++ b/lib/common_test/src/ct.erl
@@ -149,7 +149,7 @@ run(TestDirs) ->
%%% {repeat,N} | {duration,DurTime} | {until,StopTime} |
%%% {force_stop,Bool} | {decrypt,DecryptKeyOrFile} |
%%% {refresh_logs,LogDir} | {basic_html,Bool} |
-%%% {suite_callbacks, SCBs}
+%%% {ct_hooks, CTHs}
%%% TestDirs = [string()] | string()
%%% Suites = [string()] | string()
%%% Cases = [atom()] | atom()
@@ -177,9 +177,9 @@ run(TestDirs) ->
%%% DecryptKeyOrFile = {key,DecryptKey} | {file,DecryptFile}
%%% DecryptKey = string()
%%% DecryptFile = string()
-%%% SCBs = [SCBModule | {SCBModule, SCBInitArgs}]
-%%% SCBModule = atom()
-%%% SCBInitArgs = term()
+%%% CTHs = [CTHModule | {CTHModule, CTHInitArgs}]
+%%% CTHModule = atom()
+%%% CTHInitArgs = term()
%%% Result = [TestResult] | {error,Reason}
%%% @doc Run tests as specified by the combination of options in <code>Opts</code>.
%%% The options are the same as those used with the
diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl
index d05c30f5e1..04829004f4 100644
--- a/lib/common_test/src/ct_framework.erl
+++ b/lib/common_test/src/ct_framework.erl
@@ -229,7 +229,7 @@ init_tc2(Mod,Func,SuiteInfo,MergeResult,Config,DoInit) ->
end.
ct_suite_init(Mod, Func, [Config]) when is_list(Config) ->
- case ct_suite_callback:init_tc( Mod, Func, Config) of
+ case ct_hooks:init_tc( Mod, Func, Config) of
NewConfig when is_list(NewConfig) ->
{ok, [NewConfig]};
Else ->
@@ -251,9 +251,9 @@ add_defaults(Mod,Func,FuncInfo,DoInit) ->
(_) -> false
end, SuiteInfo) of
true ->
- SuiteInfoNoSCB =
- lists:keydelete(suite_callbacks,1,SuiteInfo),
- SuiteInfo1 = merge_with_suite_defaults(Mod,SuiteInfoNoSCB),
+ SuiteInfoNoCTH =
+ lists:keydelete(ct_hooks,1,SuiteInfo),
+ SuiteInfo1 = merge_with_suite_defaults(Mod,SuiteInfoNoCTH),
case add_defaults1(Mod,Func,FuncInfo,SuiteInfo1,DoInit) of
Error = {error,_} -> {SuiteInfo1,Error};
MergedInfo -> {SuiteInfo1,MergedInfo}
@@ -376,8 +376,8 @@ configure([{timetrap,off}|Rest],Info,SuiteInfo,Scope,Config) ->
configure([{timetrap,Time}|Rest],Info,SuiteInfo,Scope,Config) ->
Dog = test_server:timetrap(Time),
configure(Rest,Info,SuiteInfo,Scope,[{watchdog,Dog}|Config]);
-configure([{suite_callbacks, CB} | Rest], Info, SuiteInfo, Scope, Config) ->
- configure(Rest, Info, SuiteInfo, Scope, [{suite_callbacks, CB} | Config]);
+configure([{ct_hooks, Hook} | Rest], Info, SuiteInfo, Scope, Config) ->
+ configure(Rest, Info, SuiteInfo, Scope, [{ct_hooks, Hook} | Config]);
configure([_|Rest],Info,SuiteInfo,Scope,Config) ->
configure(Rest,Info,SuiteInfo,Scope,Config);
configure([],_,_,_,Config) ->
@@ -487,7 +487,7 @@ end_tc(Mod,Func,TCPid,Result,Args,Return) ->
case get('$test_server_framework_test') of
undefined ->
{FinalResult,FinalNotify} =
- case ct_suite_callback:end_tc(
+ case ct_hooks:end_tc(
Mod, FuncSpec, Args, Result, Return) of
'$ct_no_change' ->
{FinalResult = ok,Result};
@@ -499,7 +499,7 @@ end_tc(Mod,Func,TCPid,Result,Args,Return) ->
ct_event:sync_notify(#event{name=tc_done,
node=node(),
data={Mod,FuncSpec,
- tag_scb(FinalNotify)}});
+ tag_cth(FinalNotify)}});
Fun ->
% send sync notification so that event handlers may print
% in the log file before it gets closed
@@ -545,19 +545,19 @@ tag(E = testcase_aborted_or_killed) ->
tag(Other) ->
Other.
-tag_scb({STag,Reason}) when STag == skip; STag == skipped ->
+tag_cth({STag,Reason}) when STag == skip; STag == skipped ->
{skipped,Reason};
-tag_scb({fail, Reason}) ->
+tag_cth({fail, Reason}) ->
{failed, {error,Reason}};
-tag_scb(E = {ETag,_}) when ETag == error; ETag == 'EXIT';
+tag_cth(E = {ETag,_}) when ETag == error; ETag == 'EXIT';
ETag == timetrap_timeout;
ETag == testcase_aborted ->
{failed,E};
-tag_scb(E = testcase_aborted_or_killed) ->
+tag_cth(E = testcase_aborted_or_killed) ->
{failed,E};
-tag_scb(List) when is_list(List) ->
+tag_cth(List) when is_list(List) ->
ok;
-tag_scb(Other) ->
+tag_cth(Other) ->
Other.
%%%-----------------------------------------------------------------
@@ -1188,13 +1188,13 @@ report(What,Data) ->
{_Suite,Case,Result} = Data,
case Result of
{failed, _} ->
- ct_suite_callback:on_tc_fail(What, Data);
+ ct_hooks:on_tc_fail(What, Data);
{skipped,{failed,{_,init_per_testcase,_}}} ->
- ct_suite_callback:on_tc_skip(tc_auto_skip, Data);
+ ct_hooks:on_tc_skip(tc_auto_skip, Data);
{skipped,{require_failed,_}} ->
- ct_suite_callback:on_tc_skip(tc_auto_skip, Data);
+ ct_hooks:on_tc_skip(tc_auto_skip, Data);
{skipped,_} ->
- ct_suite_callback:on_tc_skip(tc_user_skip, Data);
+ ct_hooks:on_tc_skip(tc_user_skip, Data);
_Else ->
ok
end,
@@ -1224,7 +1224,7 @@ report(What,Data) ->
ct_event:sync_notify(#event{name=tc_user_skip,
node=node(),
data=Data}),
- ct_suite_callback:on_tc_skip(What, Data),
+ ct_hooks:on_tc_skip(What, Data),
add_to_stats(user_skipped);
tc_auto_skip ->
%% test case skipped because of error in init_per_suite
@@ -1237,7 +1237,7 @@ report(What,Data) ->
ct_event:sync_notify(#event{name=tc_auto_skip,
node=node(),
data=Data}),
- ct_suite_callback:on_tc_skip(What, Data),
+ ct_hooks:on_tc_skip(What, Data),
if Case /= end_per_suite, Case /= end_per_group ->
add_to_stats(auto_skipped);
true ->
diff --git a/lib/common_test/src/ct_suite_callback.erl b/lib/common_test/src/ct_hooks.erl
index a93b05b1d2..8e80ce8f37 100644
--- a/lib/common_test/src/ct_suite_callback.erl
+++ b/lib/common_test/src/ct_hooks.erl
@@ -19,9 +19,9 @@
%%% @doc Common Test Framework test execution control module.
%%%
-%%% <p>This module is a proxy for calling and handling suite callbacks.</p>
+%%% <p>This module is a proxy for calling and handling common test hooks.</p>
--module(ct_suite_callback).
+-module(ct_hooks).
%% API Exports
-export([init/1]).
@@ -33,7 +33,8 @@
-type proplist() :: [{atom(),term()}].
--define(config_name, suite_callbacks).
+%% If you change this, remember to update ct_util:look -> stop clause as well.
+-define(config_name, ct_hooks).
%% -------------------------------------------------------------------------
%% API Functions
@@ -43,16 +44,16 @@
-spec init(State :: term()) -> ok |
{error, Reason :: term()}.
init(Opts) ->
- call([{CB, call_id, undefined} || CB <- get_new_callbacks(Opts)],
+ call([{Hook, call_id, undefined} || Hook <- get_new_hooks(Opts)],
ok, init, []).
%% @doc Called after all suites are done.
--spec terminate(Callbacks :: term()) ->
+-spec terminate(Hooks :: term()) ->
ok.
-terminate(Callbacks) ->
- call([{CBId, fun call_terminate/3} || {CBId,_,_} <- Callbacks],
- ct_suite_callback_terminate_dummy, terminate, Callbacks),
+terminate(Hooks) ->
+ call([{HookId, fun call_terminate/3} || {HookId,_,_} <- Hooks],
+ ct_hooks_terminate_dummy, terminate, Hooks),
ok.
%% @doc Called as each test case is started. This includes all configuration
@@ -65,9 +66,9 @@ terminate(Callbacks) ->
init_tc(ct_framework, _Func, Args) ->
Args;
init_tc(Mod, init_per_suite, Config) ->
- Info = case catch proplists:get_value(suite_callbacks, Mod:suite()) of
+ Info = case catch proplists:get_value(ct_hooks, Mod:suite()) of
List when is_list(List) ->
- [{suite_callbacks,List}];
+ [{ct_hooks,List}];
_Else ->
[]
end,
@@ -155,10 +156,10 @@ call_generic({Mod, State}, Value, [Function | Args]) ->
%% Generic call function
call(Fun, Config, Meta) ->
maybe_lock(),
- CBs = get_callbacks(),
- Res = call([{CBId,Fun} || {CBId,_, _} <- CBs] ++
- get_new_callbacks(Config, Fun),
- remove(?config_name,Config), Meta, CBs),
+ Hooks = get_hooks(),
+ Res = call([{HookId,Fun} || {HookId,_, _} <- Hooks] ++
+ get_new_hooks(Config, Fun),
+ remove(?config_name,Config), Meta, Hooks),
maybe_unlock(),
Res.
@@ -168,42 +169,42 @@ call(Fun, Config, Meta, NoChangeRet) when is_function(Fun) ->
NewReturn -> NewReturn
end;
-call([{CB, call_id, NextFun} | Rest], Config, Meta, CBs) ->
+call([{Hook, call_id, NextFun} | Rest], Config, Meta, Hooks) ->
try
- {Config, {NewId, _, _} = NewCB} = call_id(CB, Config, Meta),
- {NewCBs, NewRest} =
- case lists:keyfind(NewId, 1, CBs) of
+ {Config, {NewId, _, _} = NewHook} = call_id(Hook, Config, Meta),
+ {NewHooks, NewRest} =
+ case lists:keyfind(NewId, 1, Hooks) of
false when NextFun =:= undefined ->
- {CBs ++ [NewCB],
+ {Hooks ++ [NewHook],
[{NewId, fun call_init/3} | Rest]};
- ExistingCB when is_tuple(ExistingCB) ->
- {CBs, Rest};
+ ExistingHook when is_tuple(ExistingHook) ->
+ {Hooks, Rest};
_ ->
- {CBs ++ [NewCB],
+ {Hooks ++ [NewHook],
[{NewId, fun call_init/3},{NewId,NextFun} | Rest]}
end,
- call(NewRest, Config, Meta, NewCBs)
+ call(NewRest, Config, Meta, NewHooks)
catch Error:Reason ->
Trace = erlang:get_stacktrace(),
- ct_logs:log("Suite Callback","Failed to start a SCB: ~p:~p",
+ ct_logs:log("Suite Hook","Failed to start a CTH: ~p:~p",
[Error,{Reason,Trace}]),
- call([], {fail,"Failed to start SCB"
- ", see the CT Log for details"}, Meta, CBs)
+ call([], {fail,"Failed to start CTH"
+ ", see the CT Log for details"}, Meta, Hooks)
end;
-call([{CBId, Fun} | Rest], Config, Meta, CBs) ->
+call([{HookId, Fun} | Rest], Config, Meta, Hooks) ->
try
- {_,Scope,ModState} = lists:keyfind(CBId, 1, CBs),
- {NewConf, NewCBInfo} = Fun(ModState, Config, Meta),
- NewCalls = get_new_callbacks(NewConf, Fun),
- NewCBs = lists:keyreplace(CBId, 1, CBs, {CBId, Scope, NewCBInfo}),
+ {_,Scope,ModState} = lists:keyfind(HookId, 1, Hooks),
+ {NewConf, NewHookInfo} = Fun(ModState, Config, Meta),
+ NewCalls = get_new_hooks(NewConf, Fun),
+ NewHooks = lists:keyreplace(HookId, 1, Hooks, {HookId, Scope, NewHookInfo}),
call(NewCalls ++ Rest, remove(?config_name, NewConf), Meta,
- terminate_if_scope_ends(CBId, Meta, NewCBs))
- catch throw:{error_in_scb_call,Reason} ->
+ terminate_if_scope_ends(HookId, Meta, NewHooks))
+ catch throw:{error_in_cth_call,Reason} ->
call(Rest, {fail, Reason}, Meta,
- terminate_if_scope_ends(CBId, Meta, CBs))
+ terminate_if_scope_ends(HookId, Meta, Hooks))
end;
-call([], Config, _Meta, CBs) ->
- save_suite_data_async(CBs),
+call([], Config, _Meta, Hooks) ->
+ save_suite_data_async(Hooks),
Config.
remove(Key,List) when is_list(List) ->
@@ -226,36 +227,36 @@ scope([post_init_per_suite, SuiteName|_]) ->
scope(init) ->
none.
-terminate_if_scope_ends(CBId, [Function,Tag|T], CBs) when T =/= [] ->
- terminate_if_scope_ends(CBId,[Function,Tag],CBs);
-terminate_if_scope_ends(CBId, Function, CBs) ->
- case lists:keyfind(CBId, 1, CBs) of
- {CBId, Function, _ModState} = CB ->
- terminate([CB]),
- lists:keydelete(CBId, 1, CBs);
+terminate_if_scope_ends(HookId, [Function,Tag|T], Hooks) when T =/= [] ->
+ terminate_if_scope_ends(HookId,[Function,Tag],Hooks);
+terminate_if_scope_ends(HookId, Function, Hooks) ->
+ case lists:keyfind(HookId, 1, Hooks) of
+ {HookId, Function, _ModState} = Hook ->
+ terminate([Hook]),
+ lists:keydelete(HookId, 1, Hooks);
_ ->
- CBs
+ Hooks
end.
-%% Fetch callback functions
-get_new_callbacks(Config, Fun) ->
- lists:foldl(fun(NewCB, Acc) ->
- [{NewCB, call_id, Fun} | Acc]
- end, [], get_new_callbacks(Config)).
+%% Fetch hook functions
+get_new_hooks(Config, Fun) ->
+ lists:foldl(fun(NewHook, Acc) ->
+ [{NewHook, call_id, Fun} | Acc]
+ end, [], get_new_hooks(Config)).
-get_new_callbacks(Config) when is_list(Config) ->
- lists:flatmap(fun({?config_name, CallbackConfigs}) ->
- CallbackConfigs;
+get_new_hooks(Config) when is_list(Config) ->
+ lists:flatmap(fun({?config_name, HookConfigs}) ->
+ HookConfigs;
(_) ->
[]
end, Config);
-get_new_callbacks(_Config) ->
+get_new_hooks(_Config) ->
[].
-save_suite_data_async(CBs) ->
- ct_util:save_suite_data_async(?config_name, CBs).
+save_suite_data_async(Hooks) ->
+ ct_util:save_suite_data_async(?config_name, Hooks).
-get_callbacks() ->
+get_hooks() ->
ct_util:read_suite_data(?config_name).
catch_apply(M,F,A, Default) ->
@@ -263,15 +264,15 @@ catch_apply(M,F,A, Default) ->
apply(M,F,A)
catch error:Reason ->
case erlang:get_stacktrace() of
- %% Return the default if it was the SCB module which did not have the function.
+ %% Return the default if it was the CTH module which did not have the function.
[{M,F,A}|_] when Reason == undef ->
Default;
Trace ->
- ct_logs:log("Suite Callback","Call to SCB failed: ~p:~p",
+ ct_logs:log("Suite Hook","Call to CTH failed: ~p:~p",
[error,{Reason,Trace}]),
- throw({error_in_scb_call,
+ throw({error_in_cth_call,
lists:flatten(
- io_lib:format("~p:~p/~p SCB call failed",
+ io_lib:format("~p:~p/~p CTH call failed",
[M,F,length(A)]))})
end
end.
@@ -279,11 +280,11 @@ catch_apply(M,F,A, Default) ->
%% We need to lock around the state for parallel groups only. This is because
%% we will get several processes reading and writing the state for a single
-%% scb at the same time.
+%% cth at the same time.
maybe_start_locker(Mod,GroupName,Opts) ->
case lists:member(parallel,Opts) of
true ->
- {ok, _Pid} = ct_suite_callback_lock:start({Mod,GroupName});
+ {ok, _Pid} = ct_hooks_lock:start({Mod,GroupName});
false ->
ok
end.
@@ -291,14 +292,14 @@ maybe_start_locker(Mod,GroupName,Opts) ->
maybe_stop_locker(Mod,GroupName,Opts) ->
case lists:member(parallel,Opts) of
true ->
- stopped = ct_suite_callback_lock:stop({Mod,GroupName});
+ stopped = ct_hooks_lock:stop({Mod,GroupName});
false ->
ok
end.
maybe_lock() ->
- locked = ct_suite_callback_lock:request().
+ locked = ct_hooks_lock:request().
maybe_unlock() ->
- unlocked = ct_suite_callback_lock:release().
+ unlocked = ct_hooks_lock:release().
diff --git a/lib/common_test/src/ct_suite_callback_lock.erl b/lib/common_test/src/ct_hooks_lock.erl
index 84dafd1e42..98794201bb 100644
--- a/lib/common_test/src/ct_suite_callback_lock.erl
+++ b/lib/common_test/src/ct_hooks_lock.erl
@@ -19,9 +19,10 @@
%%% @doc Common Test Framework test execution control module.
%%%
-%%% <p>This module is a proxy for calling and handling locks in suite callbacks.</p>
+%%% <p>This module is a proxy for calling and handling locks in
+%%% common test hooks.</p>
--module(ct_suite_callback_lock).
+-module(ct_hooks_lock).
-behaviour(gen_server).
diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl
index a12d4d6f18..36fccf65f3 100644
--- a/lib/common_test/src/ct_run.erl
+++ b/lib/common_test/src/ct_run.erl
@@ -54,7 +54,7 @@
logdir,
config = [],
event_handlers = [],
- suite_callbacks = [],
+ ct_hooks = [],
include = [],
silent_connections,
stylesheet,
@@ -172,7 +172,7 @@ script_start1(Parent, Args) ->
([]) -> true
end, false, Args),
EvHandlers = event_handler_args2opts(Args),
- SuiteCBs = suite_callbacks_args2opts(Args),
+ CTHooks = ct_hooks_args2opts(Args),
%% check flags and set corresponding application env variables
@@ -236,7 +236,7 @@ script_start1(Parent, Args) ->
StartOpts = #opts{label = Label, vts = Vts, shell = Shell, cover = Cover,
logdir = LogDir, event_handlers = EvHandlers,
- suite_callbacks = SuiteCBs,
+ ct_hooks = CTHooks,
include = IncludeDirs,
silent_connections = SilentConns,
stylesheet = Stylesheet,
@@ -308,9 +308,9 @@ script_start2(StartOpts = #opts{vts = undefined,
SpecStartOpts#opts.scale_timetraps),
AllEvHs = merge_vals([StartOpts#opts.event_handlers,
SpecStartOpts#opts.event_handlers]),
- AllSuiteCBs = merge_vals(
- [StartOpts#opts.suite_callbacks,
- SpecStartOpts#opts.suite_callbacks]),
+ AllCTHooks = merge_vals(
+ [StartOpts#opts.ct_hooks,
+ SpecStartOpts#opts.ct_hooks]),
AllInclude = merge_vals([StartOpts#opts.include,
SpecStartOpts#opts.include]),
@@ -322,7 +322,7 @@ script_start2(StartOpts = #opts{vts = undefined,
logdir = LogDir,
config = SpecStartOpts#opts.config,
event_handlers = AllEvHs,
- suite_callbacks = AllSuiteCBs,
+ ct_hooks = AllCTHooks,
include = AllInclude,
multiply_timetraps = MultTT,
scale_timetraps = ScaleTT}}
@@ -341,7 +341,7 @@ script_start2(StartOpts = #opts{vts = undefined,
{undefined,_} -> % no testspec used
case check_and_install_configfiles(InitConfig, TheLogDir,
Opts#opts.event_handlers,
- Opts#opts.suite_callbacks) of
+ Opts#opts.ct_hooks) of
ok -> % go on read tests from start flags
script_start3(Opts#opts{config=InitConfig,
logdir=TheLogDir}, Args);
@@ -353,7 +353,7 @@ script_start2(StartOpts = #opts{vts = undefined,
AllConfig = merge_vals([InitConfig, Opts#opts.config]),
case check_and_install_configfiles(AllConfig, TheLogDir,
Opts#opts.event_handlers,
- Opts#opts.suite_callbacks) of
+ Opts#opts.ct_hooks) of
ok -> % read tests from spec
{Run,Skip} = ct_testspec:prepare_tests(Terms, node()),
do_run(Run, Skip, Opts#opts{config=AllConfig,
@@ -369,7 +369,7 @@ script_start2(StartOpts, Args) ->
LogDir = which(logdir, StartOpts#opts.logdir),
case check_and_install_configfiles(InitConfig, LogDir,
StartOpts#opts.event_handlers,
- StartOpts#opts.suite_callbacks) of
+ StartOpts#opts.ct_hooks) of
ok -> % go on read tests from start flags
script_start3(StartOpts#opts{config=InitConfig,
logdir=LogDir}, Args);
@@ -377,12 +377,12 @@ script_start2(StartOpts, Args) ->
Error
end.
-check_and_install_configfiles(Configs, LogDir, EvHandlers, SuiteCBs) ->
+check_and_install_configfiles(Configs, LogDir, EvHandlers, CTHooks) ->
case ct_config:check_config_files(Configs) of
false ->
install([{config,Configs},
{event_handler,EvHandlers},
- {suite_callbacks,SuiteCBs}], LogDir);
+ {ct_hooks,CTHooks}], LogDir);
{value,{error,{nofile,File}}} ->
{error,{cant_read_config_file,File}};
{value,{error,{wrong_config,Message}}}->
@@ -450,13 +450,13 @@ script_start4(#opts{vts = true, config = Config, event_handlers = EvHandlers,
script_start4(#opts{label = Label, shell = true, config = Config,
event_handlers = EvHandlers,
- suite_callbacks = SuiteCBs,
+ ct_hooks = CTHooks,
logdir = LogDir, testspecs = Specs}, _Args) ->
%% label - used by ct_logs
application:set_env(common_test, test_label, Label),
InstallOpts = [{config,Config},{event_handler,EvHandlers},
- {suite_callbacks, SuiteCBs}],
+ {ct_hooks, CTHooks}],
if Config == [] ->
ok;
true ->
@@ -522,7 +522,7 @@ script_usage() ->
"\n\t[-stylesheet CSSFile]"
"\n\t[-cover CoverCfgFile]"
"\n\t[-event_handler EvHandler1 EvHandler2 .. EvHandlerN]"
- "\n\t[-suite_callbacks SuiteCB1 SuiteCB2 .. SuiteCBN]"
+ "\n\t[-ct_hooks CTHook1 CTHook2 .. CTHookN]"
"\n\t[-include InclDir1 InclDir2 .. InclDirN]"
"\n\t[-no_auto_compile]"
"\n\t[-multiply_timetraps N]"
@@ -541,7 +541,7 @@ script_usage() ->
"\n\t[-stylesheet CSSFile]"
"\n\t[-cover CoverCfgFile]"
"\n\t[-event_handler EvHandler1 EvHandler2 .. EvHandlerN]"
- "\n\t[-suite_callbacks SuiteCB1 SuiteCB2 .. SuiteCBN]"
+ "\n\t[-ct_hooks CTHook1 CTHook2 .. CTHookN]"
"\n\t[-include InclDir1 InclDir2 .. InclDirN]"
"\n\t[-no_auto_compile]"
"\n\t[-multiply_timetraps N]"
@@ -680,8 +680,8 @@ run_test1(StartOpts) ->
end, Hs))
end,
- %% Suite Callbacks
- SuiteCBs = get_start_opt(suite_callbacks, value, [], StartOpts),
+ %% CT Hooks
+ CTHooks = get_start_opt(ct_hooks, value, [], StartOpts),
%% silent connections
SilentConns = get_start_opt(silent_connections,
@@ -753,7 +753,7 @@ run_test1(StartOpts) ->
Opts = #opts{label = Label,
cover = Cover, step = Step, logdir = LogDir, config = CfgFiles,
event_handlers = EvHandlers,
- suite_callbacks = SuiteCBs,
+ ct_hooks = CTHooks,
include = Include,
silent_connections = SilentConns,
stylesheet = Stylesheet,
@@ -806,15 +806,15 @@ run_spec_file(Relaxed,
AllInclude = merge_vals([Opts#opts.include,
SpecOpts#opts.include]),
- AllSuiteCBs = merge_vals([Opts#opts.suite_callbacks,
- SpecOpts#opts.suite_callbacks]),
+ AllCTHooks = merge_vals([Opts#opts.ct_hooks,
+ SpecOpts#opts.ct_hooks]),
application:set_env(common_test, include, AllInclude),
case check_and_install_configfiles(AllConfig,
which(logdir,LogDir),
AllEvHs,
- AllSuiteCBs) of
+ AllCTHooks) of
ok ->
Opts1 = Opts#opts{label = Label,
cover = Cover,
@@ -825,7 +825,7 @@ run_spec_file(Relaxed,
testspecs = AbsSpecs,
multiply_timetraps = MultTT,
scale_timetraps = ScaleTT,
- suite_callbacks = AllSuiteCBs},
+ ct_hooks = AllCTHooks},
{Run,Skip} = ct_testspec:prepare_tests(TS, node()),
reformat_result(catch do_run(Run, Skip, Opts1, StartOpts));
{error,GCFReason} ->
@@ -836,11 +836,11 @@ run_spec_file(Relaxed,
run_prepared(Run, Skip, Opts = #opts{logdir = LogDir,
config = CfgFiles,
event_handlers = EvHandlers,
- suite_callbacks = SuiteCBs},
+ ct_hooks = CTHooks},
StartOpts) ->
LogDir1 = which(logdir, LogDir),
case check_and_install_configfiles(CfgFiles, LogDir1,
- EvHandlers, SuiteCBs) of
+ EvHandlers, CTHooks) of
ok ->
reformat_result(catch do_run(Run, Skip, Opts#opts{logdir = LogDir1},
StartOpts));
@@ -872,7 +872,7 @@ check_config_file(Callback, File)->
run_dir(Opts = #opts{logdir = LogDir,
config = CfgFiles,
event_handlers = EvHandlers,
- suite_callbacks = SuiteCB }, StartOpts) ->
+ ct_hooks = CTHook }, StartOpts) ->
LogDir1 = which(logdir, LogDir),
Opts1 = Opts#opts{logdir = LogDir1},
AbsCfgFiles =
@@ -895,7 +895,7 @@ run_dir(Opts = #opts{logdir = LogDir,
end, CfgFiles),
case install([{config,AbsCfgFiles},
{event_handler,EvHandlers},
- {suite_callbacks, SuiteCB}], LogDir1) of
+ {ct_hooks, CTHook}], LogDir1) of
ok -> ok;
{error,IReason} -> exit(IReason)
end,
@@ -1001,7 +1001,7 @@ run_testspec1(TestSpec) ->
LogDir1 = which(logdir,Opts#opts.logdir),
case check_and_install_configfiles(Opts#opts.config, LogDir1,
Opts#opts.event_handlers,
- Opts#opts.suite_callbacks) of
+ Opts#opts.ct_hooks) of
ok ->
Opts1 = Opts#opts{testspecs = [],
logdir = LogDir1,
@@ -1019,7 +1019,7 @@ get_data_for_node(#testspec{label = Labels,
config = Cfgs,
userconfig = UsrCfgs,
event_handler = EvHs,
- suite_callbacks = SuCBs,
+ ct_hooks = CTHooks,
include = Incl,
multiply_timetraps = MTs,
scale_timetraps = STs}, Node) ->
@@ -1034,14 +1034,14 @@ get_data_for_node(#testspec{label = Labels,
ConfigFiles = [{?ct_config_txt,F} || {N,F} <- Cfgs, N==Node] ++
[CBF || {N,CBF} <- UsrCfgs, N==Node],
EvHandlers = [{H,A} || {N,H,A} <- EvHs, N==Node],
- SuiteCBs = [CB || {N,CB} <- SuCBs, N==Node],
+ FiltCTHooks = [Hook || {N,Hook} <- CTHooks, N==Node],
Include = [I || {N,I} <- Incl, N==Node],
#opts{label = Label,
logdir = LogDir,
cover = Cover,
config = ConfigFiles,
event_handlers = EvHandlers,
- suite_callbacks = SuiteCBs,
+ ct_hooks = FiltCTHooks,
include = Include,
multiply_timetraps = MT,
scale_timetraps = ST}.
@@ -2074,23 +2074,23 @@ get_start_opt(Key, IfExists, IfNotExists, Args) ->
IfNotExists
end.
-suite_callbacks_args2opts(Args) ->
- suite_callbacks_args2opts(
- proplists:get_value(suite_callbacks, Args, []),[]).
-
-suite_callbacks_args2opts([SCB,Arg,"and"| Rest],Acc) ->
- suite_callbacks_args2opts(Rest,[{list_to_atom(SCB),
- parse_scb_args(Arg)}|Acc]);
-suite_callbacks_args2opts([SCB], Acc) ->
- suite_callbacks_args2opts([SCB,"and"],Acc);
-suite_callbacks_args2opts([SCB, "and" | Rest], Acc) ->
- suite_callbacks_args2opts(Rest,[list_to_atom(SCB)|Acc]);
-suite_callbacks_args2opts([SCB, Args], Acc) ->
- suite_callbacks_args2opts([SCB, Args, "and"],Acc);
-suite_callbacks_args2opts([],Acc) ->
+ct_hooks_args2opts(Args) ->
+ ct_hooks_args2opts(
+ proplists:get_value(ct_hooks, Args, []),[]).
+
+ct_hooks_args2opts([CTH,Arg,"and"| Rest],Acc) ->
+ ct_hooks_args2opts(Rest,[{list_to_atom(CTH),
+ parse_cth_args(Arg)}|Acc]);
+ct_hooks_args2opts([CTH], Acc) ->
+ ct_hooks_args2opts([CTH,"and"],Acc);
+ct_hooks_args2opts([CTH, "and" | Rest], Acc) ->
+ ct_hooks_args2opts(Rest,[list_to_atom(CTH)|Acc]);
+ct_hooks_args2opts([CTH, Args], Acc) ->
+ ct_hooks_args2opts([CTH, Args, "and"],Acc);
+ct_hooks_args2opts([],Acc) ->
lists:reverse(Acc).
-parse_scb_args(String) ->
+parse_cth_args(String) ->
try
true = io_lib:printable_list(String),
{ok,Toks,_} = erl_scan:string(String++"."),
@@ -2228,22 +2228,22 @@ opts2args(EnvStartOpts) ->
end, EHs),
[_LastAnd|StrsR] = lists:reverse(lists:flatten(Strs)),
[{event_handler_init,lists:reverse(StrsR)}];
- ({suite_callbacks,[]}) ->
+ ({ct_hooks,[]}) ->
[];
- ({suite_callbacks,SCBs}) when is_list(SCBs) ->
- io:format(user,"suite_callbacks: ~p",[SCBs]),
+ ({ct_hooks,CTHs}) when is_list(CTHs) ->
+ io:format(user,"ct_hooks: ~p",[CTHs]),
Strs = lists:flatmap(
- fun({SCB,Arg}) ->
- [atom_to_list(SCB),
+ fun({CTH,Arg}) ->
+ [atom_to_list(CTH),
lists:flatten(
io_lib:format("~p",[Arg])),
"and"];
- (SCB) when is_atom(SCB) ->
- [atom_to_list(SCB),"and"]
- end,SCBs),
+ (CTH) when is_atom(CTH) ->
+ [atom_to_list(CTH),"and"]
+ end,CTHs),
[_LastAnd|StrsR] = lists:reverse(Strs),
io:format(user,"return: ~p",[lists:reverse(StrsR)]),
- [{suite_callbacks,lists:reverse(StrsR)}];
+ [{ct_hooks,lists:reverse(StrsR)}];
({Opt,As=[A|_]}) when is_atom(A) ->
[{Opt,[atom_to_list(Atom) || Atom <- As]}];
({Opt,Strs=[S|_]}) when is_list(S) ->
diff --git a/lib/common_test/src/ct_testspec.erl b/lib/common_test/src/ct_testspec.erl
index 942241da6c..db1d4c5fb0 100644
--- a/lib/common_test/src/ct_testspec.erl
+++ b/lib/common_test/src/ct_testspec.erl
@@ -625,19 +625,19 @@ add_tests([{event_handler,Node,H,Args}|Ts],Spec) when is_atom(H) ->
Node1 = ref2node(Node,Spec#testspec.nodes),
add_tests(Ts,Spec#testspec{event_handler=[{Node1,H,Args}|EvHs]});
-%% --- suite_callbacks --
-add_tests([{suite_callbacks, all_nodes, CBs} | Ts], Spec) ->
- Tests = [{suite_callbacks,N,CBs} || N <- list_nodes(Spec)],
+%% --- ct_hooks --
+add_tests([{ct_hooks, all_nodes, Hooks} | Ts], Spec) ->
+ Tests = [{ct_hooks,N,Hooks} || N <- list_nodes(Spec)],
add_tests(Tests ++ Ts, Spec);
-add_tests([{suite_callbacks, Node, [CB|CBs]}|Ts], Spec) ->
- SuiteCbs = Spec#testspec.suite_callbacks,
+add_tests([{ct_hooks, Node, [Hook|Hooks]}|Ts], Spec) ->
+ SuiteCbs = Spec#testspec.ct_hooks,
Node1 = ref2node(Node,Spec#testspec.nodes),
- add_tests([{suite_callbacks, Node, CBs} | Ts],
- Spec#testspec{suite_callbacks = [{Node1,CB} | SuiteCbs]});
-add_tests([{suite_callbacks, _Node, []}|Ts], Spec) ->
+ add_tests([{ct_hooks, Node, Hooks} | Ts],
+ Spec#testspec{ct_hooks = [{Node1,Hook} | SuiteCbs]});
+add_tests([{ct_hooks, _Node, []}|Ts], Spec) ->
add_tests(Ts, Spec);
-add_tests([{suite_callbacks, CBs}|Ts], Spec) ->
- add_tests([{suite_callbacks, all_nodes, CBs}|Ts], Spec);
+add_tests([{ct_hooks, Hooks}|Ts], Spec) ->
+ add_tests([{ct_hooks, all_nodes, Hooks}|Ts], Spec);
%% --- include ---
add_tests([{include,all_nodes,InclDirs}|Ts],Spec) ->
@@ -1065,8 +1065,8 @@ valid_terms() ->
{event_handler,2},
{event_handler,3},
{event_handler,4},
- {suite_callbacks,2},
- {suite_callbacks,3},
+ {ct_hooks,2},
+ {ct_hooks,3},
{multiply_timetraps,2},
{multiply_timetraps,3},
{scale_timetraps,2},
diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl
index 2f5a90a543..45146de57c 100644
--- a/lib/common_test/src/ct_util.erl
+++ b/lib/common_test/src/ct_util.erl
@@ -162,13 +162,13 @@ do_start(Parent,Mode,LogDir) ->
end,
{StartTime,TestLogDir} = ct_logs:init(Mode),
- %% Initiate suite_callbacks
- case catch ct_suite_callback:init(Opts) of
+ %% Initiate ct_hooks
+ case catch ct_hooks:init(Opts) of
ok ->
ok;
- {_,SCBReason} ->
- ct_logs:tc_print('Suite Callback',SCBReason,[]),
- Parent ! {self(), SCBReason},
+ {_,CTHReason} ->
+ ct_logs:tc_print('Suite Callback',CTHReason,[]),
+ Parent ! {self(), CTHReason},
self() ! {{stop,normal},{self(),make_ref()}}
end,
@@ -320,9 +320,9 @@ loop(Mode,TestData,StartDir) ->
node=node(),
data=Time}),
Callbacks = ets:lookup_element(?suite_table,
- suite_callbacks,
+ ct_hooks,
#suite_data.value),
- ct_suite_callback:terminate(Callbacks),
+ ct_hooks:terminate(Callbacks),
close_connections(ets:tab2list(?conn_table)),
ets:delete(?conn_table),
ets:delete(?board_table),
diff --git a/lib/common_test/src/ct_util.hrl b/lib/common_test/src/ct_util.hrl
index 99f029bc0e..4ed29bdcd1 100644
--- a/lib/common_test/src/ct_util.hrl
+++ b/lib/common_test/src/ct_util.hrl
@@ -36,7 +36,7 @@
config=[],
userconfig=[],
event_handler=[],
- suite_callbacks=[],
+ ct_hooks=[],
include=[],
multiply_timetraps=[],
scale_timetraps=[],
diff --git a/lib/common_test/test/Makefile b/lib/common_test/test/Makefile
index 28be9f56f1..be4b4c32b8 100644
--- a/lib/common_test/test/Makefile
+++ b/lib/common_test/test/Makefile
@@ -41,7 +41,7 @@ MODULES= \
ct_config_SUITE \
ct_master_SUITE \
ct_misc_1_SUITE \
- ct_suite_callback_SUITE
+ ct_hooks_SUITE
ERL_FILES= $(MODULES:%=%.erl)
diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/empty_scb.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/empty_scb.erl
deleted file mode 100644
index 41808b4f1d..0000000000
--- a/lib/common_test/test/ct_error_SUITE_data/error/test/empty_scb.erl
+++ /dev/null
@@ -1,187 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2010. All Rights Reserved.
-%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and limitations
-%% under the License.
-%%
-%% %CopyrightEnd%
-%%
-
-%%% @doc Common Test Example Suite Callback module.
-%%%
-%%% <p>This module gives an example of a common test SCB (Suite CallBack).
-%%% There are many ways to add a SCB to a test run, you can do it either in
-%%% the command line using -suite_callback, in a test spec using
-%%% {suite_callback,M} or in the suite it self by returning suite_callback
-%%% from either suite/0, init_per_suite/1, init_per_group/2 and
-%%% init_per_testcase/2. The scope of the SCB is determined by where is it
-%%% started. If it is started in the command line or test spec then it will
-%%% be stopped at the end of all tests. If it is started in init_per_suite,
-%%% it will be stopped after end_per_suite and so on. See terminate
-%%% documentation for a table describing the scoping machanics.
-%%%
-%%% All of callbacks except init/1 in a SCB are optional.</p>
-
--module(empty_scb).
-
-%% Suite Callbacks
--export([init/1]).
-
--export([pre_init_suite/3]).
--export([post_init_suite/3]).
--export([pre_end_suite/3]).
--export([post_end_suite/3]).
-
--export([pre_init_group/3]).
--export([post_init_group/3]).
--export([pre_end_group/3]).
--export([post_end_group/3]).
-
--export([pre_init_tc/3]).
--export([post_end_tc/3]).
-
--export([on_tc_fail/3]).
-
--export([terminate/2]).
-
--type proplist() :: list({atom(),term()}).
--type config() :: proplist().
--type reason() :: term().
--type skip_or_fail() :: {skip, reason()} |
- {auto_skip, reason()} |
- {fail, reason()}.
-
--record(state, { id = ?MODULE :: term()}).
-
-%% @doc Always called before any other callback function. Use this to initiate
-%% any common state. It should return an ID for this SCB and a state. The ID
-%% is used to uniquly identify an SCB instance, if two SCB's return the same
-%% ID the seconds SCB is ignored. This function should NOT have any side
-%% effects as it might be called multiple times by common test.
--spec init(Opts :: proplist()) ->
- {Id :: term(), State :: #state{}}.
-init(Opts) ->
- {?MODULE, #state{ }}.
-
-%% @doc Called before init_per_suite is called. Note that this callback is
-%% only called if the SCB is added before init_per_suite is run (eg. in a test
-%% specification, suite/0 function etc).
-%% You can change the config in the this function.
--spec pre_init_suite(Suite :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {config() | skip_or_fail(), NewState :: #state{}}.
-pre_init_suite(Suite,Config,State) ->
- {Config, State}.
-
-%% @doc Called after init_per_suite.
-%% you can change the config in this function.
--spec post_init_suite(Suite :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {config() | skip_or_fail(), NewState :: #state{}}.
-post_init_suite(Suite,Config,State) ->
- {Config, State}.
-
-%% @doc Called before end_per_suite. Note that the config cannot be
-%% changed here, only the status of the suite.
--spec pre_end_suite(Suite :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {ok | skip_or_fail(), NewState :: #state{}}.
-pre_end_suite(Suite,Config,State) -> {Config, State}.
-
-%% @doc Called after end_per_suite. Note that the config cannot be
-%% changed here, only the status of the suite.
--spec post_end_suite(Suite :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {ok | skip_or_fail(), NewState :: #state{}}.
-post_end_suite(Suite,Config,State) -> {Config, State}.
-
-%% @doc Called before each init_per_group.
-%% You can change the config in this function.
--spec pre_init_group(Group :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {config() | skip_or_fail(), NewState :: #state{}}.
-pre_init_group(Group,Config,State) -> {Config, State}.
-
-%% @doc Called after each init_per_group.
-%% You can change the config in this function.
--spec post_init_group(Group :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {config() | skip_or_fail(), NewState :: #state{}}.
-post_init_group(Group,Config,State) -> {Config, State}.
-
-%% @doc Called after each end_per_group. Note that the config cannot be
-%% changed here, only the status of the group.
--spec pre_end_group(Group :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {ok | skip_or_fail(), NewState :: #state{}}.
-pre_end_group(Group,Config,State) -> {Config, State}.
-
-%% @doc Called after each end_per_group. Note that the config cannot be
-%% changed here, only the status of the group.
--spec post_end_group(Group :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {ok | skip_or_fail(), NewState :: #state{}}.
-post_end_group(Group,Config,State) -> {Config, State}.
-
-%% @doc Called before each test case.
-%% You can change the config in this function.
--spec pre_init_tc(TC :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {config() | skip_or_fail(), NewState :: #state{}}.
-pre_init_tc(TC,Config,State) -> {Config, State}.
-
-%% @doc Called after each test case. Note that the config cannot be
-%% changed here, only the status of the test case.
--spec post_end_tc(TC :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {ok | skip_or_fail(), NewState :: #state{}}.
-post_end_tc(TC,Config,State) -> {Config, State}.
-
-%% @doc Called after post_init_suite, post_end_suite, post_init_group,
-%% post_end_group and post_end_tc if the suite, group or test case failed.
-%% This function should be used for extra cleanup which might be needed.
-%% It is not possible to modify the config or the status of the test run.
--spec on_tc_fail(TC :: init_per_suite | end_per_suite |
- init_per_group | end_per_group | atom(),
- Config :: config(), State :: #state{}) ->
- ok.
-on_tc_fail(_TC, _Config, _State) ->
- ok.
-
-%% @doc Called when the scope of the SCB is done, this depends on
-%% when the SCB was specified. This translation table describes when this
-%% function is called.
-%%
-%% | Started in | terminate called |
-%% |---------------------|-------------------------|
-%% | command_line | after all tests are run |
-%% | test spec | after all tests are run |
-%% | suite/0 | after SUITE is done |
-%% | init_per_suite/1 | after SUITE is done |
-%% | init_per_group/2 | after group is done |
-%% | init_per_testcase/2 | after test case is done |
-%% |-----------------------------------------------|
-%%
--spec terminate(Config :: proplist(), State :: #state{}) ->
- term().
-terminate(Config,State) -> {Config, State}.
diff --git a/lib/common_test/test/ct_hooks_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE.erl
new file mode 100644
index 0000000000..1e187aa205
--- /dev/null
+++ b/lib/common_test/test/ct_hooks_SUITE.erl
@@ -0,0 +1,1021 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2009-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+
+%%%-------------------------------------------------------------------
+%%% File: ct_error_SUITE
+%%%
+%%% Description:
+%%% Test various errors in Common Test suites.
+%%%
+%%% The suites used for the test are located in the data directory.
+%%%-------------------------------------------------------------------
+-module(ct_hooks_SUITE).
+
+-compile(export_all).
+
+-include_lib("test_server/include/test_server.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+-define(eh, ct_test_support_eh).
+
+%%--------------------------------------------------------------------
+%% TEST SERVER CALLBACK FUNCTIONS
+%%--------------------------------------------------------------------
+
+%%--------------------------------------------------------------------
+%% Description: Since Common Test starts another Test Server
+%% instance, the tests need to be performed on a separate node (or
+%% there will be clashes with logging processes etc).
+%%--------------------------------------------------------------------
+init_per_suite(Config) ->
+ DataDir = ?config(data_dir, Config),
+ TestDir = filename:join(DataDir,"cth/tests/"),
+ CTHs = filelib:wildcard(filename:join(TestDir,"*_cth.erl")),
+ io:format("CTHs: ~p",[CTHs]),
+ [io:format("Compiling ~p: ~p",
+ [FileName,compile:file(FileName,[{outdir,TestDir},debug_info])]) ||
+ FileName <- CTHs],
+ ct_test_support:init_per_suite([{path_dirs,[TestDir]} | Config]).
+
+end_per_suite(Config) ->
+ ct_test_support:end_per_suite(Config).
+
+init_per_testcase(TestCase, Config) ->
+ ct_test_support:init_per_testcase(TestCase, Config).
+
+end_per_testcase(TestCase, Config) ->
+ ct_test_support:end_per_testcase(TestCase, Config).
+
+
+suite() ->
+ [{timetrap,{seconds,20}}].
+
+all() ->
+ all(suite).
+
+all(suite) ->
+ lists:reverse(
+ [
+ one_cth, two_cth, faulty_cth_no_init, faulty_cth_id_no_init,
+ faulty_cth_exit_in_init, faulty_cth_exit_in_id,
+ faulty_cth_exit_in_init_scope_suite, minimal_cth,
+ minimal_and_maximal_cth, faulty_cth_undef,
+ scope_per_suite_cth, scope_per_group_cth, scope_suite_cth,
+ scope_per_suite_state_cth, scope_per_group_state_cth,
+ scope_suite_state_cth,
+ fail_pre_suite_cth, fail_post_suite_cth, skip_pre_suite_cth,
+ skip_post_suite_cth, recover_post_suite_cth, update_config_cth,
+ state_update_cth, options_cth, same_id_cth,
+ fail_n_skip_with_minimal_cth
+ ]
+ )
+ .
+
+
+%%--------------------------------------------------------------------
+%% TEST CASES
+%%--------------------------------------------------------------------
+
+%%%-----------------------------------------------------------------
+%%%
+one_cth(Config) when is_list(Config) ->
+ do_test(one_empty_cth, "ct_cth_empty_SUITE.erl",[empty_cth], Config).
+
+two_cth(Config) when is_list(Config) ->
+ do_test(two_empty_cth, "ct_cth_empty_SUITE.erl",[empty_cth,empty_cth],
+ Config).
+
+faulty_cth_no_init(Config) when is_list(Config) ->
+ do_test(faulty_cth_no_init, "ct_cth_empty_SUITE.erl",[askjhdkljashdkaj],
+ Config,{error,"Failed to start CTH, see the "
+ "CT Log for details"}).
+
+faulty_cth_id_no_init(Config) when is_list(Config) ->
+ do_test(faulty_cth_id_no_init, "ct_cth_empty_SUITE.erl",[id_no_init_cth],
+ Config,{error,"Failed to start CTH, see the "
+ "CT Log for details"}).
+
+minimal_cth(Config) when is_list(Config) ->
+ do_test(minimal_cth, "ct_cth_empty_SUITE.erl",[minimal_cth],Config).
+
+minimal_and_maximal_cth(Config) when is_list(Config) ->
+ do_test(minimal_and_maximal_cth, "ct_cth_empty_SUITE.erl",
+ [minimal_cth, empty_cth],Config).
+
+faulty_cth_undef(Config) when is_list(Config) ->
+ do_test(faulty_cth_undef, "ct_cth_empty_SUITE.erl",
+ [undef_cth],Config).
+
+faulty_cth_exit_in_init_scope_suite(Config) when is_list(Config) ->
+ do_test(faulty_cth_exit_in_init_scope_suite,
+ "ct_exit_in_init_scope_suite_cth_SUITE.erl",
+ [],Config).
+
+faulty_cth_exit_in_init(Config) when is_list(Config) ->
+ do_test(faulty_cth_exit_in_init, "ct_cth_empty_SUITE.erl",
+ [crash_init_cth], Config,
+ {error,"Failed to start CTH, see the "
+ "CT Log for details"}).
+
+faulty_cth_exit_in_id(Config) when is_list(Config) ->
+ do_test(faulty_cth_exit_in_id, "ct_cth_empty_SUITE.erl",
+ [crash_id_cth], Config,
+ {error,"Failed to start CTH, see the "
+ "CT Log for details"}).
+
+scope_per_suite_cth(Config) when is_list(Config) ->
+ do_test(scope_per_suite_cth, "ct_scope_per_suite_cth_SUITE.erl",
+ [],Config).
+
+scope_suite_cth(Config) when is_list(Config) ->
+ do_test(scope_suite_cth, "ct_scope_suite_cth_SUITE.erl",
+ [],Config).
+
+scope_per_group_cth(Config) when is_list(Config) ->
+ do_test(scope_per_group_cth, "ct_scope_per_group_cth_SUITE.erl",
+ [],Config).
+
+scope_per_suite_state_cth(Config) when is_list(Config) ->
+ do_test(scope_per_suite_state_cth, "ct_scope_per_suite_state_cth_SUITE.erl",
+ [],Config).
+
+scope_suite_state_cth(Config) when is_list(Config) ->
+ do_test(scope_suite_state_cth, "ct_scope_suite_state_cth_SUITE.erl",
+ [],Config).
+
+scope_per_group_state_cth(Config) when is_list(Config) ->
+ do_test(scope_per_group_state_cth, "ct_scope_per_group_state_cth_SUITE.erl",
+ [],Config).
+
+fail_pre_suite_cth(Config) when is_list(Config) ->
+ do_test(fail_pre_suite_cth, "ct_cth_empty_SUITE.erl",
+ [fail_pre_suite_cth],Config).
+
+fail_post_suite_cth(Config) when is_list(Config) ->
+ do_test(fail_post_suite_cth, "ct_cth_empty_SUITE.erl",
+ [fail_post_suite_cth],Config).
+
+skip_pre_suite_cth(Config) when is_list(Config) ->
+ do_test(skip_pre_suite_cth, "ct_cth_empty_SUITE.erl",
+ [skip_pre_suite_cth],Config).
+
+skip_post_suite_cth(Config) when is_list(Config) ->
+ do_test(skip_post_suite_cth, "ct_cth_empty_SUITE.erl",
+ [skip_post_suite_cth],Config).
+
+recover_post_suite_cth(Config) when is_list(Config) ->
+ do_test(recover_post_suite_cth, "ct_cth_fail_per_suite_SUITE.erl",
+ [recover_post_suite_cth],Config).
+
+update_config_cth(Config) when is_list(Config) ->
+ do_test(update_config_cth, "ct_update_config_SUITE.erl",
+ [update_config_cth],Config).
+
+state_update_cth(Config) when is_list(Config) ->
+ do_test(state_update_cth, "ct_cth_fail_one_skip_one_SUITE.erl",
+ [state_update_cth,state_update_cth],Config).
+
+options_cth(Config) when is_list(Config) ->
+ do_test(options_cth, "ct_cth_empty_SUITE.erl",
+ [{empty_cth,[test]}],Config).
+
+same_id_cth(Config) when is_list(Config) ->
+ do_test(same_id_cth, "ct_cth_empty_SUITE.erl",
+ [same_id_cth,same_id_cth],Config).
+
+fail_n_skip_with_minimal_cth(Config) when is_list(Config) ->
+ do_test(fail_n_skip_with_minimal_cth, "ct_cth_fail_one_skip_one_SUITE.erl",
+ [minimal_terminate_cth],Config).
+
+%%%-----------------------------------------------------------------
+%%% HELP FUNCTIONS
+%%%-----------------------------------------------------------------
+
+do_test(Tag, SWC, CTHs, Config) ->
+ do_test(Tag, SWC, CTHs, Config, ok).
+do_test(Tag, SWC, CTHs, Config, {error,_} = Res) ->
+ do_test(Tag, SWC, CTHs, Config, Res, 1);
+do_test(Tag, SWC, CTHs, Config, Res) ->
+ do_test(Tag, SWC, CTHs, Config, Res, 2).
+
+do_test(Tag, SuiteWildCard, CTHs, Config, Res, EC) ->
+
+ DataDir = ?config(data_dir, Config),
+ Suites = filelib:wildcard(
+ filename:join([DataDir,"cth/tests",SuiteWildCard])),
+ {Opts,ERPid} = setup([{suite,Suites},
+ {ct_hooks,CTHs},{label,Tag}], Config),
+ Res = ct_test_support:run(Opts, Config),
+ Events = ct_test_support:get_events(ERPid, Config),
+
+ ct_test_support:log_events(Tag,
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config)),
+
+ TestEvents = events_to_check(Tag, EC),
+ ok = ct_test_support:verify_events(TestEvents, Events, Config).
+
+setup(Test, Config) ->
+ Opts0 = ct_test_support:get_opts(Config),
+ Level = ?config(trace_level, Config),
+ EvHArgs = [{cbm,ct_test_support},{trace_level,Level}],
+ Opts = Opts0 ++ [{event_handler,{?eh,EvHArgs}}|Test],
+ ERPid = ct_test_support:start_event_receiver(Config),
+ {Opts,ERPid}.
+
+reformat(Events, EH) ->
+ ct_test_support:reformat(Events, EH).
+%reformat(Events, _EH) ->
+% Events.
+
+%%%-----------------------------------------------------------------
+%%% TEST EVENTS
+%%%-----------------------------------------------------------------
+events_to_check(Test) ->
+ %% 2 tests (ct:run_test + script_start) is default
+ events_to_check(Test, 2).
+
+events_to_check(_, 0) ->
+ [];
+events_to_check(Test, N) ->
+ test_events(Test) ++ events_to_check(Test, N-1).
+
+test_events(one_empty_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{empty_cth,id,[[]]}},
+ {?eh,cth,{empty_cth,init,[{'_','_','_'},[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
+ {?eh,cth,{empty_cth,pre_init_per_suite,
+ [ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{empty_cth,post_init_per_suite,
+ [ct_cth_empty_SUITE,'$proplist','$proplist',[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,test_case}},
+ {?eh,cth,{empty_cth,pre_init_per_testcase,[test_case,'$proplist',[]]}},
+ {?eh,cth,{empty_cth,post_end_per_testcase,[test_case,'$proplist','_',[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}},
+ {?eh,cth,{empty_cth,pre_end_per_suite,
+ [ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{empty_cth,post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth,{empty_cth,terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(two_empty_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{'_',id,[[]]}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,cth,{'_',id,[[]]}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
+ {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist','$proplist',[]]}},
+ {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist','$proplist',[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
+ {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
+ {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}},
+ {?eh,cth,{'_',pre_end_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',pre_end_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[]]}},
+ {?eh,cth,{'_',post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth,{'_',terminate,[[]]}},
+ {?eh,cth,{'_',terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(faulty_cth_no_init) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(faulty_cth_id_no_init) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{'_',id,[[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {negative,{?eh,tc_start,'_'},
+ {?eh,test_done,{'DEF','STOP_TIME'}}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(minimal_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {negative,{?eh,cth,{'_',id,['_',[]]}},
+ {?eh,cth,{'_',init,['_',[]]}}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,test_case}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(minimal_and_maximal_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {negative,{?eh,cth,{'_',id,['_',[]]}},
+ {?eh,cth,{'_',init,['_',[]]}}},
+ {?eh,cth,{'_',id,[[]]}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
+ {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist','$proplist',[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}},
+ {?eh,cth,{'_',pre_end_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth,{'_',terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(faulty_cth_undef) ->
+ FailReasonStr = "undef_cth:pre_init_per_suite/3 CTH call failed",
+ FailReason = {ct_cth_empty_SUITE,init_per_suite,
+ {failed,FailReasonStr}},
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,
+ {failed, {error,FailReasonStr}}}},
+ {?eh,cth,{'_',on_tc_fail,'_'}},
+
+ {?eh,tc_auto_skip,{ct_cth_empty_SUITE,test_case,
+ {failed, FailReason}}},
+ {?eh,cth,{'_',on_tc_skip,'_'}},
+
+ {?eh,tc_auto_skip,{ct_cth_empty_SUITE,end_per_suite,
+ {failed, FailReason}}},
+ {?eh,cth,{'_',on_tc_skip,'_'}},
+
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(faulty_cth_exit_in_init_scope_suite) ->
+ [{?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{'_',init_per_suite}},
+ {?eh,cth,{empty_cth,init,['_',[]]}},
+ {?eh,tc_done,
+ {ct_exit_in_init_scope_suite_cth_SUITE,init_per_suite,
+ {failed,
+ {error,
+ "Failed to start CTH, see the CT Log for details"}}}},
+ {?eh,tc_auto_skip,
+ {ct_exit_in_init_scope_suite_cth_SUITE,test_case,
+ {failed,
+ {ct_exit_in_init_scope_suite_cth_SUITE,init_per_suite,
+ {failed,
+ "Failed to start CTH, see the CT Log for details"}}}}},
+ {?eh,tc_auto_skip,
+ {ct_exit_in_init_scope_suite_cth_SUITE,end_per_suite,
+ {failed,
+ {ct_exit_in_init_scope_suite_cth_SUITE,init_per_suite,
+ {failed,
+ "Failed to start CTH, see the CT Log for details"}}}}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}];
+
+test_events(faulty_cth_exit_in_init) ->
+ [{?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{empty_cth,init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}];
+
+test_events(faulty_cth_exit_in_id) ->
+ [{?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{empty_cth,id,[[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {negative, {?eh,tc_start,'_'},
+ {?eh,test_done,{'DEF','STOP_TIME'}}},
+ {?eh,stop_logging,[]}];
+
+test_events(scope_per_suite_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_scope_per_suite_cth_SUITE,init_per_suite}},
+ {?eh,cth,{'_',id,[[]]}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,cth,{'_',post_init_per_suite,[ct_scope_per_suite_cth_SUITE,'$proplist','$proplist',[]]}},
+ {?eh,tc_done,{ct_scope_per_suite_cth_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_scope_per_suite_cth_SUITE,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
+ {?eh,tc_done,{ct_scope_per_suite_cth_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_scope_per_suite_cth_SUITE,end_per_suite}},
+ {?eh,cth,{'_',pre_end_per_suite,
+ [ct_scope_per_suite_cth_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_suite,[ct_scope_per_suite_cth_SUITE,'$proplist','_',[]]}},
+ {?eh,cth,{'_',terminate,[[]]}},
+ {?eh,tc_done,{ct_scope_per_suite_cth_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(scope_suite_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_scope_suite_cth_SUITE,init_per_suite}},
+ {?eh,cth,{'_',id,[[]]}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,cth,{'_',pre_init_per_suite,[ct_scope_suite_cth_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_init_per_suite,[ct_scope_suite_cth_SUITE,'$proplist','$proplist',[]]}},
+ {?eh,tc_done,{ct_scope_suite_cth_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_scope_suite_cth_SUITE,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
+ {?eh,tc_done,{ct_scope_suite_cth_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_scope_suite_cth_SUITE,end_per_suite}},
+ {?eh,cth,{'_',pre_end_per_suite,[ct_scope_suite_cth_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_suite,[ct_scope_suite_cth_SUITE,'$proplist','_',[]]}},
+ {?eh,cth,{'_',terminate,[[]]}},
+ {?eh,tc_done,{ct_scope_suite_cth_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(scope_per_group_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_scope_per_group_cth_SUITE,init_per_suite}},
+ {?eh,tc_done,{ct_scope_per_group_cth_SUITE,init_per_suite,ok}},
+
+ [{?eh,tc_start,{ct_scope_per_group_cth_SUITE,{init_per_group,group1,[]}}},
+ {?eh,cth,{'_',id,[[]]}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,cth,{'_',post_init_per_group,[group1,'$proplist','$proplist',[]]}},
+ {?eh,tc_done,{ct_scope_per_group_cth_SUITE,{init_per_group,group1,[]},ok}},
+
+ {?eh,tc_start,{ct_scope_per_group_cth_SUITE,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
+ {?eh,tc_done,{ct_scope_per_group_cth_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_scope_per_group_cth_SUITE,{end_per_group,group1,[]}}},
+ {?eh,cth,{'_',pre_end_per_group,[group1,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_group,[group1,'$proplist','_',[]]}},
+ {?eh,cth,{'_',terminate,[[]]}},
+ {?eh,tc_done,{ct_scope_per_group_cth_SUITE,{end_per_group,group1,[]},ok}}],
+
+ {?eh,tc_start,{ct_scope_per_group_cth_SUITE,end_per_suite}},
+ {?eh,tc_done,{ct_scope_per_group_cth_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(scope_per_suite_state_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_scope_per_suite_state_cth_SUITE,init_per_suite}},
+ {?eh,cth,{'_',id,[[test]]}},
+ {?eh,cth,{'_',init,['_',[test]]}},
+ {?eh,cth,{'_',post_init_per_suite,[ct_scope_per_suite_state_cth_SUITE,'$proplist','$proplist',[test]]}},
+ {?eh,tc_done,{ct_scope_per_suite_state_cth_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_scope_per_suite_state_cth_SUITE,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[test]]}},
+ {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[test]]}},
+ {?eh,tc_done,{ct_scope_per_suite_state_cth_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_scope_per_suite_state_cth_SUITE,end_per_suite}},
+ {?eh,cth,{'_',pre_end_per_suite,
+ [ct_scope_per_suite_state_cth_SUITE,'$proplist',[test]]}},
+ {?eh,cth,{'_',post_end_per_suite,[ct_scope_per_suite_state_cth_SUITE,'$proplist','_',[test]]}},
+ {?eh,cth,{'_',terminate,[[test]]}},
+ {?eh,tc_done,{ct_scope_per_suite_state_cth_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(scope_suite_state_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_scope_suite_state_cth_SUITE,init_per_suite}},
+ {?eh,cth,{'_',id,[[test]]}},
+ {?eh,cth,{'_',init,['_',[test]]}},
+ {?eh,cth,{'_',pre_init_per_suite,[ct_scope_suite_state_cth_SUITE,'$proplist',[test]]}},
+ {?eh,cth,{'_',post_init_per_suite,[ct_scope_suite_state_cth_SUITE,'$proplist','$proplist',[test]]}},
+ {?eh,tc_done,{ct_scope_suite_state_cth_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_scope_suite_state_cth_SUITE,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[test]]}},
+ {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[test]]}},
+ {?eh,tc_done,{ct_scope_suite_state_cth_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_scope_suite_state_cth_SUITE,end_per_suite}},
+ {?eh,cth,{'_',pre_end_per_suite,[ct_scope_suite_state_cth_SUITE,'$proplist',[test]]}},
+ {?eh,cth,{'_',post_end_per_suite,[ct_scope_suite_state_cth_SUITE,'$proplist','_',[test]]}},
+ {?eh,cth,{'_',terminate,[[test]]}},
+ {?eh,tc_done,{ct_scope_suite_state_cth_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(scope_per_group_state_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_scope_per_group_state_cth_SUITE,init_per_suite}},
+ {?eh,tc_done,{ct_scope_per_group_state_cth_SUITE,init_per_suite,ok}},
+
+ [{?eh,tc_start,{ct_scope_per_group_state_cth_SUITE,{init_per_group,group1,[]}}},
+ {?eh,cth,{'_',id,[[test]]}},
+ {?eh,cth,{'_',init,['_',[test]]}},
+ {?eh,cth,{'_',post_init_per_group,[group1,'$proplist','$proplist',[test]]}},
+ {?eh,tc_done,{ct_scope_per_group_state_cth_SUITE,{init_per_group,group1,[]},ok}},
+
+ {?eh,tc_start,{ct_scope_per_group_state_cth_SUITE,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[test]]}},
+ {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[test]]}},
+ {?eh,tc_done,{ct_scope_per_group_state_cth_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_scope_per_group_state_cth_SUITE,{end_per_group,group1,[]}}},
+ {?eh,cth,{'_',pre_end_per_group,[group1,'$proplist',[test]]}},
+ {?eh,cth,{'_',post_end_per_group,[group1,'$proplist','_',[test]]}},
+ {?eh,cth,{'_',terminate,[[test]]}},
+ {?eh,tc_done,{ct_scope_per_group_state_cth_SUITE,{end_per_group,group1,[]},ok}}],
+
+ {?eh,tc_start,{ct_scope_per_group_state_cth_SUITE,end_per_suite}},
+ {?eh,tc_done,{ct_scope_per_group_state_cth_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(fail_pre_suite_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
+ {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist',
+ {fail,"Test failure"},[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,
+ {failed, {error,"Test failure"}}}},
+ {?eh,cth,{'_',on_tc_fail,
+ [init_per_suite,{failed,"Test failure"},[]]}},
+
+
+ {?eh,tc_auto_skip,{ct_cth_empty_SUITE,test_case,
+ {failed,{ct_cth_empty_SUITE,init_per_suite,
+ {failed,"Test failure"}}}}},
+ {?eh,cth,{'_',on_tc_skip,
+ [test_case, {tc_auto_skip,
+ {failed, {ct_cth_empty_SUITE, init_per_suite,
+ {failed, "Test failure"}}}},[]]}},
+
+
+ {?eh,tc_auto_skip, {ct_cth_empty_SUITE, end_per_suite,
+ {failed, {ct_cth_empty_SUITE, init_per_suite,
+ {failed, "Test failure"}}}}},
+ {?eh,cth,{'_',on_tc_skip,
+ [end_per_suite, {tc_auto_skip,
+ {failed, {ct_cth_empty_SUITE, init_per_suite,
+ {failed, "Test failure"}}}},[]]}},
+
+
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth, {'_',terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(fail_post_suite_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
+ {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist','$proplist',[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,
+ {failed,{error,"Test failure"}}}},
+ {?eh,cth,{'_',on_tc_fail,[init_per_suite, {failed,"Test failure"}, []]}},
+
+ {?eh,tc_auto_skip,{ct_cth_empty_SUITE,test_case,
+ {failed,{ct_cth_empty_SUITE,init_per_suite,
+ {failed,"Test failure"}}}}},
+ {?eh,cth,{'_',on_tc_skip,[test_case,{tc_auto_skip,'_'},[]]}},
+
+ {?eh,tc_auto_skip, {ct_cth_empty_SUITE, end_per_suite,
+ {failed, {ct_cth_empty_SUITE, init_per_suite,
+ {failed, "Test failure"}}}}},
+ {?eh,cth,{'_',on_tc_skip,[end_per_suite,{tc_auto_skip,'_'},[]]}},
+
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth, {'_',terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(skip_pre_suite_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
+ {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist',{skip,"Test skip"},[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,{skipped,"Test skip"}}},
+ {?eh,cth,{'_',on_tc_skip,
+ [init_per_suite,{tc_user_skip,{skipped,"Test skip"}},[]]}},
+
+ {?eh,tc_auto_skip,{ct_cth_empty_SUITE,test_case,"Test skip"}},
+ {?eh,cth,{'_',on_tc_skip,[test_case,{tc_auto_skip,"Test skip"},[]]}},
+
+ {?eh,tc_auto_skip, {ct_cth_empty_SUITE, end_per_suite,"Test skip"}},
+ {?eh,cth,{'_',on_tc_skip,[end_per_suite,{tc_auto_skip,"Test skip"},[]]}},
+
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth, {'_',terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(skip_post_suite_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
+ {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist','$proplist',[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,{skipped,"Test skip"}}},
+ {?eh,cth,{'_',on_tc_skip,
+ [init_per_suite,{tc_user_skip,{skipped,"Test skip"}},[]]}},
+
+ {?eh,tc_auto_skip,{ct_cth_empty_SUITE,test_case,"Test skip"}},
+ {?eh,cth,{'_',on_tc_skip,[test_case,{tc_auto_skip,"Test skip"},[]]}},
+
+ {?eh,tc_auto_skip, {ct_cth_empty_SUITE, end_per_suite,"Test skip"}},
+ {?eh,cth,{'_',on_tc_skip,[end_per_suite,{tc_auto_skip,"Test skip"},[]]}},
+
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth,{'_',terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(recover_post_suite_cth) ->
+ Suite = ct_cth_fail_per_suite_SUITE,
+ [
+ {?eh,start_logging,'_'},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{Suite,init_per_suite}},
+ {?eh,cth,{'_',pre_init_per_suite,[Suite,'$proplist','$proplist']}},
+ {?eh,cth,{'_',post_init_per_suite,[Suite,contains([tc_status]),
+ {'EXIT',{'_','_'}},[]]}},
+ {?eh,tc_done,{Suite,init_per_suite,ok}},
+
+ {?eh,tc_start,{Suite,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase,
+ [test_case, not_contains([tc_status]),[]]}},
+ {?eh,cth,{'_',post_end_per_testcase,
+ [test_case, contains([tc_status]),'_',[]]}},
+ {?eh,tc_done,{Suite,test_case,ok}},
+
+ {?eh,tc_start,{Suite,end_per_suite}},
+ {?eh,cth,{'_',pre_end_per_suite,
+ [Suite,not_contains([tc_status]),[]]}},
+ {?eh,cth,{'_',post_end_per_suite,
+ [Suite,not_contains([tc_status]),'_',[]]}},
+ {?eh,tc_done,{Suite,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth,{'_',terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(update_config_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+
+ {?eh,tc_start,{ct_update_config_SUITE,init_per_suite}},
+ {?eh,cth,{'_',pre_init_per_suite,
+ [ct_update_config_SUITE,contains([]),[]]}},
+ {?eh,cth,{'_',post_init_per_suite,
+ [ct_update_config_SUITE,
+ '$proplist',
+ contains(
+ [init_per_suite,
+ pre_init_per_suite]),
+ []]}},
+ {?eh,tc_done,{ct_update_config_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_update_config_SUITE, {init_per_group,group1,[]}}},
+ {?eh,cth,{'_',pre_init_per_group,
+ [group1,contains(
+ [post_init_per_suite,
+ init_per_suite,
+ pre_init_per_suite]),
+ []]}},
+ {?eh,cth,{'_',post_init_per_group,
+ [group1,
+ contains(
+ [post_init_per_suite,
+ init_per_suite,
+ pre_init_per_suite]),
+ contains(
+ [init_per_group,
+ pre_init_per_group,
+ post_init_per_suite,
+ init_per_suite,
+ pre_init_per_suite]),
+ []]}},
+ {?eh,tc_done,{ct_update_config_SUITE,{init_per_group,group1,[]},ok}},
+
+ {?eh,tc_start,{ct_update_config_SUITE,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase,
+ [test_case,contains(
+ [post_init_per_group,
+ init_per_group,
+ pre_init_per_group,
+ post_init_per_suite,
+ init_per_suite,
+ pre_init_per_suite]),
+ []]}},
+ {?eh,cth,{'_',post_end_per_testcase,
+ [test_case,contains(
+ [init_per_testcase,
+ pre_init_per_testcase,
+ post_init_per_group,
+ init_per_group,
+ pre_init_per_group,
+ post_init_per_suite,
+ init_per_suite,
+ pre_init_per_suite]),
+ ok,[]]}},
+ {?eh,tc_done,{ct_update_config_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_update_config_SUITE, {end_per_group,group1,[]}}},
+ {?eh,cth,{'_',pre_end_per_group,
+ [group1,contains(
+ [post_init_per_group,
+ init_per_group,
+ pre_init_per_group,
+ post_init_per_suite,
+ init_per_suite,
+ pre_init_per_suite]),
+ []]}},
+ {?eh,cth,{'_',post_end_per_group,
+ [group1,
+ contains(
+ [pre_end_per_group,
+ post_init_per_group,
+ init_per_group,
+ pre_init_per_group,
+ post_init_per_suite,
+ init_per_suite,
+ pre_init_per_suite]),
+ ok,[]]}},
+ {?eh,tc_done,{ct_update_config_SUITE,{end_per_group,group1,[]},ok}},
+
+ {?eh,tc_start,{ct_update_config_SUITE,end_per_suite}},
+ {?eh,cth,{'_',pre_end_per_suite,
+ [ct_update_config_SUITE,contains(
+ [post_init_per_suite,
+ init_per_suite,
+ pre_init_per_suite]),
+ []]}},
+ {?eh,cth,{'_',post_end_per_suite,
+ [ct_update_config_SUITE,contains(
+ [pre_end_per_suite,
+ post_init_per_suite,
+ init_per_suite,
+ pre_init_per_suite]),
+ '_',[]]}},
+ {?eh,tc_done,{ct_update_config_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth,{'_',terminate,[contains(
+ [post_end_per_suite,
+ pre_end_per_suite,
+ post_init_per_suite,
+ init_per_suite,
+ pre_init_per_suite])]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(state_update_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{'_',init_per_suite}},
+
+ {?eh,tc_done,{'_',end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth,{'_',terminate,[contains(
+ [post_end_per_suite,pre_end_per_suite,
+ post_end_per_group,pre_end_per_group,
+ {not_in_order,
+ [post_end_per_testcase,pre_init_per_testcase,
+ on_tc_skip,post_end_per_testcase,
+ pre_init_per_testcase,on_tc_fail,
+ post_end_per_testcase,pre_init_per_testcase]
+ },
+ post_init_per_group,pre_init_per_group,
+ post_init_per_suite,pre_init_per_suite,
+ init])]}},
+ {?eh,cth,{'_',terminate,[contains(
+ [post_end_per_suite,pre_end_per_suite,
+ post_end_per_group,pre_end_per_group,
+ {not_in_order,
+ [post_end_per_testcase,pre_init_per_testcase,
+ on_tc_skip,post_end_per_testcase,
+ pre_init_per_testcase,on_tc_fail,
+ post_end_per_testcase,pre_init_per_testcase]
+ },
+ post_init_per_group,pre_init_per_group,
+ post_init_per_suite,pre_init_per_suite,
+ init]
+ )]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(options_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{empty_cth,init,['_',[test]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
+ {?eh,cth,{empty_cth,pre_init_per_suite,
+ [ct_cth_empty_SUITE,'$proplist',[test]]}},
+ {?eh,cth,{empty_cth,post_init_per_suite,
+ [ct_cth_empty_SUITE,'$proplist','$proplist',[test]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,test_case}},
+ {?eh,cth,{empty_cth,pre_init_per_testcase,[test_case,'$proplist',[test]]}},
+ {?eh,cth,{empty_cth,post_end_per_testcase,[test_case,'$proplist','_',[test]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}},
+ {?eh,cth,{empty_cth,pre_end_per_suite,
+ [ct_cth_empty_SUITE,'$proplist',[test]]}},
+ {?eh,cth,{empty_cth,post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[test]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth,{empty_cth,terminate,[[test]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(same_id_cth) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{'_',id,[[]]}},
+ {?eh,cth,{'_',init,[same_id_cth,[]]}},
+ {?eh,cth,{'_',id,[[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
+ {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {negative,
+ {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_init_per_suite,
+ [ct_cth_empty_SUITE,'$proplist','$proplist',[]]}}},
+ {negative,
+ {?eh,cth,{'_',post_init_per_suite,
+ [ct_cth_empty_SUITE,'$proplist','$proplist',[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
+ {negative,
+ {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}}},
+ {negative,
+ {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}}},
+
+ {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}},
+ {?eh,cth,{'_',pre_end_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {negative,
+ {?eh,cth,{'_',pre_end_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
+ {?eh,cth,{'_',post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[]]}}},
+ {negative,
+ {?eh,cth,{'_',post_end_per_suite,
+ [ct_cth_empty_SUITE,'$proplist','_',[]]}},
+ {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,cth,{'_',terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(fail_n_skip_with_minimal_cth) ->
+ [{?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,cth,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{'_',init_per_suite}},
+
+ {?eh,tc_done,{'_',end_per_suite,ok}},
+ {?eh,cth,{'_',terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(ok) ->
+ ok.
+
+
+%% test events help functions
+contains(List) ->
+ fun(Proplist) when is_list(Proplist) ->
+ contains(List,Proplist)
+ end.
+
+contains([{not_in_order,List}|T],Rest) ->
+ contains_parallel(List,Rest),
+ contains(T,Rest);
+contains([{Ele,Pos}|T] = L,[H|T2]) ->
+ case element(Pos,H) of
+ Ele ->
+ contains(T,T2);
+ _ ->
+ contains(L,T2)
+ end;
+contains([Ele|T],[{Ele,_}|T2])->
+ contains(T,T2);
+contains([Ele|T],[Ele|T2])->
+ contains(T,T2);
+contains(List,[_|T]) ->
+ contains(List,T);
+contains([],_) ->
+ match.
+
+contains_parallel([Key | T], Elems) ->
+ contains([Key],Elems),
+ contains_parallel(T,Elems);
+contains_parallel([],_Elems) ->
+ match.
+
+not_contains(List) ->
+ fun(Proplist) when is_list(Proplist) ->
+ [] = [Ele || {Ele,_} <- Proplist,
+ Test <- List,
+ Test =:= Ele]
+ end.
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_id_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_id_cth.erl
index 2c256c46df..02c36e378c 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_id_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_id_cth.erl
@@ -18,17 +18,17 @@
%%
--module(crash_id_scb).
+-module(crash_id_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-export([id/1]).
id(Opts) ->
- empty_scb:id(Opts),
+ empty_cth:id(Opts),
exit(diediedie).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_init_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_init_cth.erl
index c4138bbcef..6ed23565f6 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_init_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_init_cth.erl
@@ -18,17 +18,17 @@
%%
--module(crash_init_scb).
+-module(crash_init_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-export([init/2]).
init(Id, Opts) ->
- empty_scb:init(Id, Opts),
+ empty_cth:init(Id, Opts),
exit(diediedie).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scb_empty_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_empty_SUITE.erl
index 0eb40bce00..499069b382 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scb_empty_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_empty_SUITE.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(ct_scb_empty_SUITE).
+-module(ct_cth_empty_SUITE).
-suite_defaults([{timetrap, {minutes, 10}}]).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scb_fail_one_skip_one_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_one_skip_one_SUITE.erl
index 593bd4a534..017812c719 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scb_fail_one_skip_one_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_one_skip_one_SUITE.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(ct_scb_fail_one_skip_one_SUITE).
+-module(ct_cth_fail_one_skip_one_SUITE).
-suite_defaults([{timetrap, {minutes, 10}}]).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scb_fail_per_suite_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_per_suite_SUITE.erl
index dfc7c37e8d..136a15ec96 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scb_fail_per_suite_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_per_suite_SUITE.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(ct_scb_fail_per_suite_SUITE).
+-module(ct_cth_fail_per_suite_SUITE).
-suite_defaults([{timetrap, {minutes, 10}}]).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_exit_in_init_scope_suite_scb_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_exit_in_init_scope_suite_cth_SUITE.erl
index bfaeb7ca3a..42be0a659e 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_exit_in_init_scope_suite_scb_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_exit_in_init_scope_suite_cth_SUITE.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(ct_exit_in_init_scope_suite_scb_SUITE).
+-module(ct_exit_in_init_scope_suite_cth_SUITE).
-suite_defaults([{timetrap, {minutes, 10}}]).
@@ -28,7 +28,7 @@
%% Test server callback functions
suite() ->
- [{suite_callbacks,[crash_init_scb]}].
+ [{ct_hooks,[crash_init_cth]}].
init_per_suite(Config) ->
Config.
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_group_scb_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_cth_SUITE.erl
index 8df4a6d522..628bca774c 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_group_scb_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_cth_SUITE.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(ct_scope_per_group_scb_SUITE).
+-module(ct_scope_per_group_cth_SUITE).
-suite_defaults([{timetrap, {minutes, 10}}]).
@@ -40,7 +40,7 @@ end_per_testcase(_TestCase, _Config) ->
ok.
init_per_group(GroupName, Config) ->
- [{suite_callbacks,[empty_scb]}|Config].
+ [{ct_hooks,[empty_cth]}|Config].
end_per_group(GroupName, Config) ->
ok.
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_group_state_scb_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_state_cth_SUITE.erl
index 63dd767b25..14ea52bf8c 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_group_state_scb_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_state_cth_SUITE.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(ct_scope_per_group_state_scb_SUITE).
+-module(ct_scope_per_group_state_cth_SUITE).
-suite_defaults([{timetrap, {minutes, 10}}]).
@@ -40,7 +40,7 @@ end_per_testcase(_TestCase, _Config) ->
ok.
init_per_group(_GroupName, Config) ->
- [{suite_callbacks,[{empty_scb,[test]}]}|Config].
+ [{ct_hooks,[{empty_cth,[test]}]}|Config].
end_per_group(_GroupName, _Config) ->
ok.
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_suite_scb_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_cth_SUITE.erl
index 5492243b1b..5c1658be44 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_suite_scb_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_cth_SUITE.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(ct_scope_per_suite_scb_SUITE).
+-module(ct_scope_per_suite_cth_SUITE).
-suite_defaults([{timetrap, {minutes, 10}}]).
@@ -28,7 +28,7 @@
%% Test server callback functions
init_per_suite(Config) ->
- [{suite_callbacks,[empty_scb]}|Config].
+ [{ct_hooks,[empty_cth]}|Config].
end_per_suite(_Config) ->
ok.
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_suite_state_scb_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_state_cth_SUITE.erl
index 02a011f91b..96d00e3b28 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_suite_state_scb_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_state_cth_SUITE.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(ct_scope_per_suite_state_scb_SUITE).
+-module(ct_scope_per_suite_state_cth_SUITE).
-suite_defaults([{timetrap, {minutes, 10}}]).
@@ -28,7 +28,7 @@
%% Test server callback functions
init_per_suite(Config) ->
- [{suite_callbacks,[{empty_scb,[test]}]}|Config].
+ [{ct_hooks,[{empty_cth,[test]}]}|Config].
end_per_suite(_Config) ->
ok.
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_tc_scb_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_tc_cth_SUITE.erl
index d99e741553..fa632444c5 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_per_tc_scb_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_tc_cth_SUITE.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(ct_scope_per_tc_scb_SUITE).
+-module(ct_scope_per_tc_cth_SUITE).
-suite_defaults([{timetrap, {minutes, 10}}]).
@@ -73,7 +73,7 @@ end_per_suite(_Config) ->
%% @end
%%--------------------------------------------------------------------
init_per_testcase(_TestCase, Config) ->
- [{suite_callbacks,[empty_scb]}|Config].
+ [{ct_hooks,[empty_cth]}|Config].
%%--------------------------------------------------------------------
%% @doc
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_suite_scb_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_cth_SUITE.erl
index 7598c911b1..988a0969ca 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_suite_scb_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_cth_SUITE.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(ct_scope_suite_scb_SUITE).
+-module(ct_scope_suite_cth_SUITE).
-suite_defaults([{timetrap, {minutes, 10}}]).
@@ -28,7 +28,7 @@
%% Test server callback functions
suite() ->
- [{suite_callbacks,[empty_scb]}].
+ [{ct_hooks,[empty_cth]}].
init_per_suite(Config) ->
Config.
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_suite_state_scb_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_state_cth_SUITE.erl
index 869532f5cd..18b68fbcdc 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_scope_suite_state_scb_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_state_cth_SUITE.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(ct_scope_suite_state_scb_SUITE).
+-module(ct_scope_suite_state_cth_SUITE).
-suite_defaults([{timetrap, {minutes, 10}}]).
@@ -28,7 +28,7 @@
%% Test server callback functions
suite() ->
- [{suite_callbacks,[{empty_scb,[test]}]}].
+ [{ct_hooks,[{empty_cth,[test]}]}].
init_per_suite(Config) ->
Config.
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_update_config_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_update_config_SUITE.erl
index 57fea347f6..57fea347f6 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/ct_update_config_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_update_config_SUITE.erl
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/empty_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl
index a82ca02d04..7654a7ee2f 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/empty_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl
@@ -19,22 +19,22 @@
%%% @doc Common Test Example Suite Callback module.
%%%
-%%% <p>This module gives an example of a common test SCB (Suite CallBack).
-%%% There are many ways to add a SCB to a test run, you can do it either in
-%%% the command line using -suite_callback, in a test spec using
-%%% {suite_callback,M} or in the suite it self by returning suite_callback
+%%% <p>This module gives an example of a common test CTH (Common Test Hook).
+%%% There are many ways to add a CTH to a test run, you can do it either in
+%%% the command line using -ct_hook, in a test spec using
+%%% {ct_hook,M} or in the suite it self by returning ct_hook
%%% from either suite/0, init_per_suite/1, init_per_group/2 and
-%%% init_per_testcase/2. The scope of the SCB is determined by where is it
+%%% init_per_testcase/2. The scope of the CTH is determined by where is it
%%% started. If it is started in the command line or test spec then it will
%%% be stopped at the end of all tests. If it is started in init_per_suite,
%%% it will be stopped after end_per_suite and so on. See terminate
%%% documentation for a table describing the scoping machanics.
%%%
-%%% All of callbacks except init/1 in a SCB are optional.</p>
+%%% All of callbacks except init/1 in a CTH are optional.</p>
--module(empty_scb).
+-module(empty_cth).
-%% Suite Callbacks
+%% CT Hooks
-export([id/1]).
-export([init/2]).
@@ -69,26 +69,26 @@
-record(state, { id = ?MODULE :: term()}).
%% @doc Always called before any other callback function. Use this to initiate
-%% any common state. It should return an ID for this SCB and a state.
+%% any common state. It should return an state for this CTH.
-spec init(Id :: term(), Opts :: proplist()) ->
{Id :: term(), State :: #state{}}.
init(Id, Opts) ->
- gen_event:notify(?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ gen_event:notify(?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, init, [Id, Opts]}}),
Opts.
-%% @doc The ID is used to uniquly identify an SCB instance, if two SCB's
-%% return the same ID the seconds SCB is ignored. This function should NOT
+%% @doc The ID is used to uniquly identify an CTH instance, if two CTH's
+%% return the same ID the seconds CTH is ignored. This function should NOT
%% have any side effects as it might be called multiple times by common test.
-spec id(Opts :: proplist()) ->
Id :: term().
id(Opts) ->
- gen_event:notify(?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ gen_event:notify(?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, id, [Opts]}}),
now().
%% @doc Called before init_per_suite is called. Note that this callback is
-%% only called if the SCB is added before init_per_suite is run (eg. in a test
+%% only called if the CTH is added before init_per_suite is run (eg. in a test
%% specification, suite/0 function etc).
%% You can change the config in the this function.
-spec pre_init_per_suite(Suite :: atom(),
@@ -97,7 +97,7 @@ id(Opts) ->
{config() | skip_or_fail(), NewState :: #state{}}.
pre_init_per_suite(Suite,Config,State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, pre_init_per_suite,
[Suite,Config,State]}}),
{Config, State}.
@@ -111,7 +111,7 @@ pre_init_per_suite(Suite,Config,State) ->
{config() | skip_or_fail(), NewState :: #state{}}.
post_init_per_suite(Suite,Config,Return,State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, post_init_per_suite,
[Suite,Config,Return,State]}}),
{Return, State}.
@@ -124,7 +124,7 @@ post_init_per_suite(Suite,Config,Return,State) ->
{ok | skip_or_fail(), NewState :: #state{}}.
pre_end_per_suite(Suite,Config,State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, pre_end_per_suite,
[Suite,Config,State]}}),
{Config, State}.
@@ -138,7 +138,7 @@ pre_end_per_suite(Suite,Config,State) ->
{ok | skip_or_fail(), NewState :: #state{}}.
post_end_per_suite(Suite,Config,Return,State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, post_end_per_suite,
[Suite,Config,Return,State]}}),
{Return, State}.
@@ -151,7 +151,7 @@ post_end_per_suite(Suite,Config,Return,State) ->
{config() | skip_or_fail(), NewState :: #state{}}.
pre_init_per_group(Group,Config,State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, pre_init_per_group,
[Group,Config,State]}}),
{Config, State}.
@@ -165,7 +165,7 @@ pre_init_per_group(Group,Config,State) ->
{config() | skip_or_fail(), NewState :: #state{}}.
post_init_per_group(Group,Config,Return,State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, post_init_per_group,
[Group,Config,Return,State]}}),
{Return, State}.
@@ -178,7 +178,7 @@ post_init_per_group(Group,Config,Return,State) ->
{ok | skip_or_fail(), NewState :: #state{}}.
pre_end_per_group(Group,Config,State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, pre_end_per_group,
[Group,Config,State]}}),
{Config, State}.
@@ -192,7 +192,7 @@ pre_end_per_group(Group,Config,State) ->
{ok | skip_or_fail(), NewState :: #state{}}.
post_end_per_group(Group,Config,Return,State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, post_end_per_group,
[Group,Config,Return,State]}}),
{Return, State}.
@@ -205,7 +205,7 @@ post_end_per_group(Group,Config,Return,State) ->
{config() | skip_or_fail(), NewState :: #state{}}.
pre_init_per_testcase(TC,Config,State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, pre_init_per_testcase,
[TC,Config,State]}}),
{Config, State}.
@@ -219,7 +219,7 @@ pre_init_per_testcase(TC,Config,State) ->
{ok | skip_or_fail(), NewState :: #state{}}.
post_end_per_testcase(TC,Config,Return,State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, post_end_per_testcase,
[TC,Config,Return,State]}}),
{Return, State}.
@@ -234,7 +234,7 @@ post_end_per_testcase(TC,Config,Return,State) ->
NewState :: #state{}.
on_tc_fail(TC, Reason, State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, on_tc_fail,
[TC,Reason,State]}}),
State.
@@ -250,13 +250,13 @@ on_tc_fail(TC, Reason, State) ->
NewState :: #state{}.
on_tc_skip(TC, Reason, State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, on_tc_skip,
[TC,Reason,State]}}),
State.
-%% @doc Called when the scope of the SCB is done, this depends on
-%% when the SCB was specified. This translation table describes when this
+%% @doc Called when the scope of the CTH is done, this depends on
+%% when the CTH was specified. This translation table describes when this
%% function is called.
%%
%% | Started in | terminate called |
@@ -272,6 +272,6 @@ on_tc_skip(TC, Reason, State) ->
term().
terminate(State) ->
gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
data = {?MODULE, terminate, [State]}}),
ok.
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_pre_suite_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_post_suite_cth.erl
index 90f10d7531..b4c26259a6 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_pre_suite_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_post_suite_cth.erl
@@ -18,55 +18,55 @@
%%
--module(fail_pre_suite_scb).
+-module(fail_post_suite_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-compile(export_all).
init(Id, Opts) ->
- empty_scb:init(Id, Opts).
+ empty_cth:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
- empty_scb:pre_init_per_suite(Suite,Config,State),
- {{fail, "Test failure"}, State}.
+ empty_cth:pre_init_per_suite(Suite,Config,State).
post_init_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_init_per_suite(Suite,Config,Return,State).
+ empty_cth:post_init_per_suite(Suite,Config,Return,State),
+ {{fail, "Test failure"}, State}.
pre_end_per_suite(Suite,Config,State) ->
- empty_scb:pre_end_per_suite(Suite,Config,State).
+ empty_cth:pre_end_per_suite(Suite,Config,State).
post_end_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_end_per_suite(Suite,Config,Return,State).
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
pre_init_per_group(Group,Config,State) ->
- empty_scb:pre_init_per_group(Group,Config,State).
+ empty_cth:pre_init_per_group(Group,Config,State).
post_init_per_group(Group,Config,Return,State) ->
- empty_scb:post_init_per_group(Group,Config,Return,State).
+ empty_cth:post_init_per_group(Group,Config,Return,State).
pre_end_per_group(Group,Config,State) ->
- empty_scb:pre_end_per_group(Group,Config,State).
+ empty_cth:pre_end_per_group(Group,Config,State).
post_end_per_group(Group,Config,Return,State) ->
- empty_scb:post_end_per_group(Group,Config,Return,State).
+ empty_cth:post_end_per_group(Group,Config,Return,State).
pre_init_per_testcase(TC,Config,State) ->
- empty_scb:pre_init_per_testcase(TC,Config,State).
+ empty_cth:pre_init_per_testcase(TC,Config,State).
post_end_per_testcase(TC,Config,Return,State) ->
- empty_scb:post_end_per_testcase(TC,Config,Return,State).
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
on_tc_fail(TC, Reason, State) ->
- empty_scb:on_tc_fail(TC,Reason,State).
+ empty_cth:on_tc_fail(TC,Reason,State).
on_tc_skip(TC, Reason, State) ->
- empty_scb:on_tc_skip(TC,Reason,State).
+ empty_cth:on_tc_skip(TC,Reason,State).
terminate(State) ->
- empty_scb:terminate(State).
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_post_suite_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_pre_suite_cth.erl
index 44c72f6795..acf80a1b2e 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_post_suite_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_pre_suite_cth.erl
@@ -18,55 +18,55 @@
%%
--module(fail_post_suite_scb).
+-module(fail_pre_suite_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-compile(export_all).
init(Id, Opts) ->
- empty_scb:init(Id, Opts).
+ empty_cth:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
- empty_scb:pre_init_per_suite(Suite,Config,State).
+ empty_cth:pre_init_per_suite(Suite,Config,State),
+ {{fail, "Test failure"}, State}.
post_init_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_init_per_suite(Suite,Config,Return,State),
- {{fail, "Test failure"}, State}.
+ empty_cth:post_init_per_suite(Suite,Config,Return,State).
pre_end_per_suite(Suite,Config,State) ->
- empty_scb:pre_end_per_suite(Suite,Config,State).
+ empty_cth:pre_end_per_suite(Suite,Config,State).
post_end_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_end_per_suite(Suite,Config,Return,State).
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
pre_init_per_group(Group,Config,State) ->
- empty_scb:pre_init_per_group(Group,Config,State).
+ empty_cth:pre_init_per_group(Group,Config,State).
post_init_per_group(Group,Config,Return,State) ->
- empty_scb:post_init_per_group(Group,Config,Return,State).
+ empty_cth:post_init_per_group(Group,Config,Return,State).
pre_end_per_group(Group,Config,State) ->
- empty_scb:pre_end_per_group(Group,Config,State).
+ empty_cth:pre_end_per_group(Group,Config,State).
post_end_per_group(Group,Config,Return,State) ->
- empty_scb:post_end_per_group(Group,Config,Return,State).
+ empty_cth:post_end_per_group(Group,Config,Return,State).
pre_init_per_testcase(TC,Config,State) ->
- empty_scb:pre_init_per_testcase(TC,Config,State).
+ empty_cth:pre_init_per_testcase(TC,Config,State).
post_end_per_testcase(TC,Config,Return,State) ->
- empty_scb:post_end_per_testcase(TC,Config,Return,State).
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
on_tc_fail(TC, Reason, State) ->
- empty_scb:on_tc_fail(TC,Reason,State).
+ empty_cth:on_tc_fail(TC,Reason,State).
on_tc_skip(TC, Reason, State) ->
- empty_scb:on_tc_skip(TC,Reason,State).
+ empty_cth:on_tc_skip(TC,Reason,State).
terminate(State) ->
- empty_scb:terminate(State).
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/id_no_init_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/id_no_init_cth.erl
index 11fb8d739f..58ed400e1c 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/id_no_init_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/id_no_init_cth.erl
@@ -18,15 +18,15 @@
%%
--module(id_no_init_scb).
+-module(id_no_init_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-export([id/1]).
id(Opts) ->
- empty_scb:id(Opts).
+ empty_cth:id(Opts).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_cth.erl
index b3feb1383c..a18f4bf2f3 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_cth.erl
@@ -18,16 +18,16 @@
%%
--module(minimal_scb).
+-module(minimal_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-export([init/2]).
init(Id, Opts) ->
- empty_scb:init(Id, Opts).
+ empty_cth:init(Id, Opts).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_terminate_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_terminate_cth.erl
index 3f76d2f47d..79cd55f68e 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_terminate_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_terminate_cth.erl
@@ -18,21 +18,21 @@
%%
--module(minimal_terminate_scb).
+-module(minimal_terminate_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-export([init/2]).
-export([terminate/1]).
init(Id, Opts) ->
- empty_scb:init(Id, Opts).
+ empty_cth:init(Id, Opts).
terminate(State) ->
- empty_scb:terminate(State).
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/recover_post_suite_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/recover_post_suite_cth.erl
index 26468f0789..01a932bd59 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/recover_post_suite_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/recover_post_suite_cth.erl
@@ -18,57 +18,57 @@
%%
--module(recover_post_suite_scb).
+-module(recover_post_suite_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-compile(export_all).
init(Id, Opts) ->
- empty_scb:init(Id, Opts).
+ empty_cth:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
- empty_scb:pre_init_per_suite(Suite,Config,State).
+ empty_cth:pre_init_per_suite(Suite,Config,State).
post_init_per_suite(Suite,Config,{'EXIT',Reason} = Return,State) ->
- empty_scb:post_init_per_suite(Suite,Config,Return,State),
+ empty_cth:post_init_per_suite(Suite,Config,Return,State),
{lists:keydelete(tc_status,1,Config),State};
post_init_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_init_per_suite(Suite,Config,Return,State).
+ empty_cth:post_init_per_suite(Suite,Config,Return,State).
pre_end_per_suite(Suite,Config,State) ->
- empty_scb:pre_end_per_suite(Suite,Config,State).
+ empty_cth:pre_end_per_suite(Suite,Config,State).
post_end_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_end_per_suite(Suite,Config,Return,State).
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
pre_init_per_group(Group,Config,State) ->
- empty_scb:pre_init_per_group(Group,Config,State).
+ empty_cth:pre_init_per_group(Group,Config,State).
post_init_per_group(Group,Config,Return,State) ->
- empty_scb:post_init_per_group(Group,Config,Return,State).
+ empty_cth:post_init_per_group(Group,Config,Return,State).
pre_end_per_group(Group,Config,State) ->
- empty_scb:pre_end_per_group(Group,Config,State).
+ empty_cth:pre_end_per_group(Group,Config,State).
post_end_per_group(Group,Config,Return,State) ->
- empty_scb:post_end_per_group(Group,Config,Return,State).
+ empty_cth:post_end_per_group(Group,Config,Return,State).
pre_init_per_testcase(TC,Config,State) ->
- empty_scb:pre_init_per_testcase(TC,Config,State).
+ empty_cth:pre_init_per_testcase(TC,Config,State).
post_end_per_testcase(TC,Config,Return,State) ->
- empty_scb:post_end_per_testcase(TC,Config,Return,State).
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
on_tc_fail(TC, Reason, State) ->
- empty_scb:on_tc_fail(TC,Reason,State).
+ empty_cth:on_tc_fail(TC,Reason,State).
on_tc_skip(TC, Reason, State) ->
- empty_scb:on_tc_skip(TC,Reason,State).
+ empty_cth:on_tc_skip(TC,Reason,State).
terminate(State) ->
- empty_scb:terminate(State).
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/same_id_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/same_id_cth.erl
index 0fa708d5b6..acfb93fe26 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/same_id_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/same_id_cth.erl
@@ -18,58 +18,58 @@
%%
--module(same_id_scb).
+-module(same_id_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-compile(export_all).
id(Opts) ->
- empty_scb:id(Opts),
+ empty_cth:id(Opts),
?MODULE.
init(Id, Opts) ->
- empty_scb:init(Id, Opts).
+ empty_cth:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
- empty_scb:pre_init_per_suite(Suite,Config,State).
+ empty_cth:pre_init_per_suite(Suite,Config,State).
post_init_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_init_per_suite(Suite,Config,Return,State).
+ empty_cth:post_init_per_suite(Suite,Config,Return,State).
pre_end_per_suite(Suite,Config,State) ->
- empty_scb:pre_end_per_suite(Suite,Config,State).
+ empty_cth:pre_end_per_suite(Suite,Config,State).
post_end_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_end_per_suite(Suite,Config,Return,State).
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
pre_init_per_group(Group,Config,State) ->
- empty_scb:pre_init_per_group(Group,Config,State).
+ empty_cth:pre_init_per_group(Group,Config,State).
post_init_per_group(Group,Config,Return,State) ->
- empty_scb:post_init_per_group(Group,Config,Return,State).
+ empty_cth:post_init_per_group(Group,Config,Return,State).
pre_end_per_group(Group,Config,State) ->
- empty_scb:pre_end_per_group(Group,Config,State).
+ empty_cth:pre_end_per_group(Group,Config,State).
post_end_per_group(Group,Config,Return,State) ->
- empty_scb:post_end_per_group(Group,Config,Return,State).
+ empty_cth:post_end_per_group(Group,Config,Return,State).
pre_init_per_testcase(TC,Config,State) ->
- empty_scb:pre_init_per_testcase(TC,Config,State).
+ empty_cth:pre_init_per_testcase(TC,Config,State).
post_end_per_testcase(TC,Config,Return,State) ->
- empty_scb:post_end_per_testcase(TC,Config,Return,State).
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
on_tc_fail(TC, Reason, State) ->
- empty_scb:on_tc_fail(TC,Reason,State).
+ empty_cth:on_tc_fail(TC,Reason,State).
on_tc_skip(TC, Reason, State) ->
- empty_scb:on_tc_skip(TC,Reason,State).
+ empty_cth:on_tc_skip(TC,Reason,State).
terminate(State) ->
- empty_scb:terminate(State).
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_post_suite_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_post_suite_cth.erl
index bb93ebee0f..6d4605b33b 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_post_suite_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_post_suite_cth.erl
@@ -18,55 +18,55 @@
%%
--module(skip_post_suite_scb).
+-module(skip_post_suite_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-compile(export_all).
init(Id, Opts) ->
- empty_scb:init(Id, Opts).
+ empty_cth:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
- empty_scb:pre_init_per_suite(Suite,Config,State).
+ empty_cth:pre_init_per_suite(Suite,Config,State).
post_init_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_init_per_suite(Suite,Config,Return,State),
+ empty_cth:post_init_per_suite(Suite,Config,Return,State),
{{skip, "Test skip"}, State}.
pre_end_per_suite(Suite,Config,State) ->
- empty_scb:pre_end_per_suite(Suite,Config,State).
+ empty_cth:pre_end_per_suite(Suite,Config,State).
post_end_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_end_per_suite(Suite,Config,Return,State).
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
pre_init_per_group(Group,Config,State) ->
- empty_scb:pre_init_per_group(Group,Config,State).
+ empty_cth:pre_init_per_group(Group,Config,State).
post_init_per_group(Group,Config,Return,State) ->
- empty_scb:post_init_per_group(Group,Config,Return,State).
+ empty_cth:post_init_per_group(Group,Config,Return,State).
pre_end_per_group(Group,Config,State) ->
- empty_scb:pre_end_per_group(Group,Config,State).
+ empty_cth:pre_end_per_group(Group,Config,State).
post_end_per_group(Group,Config,Return,State) ->
- empty_scb:post_end_per_group(Group,Config,Return,State).
+ empty_cth:post_end_per_group(Group,Config,Return,State).
pre_init_per_testcase(TC,Config,State) ->
- empty_scb:pre_init_per_testcase(TC,Config,State).
+ empty_cth:pre_init_per_testcase(TC,Config,State).
post_end_per_testcase(TC,Config,Return,State) ->
- empty_scb:post_end_per_testcase(TC,Config,Return,State).
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
on_tc_fail(TC, Reason, State) ->
- empty_scb:on_tc_fail(TC,Reason,State).
+ empty_cth:on_tc_fail(TC,Reason,State).
on_tc_skip(TC, Reason, State) ->
- empty_scb:on_tc_skip(TC,Reason,State).
+ empty_cth:on_tc_skip(TC,Reason,State).
terminate(State) ->
- empty_scb:terminate(State).
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_pre_suite_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_suite_cth.erl
index 9818964e7f..49efd0d0cd 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_pre_suite_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_suite_cth.erl
@@ -18,56 +18,56 @@
%%
--module(skip_pre_suite_scb).
+-module(skip_pre_suite_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-compile(export_all).
init(Id, Opts) ->
- empty_scb:init(Id, Opts).
+ empty_cth:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
- empty_scb:pre_init_per_suite(Suite,Config,State),
+ empty_cth:pre_init_per_suite(Suite,Config,State),
{{skip, "Test skip"}, State}.
post_init_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_init_per_suite(Suite,Config,Return,State).
+ empty_cth:post_init_per_suite(Suite,Config,Return,State).
pre_end_per_suite(Suite,Config,State) ->
- empty_scb:pre_end_per_suite(Suite,Config,State).
+ empty_cth:pre_end_per_suite(Suite,Config,State).
post_end_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_end_per_suite(Suite,Config,Return,State).
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
pre_init_per_group(Group,Config,State) ->
- empty_scb:pre_init_per_group(Group,Config,State).
+ empty_cth:pre_init_per_group(Group,Config,State).
post_init_per_group(Group,Config,Return,State) ->
- empty_scb:post_init_per_group(Group,Config,Return,State).
+ empty_cth:post_init_per_group(Group,Config,Return,State).
pre_end_per_group(Group,Config,State) ->
- empty_scb:pre_end_per_group(Group,Config,State).
+ empty_cth:pre_end_per_group(Group,Config,State).
post_end_per_group(Group,Config,Return,State) ->
- empty_scb:post_end_per_group(Group,Config,Return,State).
+ empty_cth:post_end_per_group(Group,Config,Return,State).
pre_init_per_testcase(TC,Config,State) ->
- empty_scb:pre_init_per_testcase(TC,Config,State).
+ empty_cth:pre_init_per_testcase(TC,Config,State).
post_end_per_testcase(TC,Config,Return,State) ->
- empty_scb:post_end_per_testcase(TC,Config,Return,State).
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
on_tc_fail(TC, Reason, State) ->
- empty_scb:on_tc_fail(TC,Reason,State).
+ empty_cth:on_tc_fail(TC,Reason,State).
on_tc_skip(TC, Reason, State) ->
- empty_scb:on_tc_skip(TC,Reason,State).
+ empty_cth:on_tc_skip(TC,Reason,State).
terminate(State) ->
- empty_scb:terminate(State).
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/state_update_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/state_update_cth.erl
index 13c50cf1a1..53d75e6ce3 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/state_update_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/state_update_cth.erl
@@ -18,66 +18,66 @@
%%
--module(state_update_scb).
+-module(state_update_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-compile(export_all).
init(Id, Opts) ->
- State = empty_scb:init(Id, Opts),
+ State = empty_cth:init(Id, Opts),
[init|State].
pre_init_per_suite(Suite, Config, State) ->
- empty_scb:pre_init_per_suite(Suite,Config,State),
+ empty_cth:pre_init_per_suite(Suite,Config,State),
{Config, [pre_init_per_suite|State]}.
post_init_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_init_per_suite(Suite,Config,Return,State),
+ empty_cth:post_init_per_suite(Suite,Config,Return,State),
{Config, [post_init_per_suite|State]}.
pre_end_per_suite(Suite,Config,State) ->
- empty_scb:pre_end_per_suite(Suite,Config,State),
+ empty_cth:pre_end_per_suite(Suite,Config,State),
{Config, [pre_end_per_suite|State]}.
post_end_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_end_per_suite(Suite,Config,Return,State),
+ empty_cth:post_end_per_suite(Suite,Config,Return,State),
{Return, [post_end_per_suite|State]}.
pre_init_per_group(Group,Config,State) ->
- empty_scb:pre_init_per_group(Group,Config,State),
+ empty_cth:pre_init_per_group(Group,Config,State),
{Config, [pre_init_per_group|State]}.
post_init_per_group(Group,Config,Return,State) ->
- empty_scb:post_init_per_group(Group,Config,Return,State),
+ empty_cth:post_init_per_group(Group,Config,Return,State),
{Return, [post_init_per_group|State]}.
pre_end_per_group(Group,Config,State) ->
- empty_scb:pre_end_per_group(Group,Config,State),
+ empty_cth:pre_end_per_group(Group,Config,State),
{Config, [pre_end_per_group|State]}.
post_end_per_group(Group,Config,Return,State) ->
- empty_scb:post_end_per_group(Group,Config,Return,State),
+ empty_cth:post_end_per_group(Group,Config,Return,State),
{Return, [post_end_per_group|State]}.
pre_init_per_testcase(TC,Config,State) ->
- empty_scb:pre_init_per_testcase(TC,Config,State),
+ empty_cth:pre_init_per_testcase(TC,Config,State),
{Config, [pre_init_per_testcase|State]}.
post_end_per_testcase(TC,Config,Return,State) ->
- empty_scb:post_end_per_testcase(TC,Config,Return,State),
+ empty_cth:post_end_per_testcase(TC,Config,Return,State),
{Return, [post_end_per_testcase|State]}.
on_tc_fail(TC, Reason, State) ->
- empty_scb:on_tc_fail(TC,Reason,State),
+ empty_cth:on_tc_fail(TC,Reason,State),
[on_tc_fail|State].
on_tc_skip(TC, Reason, State) ->
- empty_scb:on_tc_skip(TC,Reason,State),
+ empty_cth:on_tc_skip(TC,Reason,State),
[on_tc_skip|State].
terminate(State) ->
- empty_scb:terminate(State).
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/undef_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/undef_cth.erl
index 1cb64574c3..4c44ef025b 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/undef_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/undef_cth.erl
@@ -18,54 +18,54 @@
%%
--module(undef_scb).
+-module(undef_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-compile(export_all).
init(Id, Opts) ->
- empty_scb:init(Id, Opts).
+ empty_cth:init(Id, Opts).
pre_init_per_suite(_Suite, _Config, _State) ->
lists:flaten([1,2,[3,4]]).
post_init_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_init_per_suite(Suite,Config,Return,State).
+ empty_cth:post_init_per_suite(Suite,Config,Return,State).
pre_end_per_suite(Suite,Config,State) ->
- empty_scb:pre_end_per_suite(Suite,Config,State).
+ empty_cth:pre_end_per_suite(Suite,Config,State).
post_end_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_end_per_suite(Suite,Config,Return,State).
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
pre_init_per_group(Group,Config,State) ->
- empty_scb:pre_init_per_group(Group,Config,State).
+ empty_cth:pre_init_per_group(Group,Config,State).
post_init_per_group(Group,Config,Return,State) ->
- empty_scb:post_init_per_group(Group,Config,Return,State).
+ empty_cth:post_init_per_group(Group,Config,Return,State).
pre_end_per_group(Group,Config,State) ->
- empty_scb:pre_end_per_group(Group,Config,State).
+ empty_cth:pre_end_per_group(Group,Config,State).
post_end_per_group(Group,Config,Return,State) ->
- empty_scb:post_end_per_group(Group,Config,Return,State).
+ empty_cth:post_end_per_group(Group,Config,Return,State).
pre_init_per_testcase(TC,Config,State) ->
- empty_scb:pre_init_per_testcase(TC,Config,State).
+ empty_cth:pre_init_per_testcase(TC,Config,State).
post_end_per_testcase(TC,Config,Return,State) ->
- empty_scb:post_end_per_testcase(TC,Config,Return,State).
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
on_tc_fail(TC, Reason, State) ->
- empty_scb:on_tc_fail(TC,Reason,State).
+ empty_cth:on_tc_fail(TC,Reason,State).
on_tc_skip(TC, Reason, State) ->
- empty_scb:on_tc_skip(TC,Reason,State).
+ empty_cth:on_tc_skip(TC,Reason,State).
terminate(State) ->
- empty_scb:terminate(State).
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/update_config_scb.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl
index 46a027403d..788ef2cec2 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/update_config_scb.erl
+++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl
@@ -18,65 +18,65 @@
%%
--module(update_config_scb).
+-module(update_config_cth).
-include_lib("common_test/src/ct_util.hrl").
-include_lib("common_test/include/ct_event.hrl").
-%% Suite Callbacks
+%% CT Hooks
-compile(export_all).
init(Id, Opts) ->
- empty_scb:init(Id, Opts).
+ empty_cth:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
- empty_scb:pre_init_per_suite(Suite,Config,State),
+ empty_cth:pre_init_per_suite(Suite,Config,State),
{[{pre_init_per_suite,now()}|Config],State}.
post_init_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_init_per_suite(Suite,Config,Return,State),
+ empty_cth:post_init_per_suite(Suite,Config,Return,State),
{[{post_init_per_suite,now()}|Return],State}.
pre_end_per_suite(Suite,Config,State) ->
- empty_scb:pre_end_per_suite(Suite,Config,State),
+ empty_cth:pre_end_per_suite(Suite,Config,State),
{[{pre_end_per_suite,now()}|Config],State}.
post_end_per_suite(Suite,Config,Return,State) ->
- empty_scb:post_end_per_suite(Suite,Config,Return,State),
+ empty_cth:post_end_per_suite(Suite,Config,Return,State),
NewConfig = [{post_end_per_suite,now()}|Config],
{NewConfig,NewConfig}.
pre_init_per_group(Group,Config,State) ->
- empty_scb:pre_init_per_group(Group,Config,State),
+ empty_cth:pre_init_per_group(Group,Config,State),
{[{pre_init_per_group,now()}|Config],State}.
post_init_per_group(Group,Config,Return,State) ->
- empty_scb:post_init_per_group(Group,Config,Return,State),
+ empty_cth:post_init_per_group(Group,Config,Return,State),
{[{post_init_per_group,now()}|Return],State}.
pre_end_per_group(Group,Config,State) ->
- empty_scb:pre_end_per_group(Group,Config,State),
+ empty_cth:pre_end_per_group(Group,Config,State),
{[{pre_end_per_group,now()}|Config],State}.
post_end_per_group(Group,Config,Return,State) ->
- empty_scb:post_end_per_group(Group,Config,Return,State),
+ empty_cth:post_end_per_group(Group,Config,Return,State),
{[{post_end_per_group,now()}|Config],State}.
pre_init_per_testcase(TC,Config,State) ->
- empty_scb:pre_init_per_testcase(TC,Config,State),
+ empty_cth:pre_init_per_testcase(TC,Config,State),
{[{pre_init_per_testcase,now()}|Config],State}.
post_end_per_testcase(TC,Config,Return,State) ->
- empty_scb:post_end_per_testcase(TC,Config,Return,State),
+ empty_cth:post_end_per_testcase(TC,Config,Return,State),
{[{post_end_per_testcase,now()}|Config],State}.
on_tc_fail(TC, Reason, State) ->
- empty_scb:on_tc_fail(TC,Reason,State).
+ empty_cth:on_tc_fail(TC,Reason,State).
on_tc_skip(TC, Reason, State) ->
- empty_scb:on_tc_skip(TC,Reason,State).
+ empty_cth:on_tc_skip(TC,Reason,State).
terminate(State) ->
- empty_scb:terminate(State).
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE.erl b/lib/common_test/test/ct_suite_callback_SUITE.erl
deleted file mode 100644
index 67f3cf430a..0000000000
--- a/lib/common_test/test/ct_suite_callback_SUITE.erl
+++ /dev/null
@@ -1,1021 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2009-2010. All Rights Reserved.
-%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and limitations
-%% under the License.
-%%
-%% %CopyrightEnd%
-%%
-
-%%%-------------------------------------------------------------------
-%%% File: ct_error_SUITE
-%%%
-%%% Description:
-%%% Test various errors in Common Test suites.
-%%%
-%%% The suites used for the test are located in the data directory.
-%%%-------------------------------------------------------------------
--module(ct_suite_callback_SUITE).
-
--compile(export_all).
-
--include_lib("test_server/include/test_server.hrl").
--include_lib("common_test/include/ct_event.hrl").
-
--define(eh, ct_test_support_eh).
-
-%%--------------------------------------------------------------------
-%% TEST SERVER CALLBACK FUNCTIONS
-%%--------------------------------------------------------------------
-
-%%--------------------------------------------------------------------
-%% Description: Since Common Test starts another Test Server
-%% instance, the tests need to be performed on a separate node (or
-%% there will be clashes with logging processes etc).
-%%--------------------------------------------------------------------
-init_per_suite(Config) ->
- DataDir = ?config(data_dir, Config),
- TestDir = filename:join(DataDir,"scb/tests/"),
- SCBs = filelib:wildcard(filename:join(TestDir,"*_scb.erl")),
- io:format("SCBs: ~p",[SCBs]),
- [io:format("Compiling ~p: ~p",
- [FileName,compile:file(FileName,[{outdir,TestDir},debug_info])]) ||
- FileName <- SCBs],
- ct_test_support:init_per_suite([{path_dirs,[TestDir]} | Config]).
-
-end_per_suite(Config) ->
- ct_test_support:end_per_suite(Config).
-
-init_per_testcase(TestCase, Config) ->
- ct_test_support:init_per_testcase(TestCase, Config).
-
-end_per_testcase(TestCase, Config) ->
- ct_test_support:end_per_testcase(TestCase, Config).
-
-
-suite() ->
- [{timetrap,{seconds,20}}].
-
-all() ->
- all(suite).
-
-all(suite) ->
- lists:reverse(
- [
- one_scb, two_scb, faulty_scb_no_init, faulty_scb_id_no_init,
- faulty_scb_exit_in_init, faulty_scb_exit_in_id,
- faulty_scb_exit_in_init_scope_suite, minimal_scb,
- minimal_and_maximal_scb, faulty_scb_undef,
- scope_per_suite_scb, scope_per_group_scb, scope_suite_scb,
- scope_per_suite_state_scb, scope_per_group_state_scb,
- scope_suite_state_scb,
- fail_pre_suite_scb, fail_post_suite_scb, skip_pre_suite_scb,
- skip_post_suite_scb, recover_post_suite_scb, update_config_scb,
- state_update_scb, options_scb, same_id_scb,
- fail_n_skip_with_minimal_scb
- ]
- )
- .
-
-
-%%--------------------------------------------------------------------
-%% TEST CASES
-%%--------------------------------------------------------------------
-
-%%%-----------------------------------------------------------------
-%%%
-one_scb(Config) when is_list(Config) ->
- do_test(one_empty_scb, "ct_scb_empty_SUITE.erl",[empty_scb], Config).
-
-two_scb(Config) when is_list(Config) ->
- do_test(two_empty_scb, "ct_scb_empty_SUITE.erl",[empty_scb,empty_scb],
- Config).
-
-faulty_scb_no_init(Config) when is_list(Config) ->
- do_test(faulty_scb_no_init, "ct_scb_empty_SUITE.erl",[askjhdkljashdkaj],
- Config,{error,"Failed to start SCB, see the "
- "CT Log for details"}).
-
-faulty_scb_id_no_init(Config) when is_list(Config) ->
- do_test(faulty_scb_id_no_init, "ct_scb_empty_SUITE.erl",[id_no_init_scb],
- Config,{error,"Failed to start SCB, see the "
- "CT Log for details"}).
-
-minimal_scb(Config) when is_list(Config) ->
- do_test(minimal_scb, "ct_scb_empty_SUITE.erl",[minimal_scb],Config).
-
-minimal_and_maximal_scb(Config) when is_list(Config) ->
- do_test(minimal_and_maximal_scb, "ct_scb_empty_SUITE.erl",
- [minimal_scb, empty_scb],Config).
-
-faulty_scb_undef(Config) when is_list(Config) ->
- do_test(faulty_scb_undef, "ct_scb_empty_SUITE.erl",
- [undef_scb],Config).
-
-faulty_scb_exit_in_init_scope_suite(Config) when is_list(Config) ->
- do_test(faulty_scb_exit_in_init_scope_suite,
- "ct_exit_in_init_scope_suite_scb_SUITE.erl",
- [],Config).
-
-faulty_scb_exit_in_init(Config) when is_list(Config) ->
- do_test(faulty_scb_exit_in_init, "ct_scb_empty_SUITE.erl",
- [crash_init_scb], Config,
- {error,"Failed to start SCB, see the "
- "CT Log for details"}).
-
-faulty_scb_exit_in_id(Config) when is_list(Config) ->
- do_test(faulty_scb_exit_in_id, "ct_scb_empty_SUITE.erl",
- [crash_id_scb], Config,
- {error,"Failed to start SCB, see the "
- "CT Log for details"}).
-
-scope_per_suite_scb(Config) when is_list(Config) ->
- do_test(scope_per_suite_scb, "ct_scope_per_suite_scb_SUITE.erl",
- [],Config).
-
-scope_suite_scb(Config) when is_list(Config) ->
- do_test(scope_suite_scb, "ct_scope_suite_scb_SUITE.erl",
- [],Config).
-
-scope_per_group_scb(Config) when is_list(Config) ->
- do_test(scope_per_group_scb, "ct_scope_per_group_scb_SUITE.erl",
- [],Config).
-
-scope_per_suite_state_scb(Config) when is_list(Config) ->
- do_test(scope_per_suite_state_scb, "ct_scope_per_suite_state_scb_SUITE.erl",
- [],Config).
-
-scope_suite_state_scb(Config) when is_list(Config) ->
- do_test(scope_suite_state_scb, "ct_scope_suite_state_scb_SUITE.erl",
- [],Config).
-
-scope_per_group_state_scb(Config) when is_list(Config) ->
- do_test(scope_per_group_state_scb, "ct_scope_per_group_state_scb_SUITE.erl",
- [],Config).
-
-fail_pre_suite_scb(Config) when is_list(Config) ->
- do_test(fail_pre_suite_scb, "ct_scb_empty_SUITE.erl",
- [fail_pre_suite_scb],Config).
-
-fail_post_suite_scb(Config) when is_list(Config) ->
- do_test(fail_post_suite_scb, "ct_scb_empty_SUITE.erl",
- [fail_post_suite_scb],Config).
-
-skip_pre_suite_scb(Config) when is_list(Config) ->
- do_test(skip_pre_suite_scb, "ct_scb_empty_SUITE.erl",
- [skip_pre_suite_scb],Config).
-
-skip_post_suite_scb(Config) when is_list(Config) ->
- do_test(skip_post_suite_scb, "ct_scb_empty_SUITE.erl",
- [skip_post_suite_scb],Config).
-
-recover_post_suite_scb(Config) when is_list(Config) ->
- do_test(recover_post_suite_scb, "ct_scb_fail_per_suite_SUITE.erl",
- [recover_post_suite_scb],Config).
-
-update_config_scb(Config) when is_list(Config) ->
- do_test(update_config_scb, "ct_update_config_SUITE.erl",
- [update_config_scb],Config).
-
-state_update_scb(Config) when is_list(Config) ->
- do_test(state_update_scb, "ct_scb_fail_one_skip_one_SUITE.erl",
- [state_update_scb,state_update_scb],Config).
-
-options_scb(Config) when is_list(Config) ->
- do_test(options_scb, "ct_scb_empty_SUITE.erl",
- [{empty_scb,[test]}],Config).
-
-same_id_scb(Config) when is_list(Config) ->
- do_test(same_id_scb, "ct_scb_empty_SUITE.erl",
- [same_id_scb,same_id_scb],Config).
-
-fail_n_skip_with_minimal_scb(Config) when is_list(Config) ->
- do_test(fail_n_skip_with_minimal_scb, "ct_scb_fail_one_skip_one_SUITE.erl",
- [minimal_terminate_scb],Config).
-
-%%%-----------------------------------------------------------------
-%%% HELP FUNCTIONS
-%%%-----------------------------------------------------------------
-
-do_test(Tag, SWC, SCBs, Config) ->
- do_test(Tag, SWC, SCBs, Config, ok).
-do_test(Tag, SWC, SCBs, Config, {error,_} = Res) ->
- do_test(Tag, SWC, SCBs, Config, Res, 1);
-do_test(Tag, SWC, SCBs, Config, Res) ->
- do_test(Tag, SWC, SCBs, Config, Res, 2).
-
-do_test(Tag, SuiteWildCard, SCBs, Config, Res, EC) ->
-
- DataDir = ?config(data_dir, Config),
- Suites = filelib:wildcard(
- filename:join([DataDir,"scb/tests",SuiteWildCard])),
- {Opts,ERPid} = setup([{suite,Suites},
- {suite_callbacks,SCBs},{label,Tag}], Config),
- Res = ct_test_support:run(Opts, Config),
- Events = ct_test_support:get_events(ERPid, Config),
-
- ct_test_support:log_events(Tag,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
-
- TestEvents = events_to_check(Tag, EC),
- ok = ct_test_support:verify_events(TestEvents, Events, Config).
-
-setup(Test, Config) ->
- Opts0 = ct_test_support:get_opts(Config),
- Level = ?config(trace_level, Config),
- EvHArgs = [{cbm,ct_test_support},{trace_level,Level}],
- Opts = Opts0 ++ [{event_handler,{?eh,EvHArgs}}|Test],
- ERPid = ct_test_support:start_event_receiver(Config),
- {Opts,ERPid}.
-
-reformat(Events, EH) ->
- ct_test_support:reformat(Events, EH).
-%reformat(Events, _EH) ->
-% Events.
-
-%%%-----------------------------------------------------------------
-%%% TEST EVENTS
-%%%-----------------------------------------------------------------
-events_to_check(Test) ->
- %% 2 tests (ct:run_test + script_start) is default
- events_to_check(Test, 2).
-
-events_to_check(_, 0) ->
- [];
-events_to_check(Test, N) ->
- test_events(Test) ++ events_to_check(Test, N-1).
-
-test_events(one_empty_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{empty_scb,id,[[]]}},
- {?eh,scb,{empty_scb,init,[{'_','_','_'},[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
- {?eh,scb,{empty_scb,pre_init_per_suite,
- [ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{empty_scb,post_init_per_suite,
- [ct_scb_empty_SUITE,'$proplist','$proplist',[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,ok}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,test_case}},
- {?eh,scb,{empty_scb,pre_init_per_testcase,[test_case,'$proplist',[]]}},
- {?eh,scb,{empty_scb,post_end_per_testcase,[test_case,'$proplist','_',[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,end_per_suite}},
- {?eh,scb,{empty_scb,pre_end_per_suite,
- [ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{empty_scb,post_end_per_suite,[ct_scb_empty_SUITE,'$proplist','_',[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb,{empty_scb,terminate,[[]]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(two_empty_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{'_',id,[[]]}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,scb,{'_',id,[[]]}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
- {?eh,scb,{'_',pre_init_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',pre_init_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_init_per_suite,[ct_scb_empty_SUITE,'$proplist','$proplist',[]]}},
- {?eh,scb,{'_',post_init_per_suite,[ct_scb_empty_SUITE,'$proplist','$proplist',[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,ok}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,test_case}},
- {?eh,scb,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
- {?eh,scb,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
- {?eh,scb,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,end_per_suite}},
- {?eh,scb,{'_',pre_end_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',pre_end_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_suite,[ct_scb_empty_SUITE,'$proplist','_',[]]}},
- {?eh,scb,{'_',post_end_per_suite,[ct_scb_empty_SUITE,'$proplist','_',[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb,{'_',terminate,[[]]}},
- {?eh,scb,{'_',terminate,[[]]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(faulty_scb_no_init) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(faulty_scb_id_no_init) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{'_',id,[[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {negative,{?eh,tc_start,'_'},
- {?eh,test_done,{'DEF','STOP_TIME'}}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(minimal_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {negative,{?eh,scb,{'_',id,['_',[]]}},
- {?eh,scb,{'_',init,['_',[]]}}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
- {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,ok}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,test_case}},
- {?eh,tc_done,{ct_scb_empty_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,end_per_suite}},
- {?eh,tc_done,{ct_scb_empty_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(minimal_and_maximal_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {negative,{?eh,scb,{'_',id,['_',[]]}},
- {?eh,scb,{'_',init,['_',[]]}}},
- {?eh,scb,{'_',id,[[]]}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
- {?eh,scb,{'_',pre_init_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_init_per_suite,[ct_scb_empty_SUITE,'$proplist','$proplist',[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,ok}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,test_case}},
- {?eh,scb,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,end_per_suite}},
- {?eh,scb,{'_',pre_end_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_suite,[ct_scb_empty_SUITE,'$proplist','_',[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb,{'_',terminate,[[]]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(faulty_scb_undef) ->
- FailReasonStr = "undef_scb:pre_init_per_suite/3 SCB call failed",
- FailReason = {ct_scb_empty_SUITE,init_per_suite,
- {failed,FailReasonStr}},
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
- {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,
- {failed, {error,FailReasonStr}}}},
- {?eh,scb,{'_',on_tc_fail,'_'}},
-
- {?eh,tc_auto_skip,{ct_scb_empty_SUITE,test_case,
- {failed, FailReason}}},
- {?eh,scb,{'_',on_tc_skip,'_'}},
-
- {?eh,tc_auto_skip,{ct_scb_empty_SUITE,end_per_suite,
- {failed, FailReason}}},
- {?eh,scb,{'_',on_tc_skip,'_'}},
-
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(faulty_scb_exit_in_init_scope_suite) ->
- [{?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{'_',init_per_suite}},
- {?eh,scb,{empty_scb,init,['_',[]]}},
- {?eh,tc_done,
- {ct_exit_in_init_scope_suite_scb_SUITE,init_per_suite,
- {failed,
- {error,
- "Failed to start SCB, see the CT Log for details"}}}},
- {?eh,tc_auto_skip,
- {ct_exit_in_init_scope_suite_scb_SUITE,test_case,
- {failed,
- {ct_exit_in_init_scope_suite_scb_SUITE,init_per_suite,
- {failed,
- "Failed to start SCB, see the CT Log for details"}}}}},
- {?eh,tc_auto_skip,
- {ct_exit_in_init_scope_suite_scb_SUITE,end_per_suite,
- {failed,
- {ct_exit_in_init_scope_suite_scb_SUITE,init_per_suite,
- {failed,
- "Failed to start SCB, see the CT Log for details"}}}}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,stop_logging,[]}];
-
-test_events(faulty_scb_exit_in_init) ->
- [{?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{empty_scb,init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,stop_logging,[]}];
-
-test_events(faulty_scb_exit_in_id) ->
- [{?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{empty_scb,id,[[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {negative, {?eh,tc_start,'_'},
- {?eh,test_done,{'DEF','STOP_TIME'}}},
- {?eh,stop_logging,[]}];
-
-test_events(scope_per_suite_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scope_per_suite_scb_SUITE,init_per_suite}},
- {?eh,scb,{'_',id,[[]]}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,scb,{'_',post_init_per_suite,[ct_scope_per_suite_scb_SUITE,'$proplist','$proplist',[]]}},
- {?eh,tc_done,{ct_scope_per_suite_scb_SUITE,init_per_suite,ok}},
-
- {?eh,tc_start,{ct_scope_per_suite_scb_SUITE,test_case}},
- {?eh,scb,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
- {?eh,tc_done,{ct_scope_per_suite_scb_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_scope_per_suite_scb_SUITE,end_per_suite}},
- {?eh,scb,{'_',pre_end_per_suite,
- [ct_scope_per_suite_scb_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_suite,[ct_scope_per_suite_scb_SUITE,'$proplist','_',[]]}},
- {?eh,scb,{'_',terminate,[[]]}},
- {?eh,tc_done,{ct_scope_per_suite_scb_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(scope_suite_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scope_suite_scb_SUITE,init_per_suite}},
- {?eh,scb,{'_',id,[[]]}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,scb,{'_',pre_init_per_suite,[ct_scope_suite_scb_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_init_per_suite,[ct_scope_suite_scb_SUITE,'$proplist','$proplist',[]]}},
- {?eh,tc_done,{ct_scope_suite_scb_SUITE,init_per_suite,ok}},
-
- {?eh,tc_start,{ct_scope_suite_scb_SUITE,test_case}},
- {?eh,scb,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
- {?eh,tc_done,{ct_scope_suite_scb_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_scope_suite_scb_SUITE,end_per_suite}},
- {?eh,scb,{'_',pre_end_per_suite,[ct_scope_suite_scb_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_suite,[ct_scope_suite_scb_SUITE,'$proplist','_',[]]}},
- {?eh,scb,{'_',terminate,[[]]}},
- {?eh,tc_done,{ct_scope_suite_scb_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(scope_per_group_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scope_per_group_scb_SUITE,init_per_suite}},
- {?eh,tc_done,{ct_scope_per_group_scb_SUITE,init_per_suite,ok}},
-
- [{?eh,tc_start,{ct_scope_per_group_scb_SUITE,{init_per_group,group1,[]}}},
- {?eh,scb,{'_',id,[[]]}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,scb,{'_',post_init_per_group,[group1,'$proplist','$proplist',[]]}},
- {?eh,tc_done,{ct_scope_per_group_scb_SUITE,{init_per_group,group1,[]},ok}},
-
- {?eh,tc_start,{ct_scope_per_group_scb_SUITE,test_case}},
- {?eh,scb,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
- {?eh,tc_done,{ct_scope_per_group_scb_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_scope_per_group_scb_SUITE,{end_per_group,group1,[]}}},
- {?eh,scb,{'_',pre_end_per_group,[group1,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_group,[group1,'$proplist','_',[]]}},
- {?eh,scb,{'_',terminate,[[]]}},
- {?eh,tc_done,{ct_scope_per_group_scb_SUITE,{end_per_group,group1,[]},ok}}],
-
- {?eh,tc_start,{ct_scope_per_group_scb_SUITE,end_per_suite}},
- {?eh,tc_done,{ct_scope_per_group_scb_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(scope_per_suite_state_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scope_per_suite_state_scb_SUITE,init_per_suite}},
- {?eh,scb,{'_',id,[[test]]}},
- {?eh,scb,{'_',init,['_',[test]]}},
- {?eh,scb,{'_',post_init_per_suite,[ct_scope_per_suite_state_scb_SUITE,'$proplist','$proplist',[test]]}},
- {?eh,tc_done,{ct_scope_per_suite_state_scb_SUITE,init_per_suite,ok}},
-
- {?eh,tc_start,{ct_scope_per_suite_state_scb_SUITE,test_case}},
- {?eh,scb,{'_',pre_init_per_testcase,[test_case,'$proplist',[test]]}},
- {?eh,scb,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[test]]}},
- {?eh,tc_done,{ct_scope_per_suite_state_scb_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_scope_per_suite_state_scb_SUITE,end_per_suite}},
- {?eh,scb,{'_',pre_end_per_suite,
- [ct_scope_per_suite_state_scb_SUITE,'$proplist',[test]]}},
- {?eh,scb,{'_',post_end_per_suite,[ct_scope_per_suite_state_scb_SUITE,'$proplist','_',[test]]}},
- {?eh,scb,{'_',terminate,[[test]]}},
- {?eh,tc_done,{ct_scope_per_suite_state_scb_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(scope_suite_state_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scope_suite_state_scb_SUITE,init_per_suite}},
- {?eh,scb,{'_',id,[[test]]}},
- {?eh,scb,{'_',init,['_',[test]]}},
- {?eh,scb,{'_',pre_init_per_suite,[ct_scope_suite_state_scb_SUITE,'$proplist',[test]]}},
- {?eh,scb,{'_',post_init_per_suite,[ct_scope_suite_state_scb_SUITE,'$proplist','$proplist',[test]]}},
- {?eh,tc_done,{ct_scope_suite_state_scb_SUITE,init_per_suite,ok}},
-
- {?eh,tc_start,{ct_scope_suite_state_scb_SUITE,test_case}},
- {?eh,scb,{'_',pre_init_per_testcase,[test_case,'$proplist',[test]]}},
- {?eh,scb,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[test]]}},
- {?eh,tc_done,{ct_scope_suite_state_scb_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_scope_suite_state_scb_SUITE,end_per_suite}},
- {?eh,scb,{'_',pre_end_per_suite,[ct_scope_suite_state_scb_SUITE,'$proplist',[test]]}},
- {?eh,scb,{'_',post_end_per_suite,[ct_scope_suite_state_scb_SUITE,'$proplist','_',[test]]}},
- {?eh,scb,{'_',terminate,[[test]]}},
- {?eh,tc_done,{ct_scope_suite_state_scb_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(scope_per_group_state_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scope_per_group_state_scb_SUITE,init_per_suite}},
- {?eh,tc_done,{ct_scope_per_group_state_scb_SUITE,init_per_suite,ok}},
-
- [{?eh,tc_start,{ct_scope_per_group_state_scb_SUITE,{init_per_group,group1,[]}}},
- {?eh,scb,{'_',id,[[test]]}},
- {?eh,scb,{'_',init,['_',[test]]}},
- {?eh,scb,{'_',post_init_per_group,[group1,'$proplist','$proplist',[test]]}},
- {?eh,tc_done,{ct_scope_per_group_state_scb_SUITE,{init_per_group,group1,[]},ok}},
-
- {?eh,tc_start,{ct_scope_per_group_state_scb_SUITE,test_case}},
- {?eh,scb,{'_',pre_init_per_testcase,[test_case,'$proplist',[test]]}},
- {?eh,scb,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[test]]}},
- {?eh,tc_done,{ct_scope_per_group_state_scb_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_scope_per_group_state_scb_SUITE,{end_per_group,group1,[]}}},
- {?eh,scb,{'_',pre_end_per_group,[group1,'$proplist',[test]]}},
- {?eh,scb,{'_',post_end_per_group,[group1,'$proplist','_',[test]]}},
- {?eh,scb,{'_',terminate,[[test]]}},
- {?eh,tc_done,{ct_scope_per_group_state_scb_SUITE,{end_per_group,group1,[]},ok}}],
-
- {?eh,tc_start,{ct_scope_per_group_state_scb_SUITE,end_per_suite}},
- {?eh,tc_done,{ct_scope_per_group_state_scb_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(fail_pre_suite_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
-
-
- {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
- {?eh,scb,{'_',pre_init_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_init_per_suite,[ct_scb_empty_SUITE,'$proplist',
- {fail,"Test failure"},[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,
- {failed, {error,"Test failure"}}}},
- {?eh,scb,{'_',on_tc_fail,
- [init_per_suite,{failed,"Test failure"},[]]}},
-
-
- {?eh,tc_auto_skip,{ct_scb_empty_SUITE,test_case,
- {failed,{ct_scb_empty_SUITE,init_per_suite,
- {failed,"Test failure"}}}}},
- {?eh,scb,{'_',on_tc_skip,
- [test_case, {tc_auto_skip,
- {failed, {ct_scb_empty_SUITE, init_per_suite,
- {failed, "Test failure"}}}},[]]}},
-
-
- {?eh,tc_auto_skip, {ct_scb_empty_SUITE, end_per_suite,
- {failed, {ct_scb_empty_SUITE, init_per_suite,
- {failed, "Test failure"}}}}},
- {?eh,scb,{'_',on_tc_skip,
- [end_per_suite, {tc_auto_skip,
- {failed, {ct_scb_empty_SUITE, init_per_suite,
- {failed, "Test failure"}}}},[]]}},
-
-
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb, {'_',terminate,[[]]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(fail_post_suite_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
- {?eh,scb,{'_',pre_init_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_init_per_suite,[ct_scb_empty_SUITE,'$proplist','$proplist',[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,
- {failed,{error,"Test failure"}}}},
- {?eh,scb,{'_',on_tc_fail,[init_per_suite, {failed,"Test failure"}, []]}},
-
- {?eh,tc_auto_skip,{ct_scb_empty_SUITE,test_case,
- {failed,{ct_scb_empty_SUITE,init_per_suite,
- {failed,"Test failure"}}}}},
- {?eh,scb,{'_',on_tc_skip,[test_case,{tc_auto_skip,'_'},[]]}},
-
- {?eh,tc_auto_skip, {ct_scb_empty_SUITE, end_per_suite,
- {failed, {ct_scb_empty_SUITE, init_per_suite,
- {failed, "Test failure"}}}}},
- {?eh,scb,{'_',on_tc_skip,[end_per_suite,{tc_auto_skip,'_'},[]]}},
-
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb, {'_',terminate,[[]]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(skip_pre_suite_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
- {?eh,scb,{'_',pre_init_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_init_per_suite,[ct_scb_empty_SUITE,'$proplist',{skip,"Test skip"},[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,{skipped,"Test skip"}}},
- {?eh,scb,{'_',on_tc_skip,
- [init_per_suite,{tc_user_skip,{skipped,"Test skip"}},[]]}},
-
- {?eh,tc_auto_skip,{ct_scb_empty_SUITE,test_case,"Test skip"}},
- {?eh,scb,{'_',on_tc_skip,[test_case,{tc_auto_skip,"Test skip"},[]]}},
-
- {?eh,tc_auto_skip, {ct_scb_empty_SUITE, end_per_suite,"Test skip"}},
- {?eh,scb,{'_',on_tc_skip,[end_per_suite,{tc_auto_skip,"Test skip"},[]]}},
-
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb, {'_',terminate,[[]]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(skip_post_suite_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
- {?eh,scb,{'_',pre_init_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_init_per_suite,[ct_scb_empty_SUITE,'$proplist','$proplist',[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,{skipped,"Test skip"}}},
- {?eh,scb,{'_',on_tc_skip,
- [init_per_suite,{tc_user_skip,{skipped,"Test skip"}},[]]}},
-
- {?eh,tc_auto_skip,{ct_scb_empty_SUITE,test_case,"Test skip"}},
- {?eh,scb,{'_',on_tc_skip,[test_case,{tc_auto_skip,"Test skip"},[]]}},
-
- {?eh,tc_auto_skip, {ct_scb_empty_SUITE, end_per_suite,"Test skip"}},
- {?eh,scb,{'_',on_tc_skip,[end_per_suite,{tc_auto_skip,"Test skip"},[]]}},
-
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb,{'_',terminate,[[]]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(recover_post_suite_scb) ->
- Suite = ct_scb_fail_per_suite_SUITE,
- [
- {?eh,start_logging,'_'},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{Suite,init_per_suite}},
- {?eh,scb,{'_',pre_init_per_suite,[Suite,'$proplist','$proplist']}},
- {?eh,scb,{'_',post_init_per_suite,[Suite,contains([tc_status]),
- {'EXIT',{'_','_'}},[]]}},
- {?eh,tc_done,{Suite,init_per_suite,ok}},
-
- {?eh,tc_start,{Suite,test_case}},
- {?eh,scb,{'_',pre_init_per_testcase,
- [test_case, not_contains([tc_status]),[]]}},
- {?eh,scb,{'_',post_end_per_testcase,
- [test_case, contains([tc_status]),'_',[]]}},
- {?eh,tc_done,{Suite,test_case,ok}},
-
- {?eh,tc_start,{Suite,end_per_suite}},
- {?eh,scb,{'_',pre_end_per_suite,
- [Suite,not_contains([tc_status]),[]]}},
- {?eh,scb,{'_',post_end_per_suite,
- [Suite,not_contains([tc_status]),'_',[]]}},
- {?eh,tc_done,{Suite,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb,{'_',terminate,[[]]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(update_config_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
-
- {?eh,tc_start,{ct_update_config_SUITE,init_per_suite}},
- {?eh,scb,{'_',pre_init_per_suite,
- [ct_update_config_SUITE,contains([]),[]]}},
- {?eh,scb,{'_',post_init_per_suite,
- [ct_update_config_SUITE,
- '$proplist',
- contains(
- [init_per_suite,
- pre_init_per_suite]),
- []]}},
- {?eh,tc_done,{ct_update_config_SUITE,init_per_suite,ok}},
-
- {?eh,tc_start,{ct_update_config_SUITE, {init_per_group,group1,[]}}},
- {?eh,scb,{'_',pre_init_per_group,
- [group1,contains(
- [post_init_per_suite,
- init_per_suite,
- pre_init_per_suite]),
- []]}},
- {?eh,scb,{'_',post_init_per_group,
- [group1,
- contains(
- [post_init_per_suite,
- init_per_suite,
- pre_init_per_suite]),
- contains(
- [init_per_group,
- pre_init_per_group,
- post_init_per_suite,
- init_per_suite,
- pre_init_per_suite]),
- []]}},
- {?eh,tc_done,{ct_update_config_SUITE,{init_per_group,group1,[]},ok}},
-
- {?eh,tc_start,{ct_update_config_SUITE,test_case}},
- {?eh,scb,{'_',pre_init_per_testcase,
- [test_case,contains(
- [post_init_per_group,
- init_per_group,
- pre_init_per_group,
- post_init_per_suite,
- init_per_suite,
- pre_init_per_suite]),
- []]}},
- {?eh,scb,{'_',post_end_per_testcase,
- [test_case,contains(
- [init_per_testcase,
- pre_init_per_testcase,
- post_init_per_group,
- init_per_group,
- pre_init_per_group,
- post_init_per_suite,
- init_per_suite,
- pre_init_per_suite]),
- ok,[]]}},
- {?eh,tc_done,{ct_update_config_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_update_config_SUITE, {end_per_group,group1,[]}}},
- {?eh,scb,{'_',pre_end_per_group,
- [group1,contains(
- [post_init_per_group,
- init_per_group,
- pre_init_per_group,
- post_init_per_suite,
- init_per_suite,
- pre_init_per_suite]),
- []]}},
- {?eh,scb,{'_',post_end_per_group,
- [group1,
- contains(
- [pre_end_per_group,
- post_init_per_group,
- init_per_group,
- pre_init_per_group,
- post_init_per_suite,
- init_per_suite,
- pre_init_per_suite]),
- ok,[]]}},
- {?eh,tc_done,{ct_update_config_SUITE,{end_per_group,group1,[]},ok}},
-
- {?eh,tc_start,{ct_update_config_SUITE,end_per_suite}},
- {?eh,scb,{'_',pre_end_per_suite,
- [ct_update_config_SUITE,contains(
- [post_init_per_suite,
- init_per_suite,
- pre_init_per_suite]),
- []]}},
- {?eh,scb,{'_',post_end_per_suite,
- [ct_update_config_SUITE,contains(
- [pre_end_per_suite,
- post_init_per_suite,
- init_per_suite,
- pre_init_per_suite]),
- '_',[]]}},
- {?eh,tc_done,{ct_update_config_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb,{'_',terminate,[contains(
- [post_end_per_suite,
- pre_end_per_suite,
- post_init_per_suite,
- init_per_suite,
- pre_init_per_suite])]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(state_update_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{'_',init_per_suite}},
-
- {?eh,tc_done,{'_',end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb,{'_',terminate,[contains(
- [post_end_per_suite,pre_end_per_suite,
- post_end_per_group,pre_end_per_group,
- {not_in_order,
- [post_end_per_testcase,pre_init_per_testcase,
- on_tc_skip,post_end_per_testcase,
- pre_init_per_testcase,on_tc_fail,
- post_end_per_testcase,pre_init_per_testcase]
- },
- post_init_per_group,pre_init_per_group,
- post_init_per_suite,pre_init_per_suite,
- init])]}},
- {?eh,scb,{'_',terminate,[contains(
- [post_end_per_suite,pre_end_per_suite,
- post_end_per_group,pre_end_per_group,
- {not_in_order,
- [post_end_per_testcase,pre_init_per_testcase,
- on_tc_skip,post_end_per_testcase,
- pre_init_per_testcase,on_tc_fail,
- post_end_per_testcase,pre_init_per_testcase]
- },
- post_init_per_group,pre_init_per_group,
- post_init_per_suite,pre_init_per_suite,
- init]
- )]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(options_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{empty_scb,init,['_',[test]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
- {?eh,scb,{empty_scb,pre_init_per_suite,
- [ct_scb_empty_SUITE,'$proplist',[test]]}},
- {?eh,scb,{empty_scb,post_init_per_suite,
- [ct_scb_empty_SUITE,'$proplist','$proplist',[test]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,ok}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,test_case}},
- {?eh,scb,{empty_scb,pre_init_per_testcase,[test_case,'$proplist',[test]]}},
- {?eh,scb,{empty_scb,post_end_per_testcase,[test_case,'$proplist','_',[test]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,test_case,ok}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,end_per_suite}},
- {?eh,scb,{empty_scb,pre_end_per_suite,
- [ct_scb_empty_SUITE,'$proplist',[test]]}},
- {?eh,scb,{empty_scb,post_end_per_suite,[ct_scb_empty_SUITE,'$proplist','_',[test]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,end_per_suite,ok}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb,{empty_scb,terminate,[[test]]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(same_id_scb) ->
- [
- {?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{'_',id,[[]]}},
- {?eh,scb,{'_',init,[same_id_scb,[]]}},
- {?eh,scb,{'_',id,[[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
- {?eh,scb,{'_',pre_init_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {negative,
- {?eh,scb,{'_',pre_init_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_init_per_suite,
- [ct_scb_empty_SUITE,'$proplist','$proplist',[]]}}},
- {negative,
- {?eh,scb,{'_',post_init_per_suite,
- [ct_scb_empty_SUITE,'$proplist','$proplist',[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,ok}}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,test_case}},
- {?eh,scb,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
- {negative,
- {?eh,scb,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}}},
- {negative,
- {?eh,scb,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,test_case,ok}}},
-
- {?eh,tc_start,{ct_scb_empty_SUITE,end_per_suite}},
- {?eh,scb,{'_',pre_end_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {negative,
- {?eh,scb,{'_',pre_end_per_suite,[ct_scb_empty_SUITE,'$proplist',[]]}},
- {?eh,scb,{'_',post_end_per_suite,[ct_scb_empty_SUITE,'$proplist','_',[]]}}},
- {negative,
- {?eh,scb,{'_',post_end_per_suite,
- [ct_scb_empty_SUITE,'$proplist','_',[]]}},
- {?eh,tc_done,{ct_scb_empty_SUITE,end_per_suite,ok}}},
- {?eh,test_done,{'DEF','STOP_TIME'}},
- {?eh,scb,{'_',terminate,[[]]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(fail_n_skip_with_minimal_scb) ->
- [{?eh,start_logging,{'DEF','RUNDIR'}},
- {?eh,scb,{'_',init,['_',[]]}},
- {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
- {?eh,tc_start,{'_',init_per_suite}},
-
- {?eh,tc_done,{'_',end_per_suite,ok}},
- {?eh,scb,{'_',terminate,[[]]}},
- {?eh,stop_logging,[]}
- ];
-
-test_events(ok) ->
- ok.
-
-
-%% test events help functions
-contains(List) ->
- fun(Proplist) when is_list(Proplist) ->
- contains(List,Proplist)
- end.
-
-contains([{not_in_order,List}|T],Rest) ->
- contains_parallel(List,Rest),
- contains(T,Rest);
-contains([{Ele,Pos}|T] = L,[H|T2]) ->
- case element(Pos,H) of
- Ele ->
- contains(T,T2);
- _ ->
- contains(L,T2)
- end;
-contains([Ele|T],[{Ele,_}|T2])->
- contains(T,T2);
-contains([Ele|T],[Ele|T2])->
- contains(T,T2);
-contains(List,[_|T]) ->
- contains(List,T);
-contains([],_) ->
- match.
-
-contains_parallel([Key | T], Elems) ->
- contains([Key],Elems),
- contains_parallel(T,Elems);
-contains_parallel([],_Elems) ->
- match.
-
-not_contains(List) ->
- fun(Proplist) when is_list(Proplist) ->
- [] = [Ele || {Ele,_} <- Proplist,
- Test <- List,
- Test =:= Ele]
- end.