aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2010-12-08 17:16:49 +0100
committerLukas Larsson <[email protected]>2010-12-08 18:08:28 +0100
commit8ed5c47ca047405b2c00a979a8567412e5283322 (patch)
treeb934eaf290cb2dd3249ff2bc81ddff8079b9710d /lib/common_test/src
parent8b33f2edabbfd684e619238bbfaa10cc16e2a0a7 (diff)
downloadotp-8ed5c47ca047405b2c00a979a8567412e5283322.tar.gz
otp-8ed5c47ca047405b2c00a979a8567412e5283322.tar.bz2
otp-8ed5c47ca047405b2c00a979a8567412e5283322.zip
Add so that failures in SCB:init/1 causes the entire scb scope to fail
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(),