aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2010-11-18 14:15:50 +0100
committerLukas Larsson <[email protected]>2010-12-08 18:07:48 +0100
commit18b2dba61c4849fd924ace459d169d263e7e6619 (patch)
treeaab714f30f43ad28b525a1d8d7e00ab9f71385f1 /lib/common_test/src
parent3bacd0466501e872c69fbb89c7e6600395d7854c (diff)
downloadotp-18b2dba61c4849fd924ace459d169d263e7e6619.tar.gz
otp-18b2dba61c4849fd924ace459d169d263e7e6619.tar.bz2
otp-18b2dba61c4849fd924ace459d169d263e7e6619.zip
Add terminate SCB functionality
Diffstat (limited to 'lib/common_test/src')
-rw-r--r--lib/common_test/src/ct_suite_callback.erl13
-rw-r--r--lib/common_test/src/ct_util.erl4
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/common_test/src/ct_suite_callback.erl b/lib/common_test/src/ct_suite_callback.erl
index 702d9a354c..44e54f3968 100644
--- a/lib/common_test/src/ct_suite_callback.erl
+++ b/lib/common_test/src/ct_suite_callback.erl
@@ -27,7 +27,7 @@
-export([init/1]).
-export([init_tc/3]).
-export([end_tc/4]).
--export([terminate/2]).
+-export([terminate/1]).
-type proplist() :: [{atom(),term()}].
@@ -47,9 +47,12 @@ init(Opts) ->
%% @doc Called after all suites are done.
--spec terminate(Config :: proplist(),State :: term()) ->
+-spec terminate(Callbacks :: term()) ->
ok.
-terminate(_Config, _State) ->
+terminate(Callbacks) ->
+ io:format("Callbacks: ~p",[Callbacks]),
+ call([{CBId, fun call_terminate/3} || {CBId,_} <- Callbacks],
+ ct_suite_callback_init_dummy, undefined, Callbacks),
ok.
%% @doc Called as each test case is started. This includes all configuration
@@ -105,6 +108,10 @@ call_init({Mod, State}, Config, _) ->
{Id, NewState} = Mod:init(State),
{Config, {Id, {Mod, NewState}}}.
+call_terminate({Mod, State}, _, _) ->
+ Mod:terminate(State),
+ {[],{Mod,State}}.
+
call_generic({Mod, State}, Config, {Function, undefined}) ->
{NewConf, NewState} = Mod:Function(Config, State),
{NewConf, {Mod, NewState}};
diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl
index 4696b3c954..fddeff881e 100644
--- a/lib/common_test/src/ct_util.erl
+++ b/lib/common_test/src/ct_util.erl
@@ -313,6 +313,10 @@ loop(Mode,TestData,StartDir) ->
ct_event:sync_notify(#event{name=test_done,
node=node(),
data=Time}),
+ Callbacks = ets:lookup_element(?suite_table,
+ suite_callbacks,
+ #suite_data.value),
+ ct_suite_callback:terminate(Callbacks),
close_connections(ets:tab2list(?conn_table)),
ets:delete(?conn_table),
ets:delete(?board_table),