aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common_test/src')
-rw-r--r--lib/common_test/src/ct_run.erl2
-rw-r--r--lib/common_test/src/ct_suite_callback.erl9
-rw-r--r--lib/common_test/src/ct_util.erl10
3 files changed, 15 insertions, 6 deletions
diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl
index 78782d346a..7d6a2f54d9 100644
--- a/lib/common_test/src/ct_run.erl
+++ b/lib/common_test/src/ct_run.erl
@@ -2203,6 +2203,8 @@ opts2args(EnvStartOpts) ->
end, EHs),
[_LastAnd|StrsR] = lists:reverse(lists:flatten(Strs)),
[{event_handler_init,lists:reverse(StrsR)}];
+ ({suite_callbacks,[]}) ->
+ [];
({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_suite_callback.erl b/lib/common_test/src/ct_suite_callback.erl
index 4f6bf9942e..8372303737 100644
--- a/lib/common_test/src/ct_suite_callback.erl
+++ b/lib/common_test/src/ct_suite_callback.erl
@@ -46,8 +46,7 @@
{error, Reason :: term()}.
init(Opts) ->
call([{CB, call_init, undefined} || CB <- get_new_callbacks(Opts)],
- ct_suite_callback_init_dummy, init, []),
- ok.
+ ok, init, []).
%% @doc Called after all suites are done.
@@ -181,9 +180,11 @@ call([{CB, call_init, NextFun} | Rest], Config, Meta, CBs) ->
[Mod,NewId]),
call(NewRest, Config, Meta, NewCBs)
catch Error:Reason ->
+ Trace = erlang:get_stacktrace(),
ct_logs:log("Suite Callback","Failed to start a SCB: ~p:~p",
- [Error,{Reason,erlang:get_stacktrace()}]),
- call(Rest, Config, Meta, CBs)
+ [Error,{Reason,Trace}]),
+ call([], {fail,"Failed to start SCB"
+ ", see the CT Log for details"}, Meta, CBs)
end;
call([{CBId, Fun} | Rest], Config, Meta, CBs) ->
try
diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl
index fddeff881e..2f5a90a543 100644
--- a/lib/common_test/src/ct_util.erl
+++ b/lib/common_test/src/ct_util.erl
@@ -163,8 +163,14 @@ do_start(Parent,Mode,LogDir) ->
{StartTime,TestLogDir} = ct_logs:init(Mode),
%% Initiate suite_callbacks
- ok = ct_suite_callback:init(Opts),
-
+ case catch ct_suite_callback:init(Opts) of
+ ok ->
+ ok;
+ {_,SCBReason} ->
+ ct_logs:tc_print('Suite Callback',SCBReason,[]),
+ Parent ! {self(), SCBReason},
+ self() ! {{stop,normal},{self(),make_ref()}}
+ end,
ct_event:notify(#event{name=test_start,
node=node(),