aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2010-11-22 16:43:44 +0100
committerLukas Larsson <[email protected]>2010-12-08 18:07:51 +0100
commitc054d38535e4128e1c5b21980c9e5137a888ec56 (patch)
tree6cf9f76c7a9da66435ebc0fad4b999de0769a5a4 /lib/common_test/src
parent25dfebe8122488db306378eefb8d4ede5e4da601 (diff)
downloadotp-c054d38535e4128e1c5b21980c9e5137a888ec56.tar.gz
otp-c054d38535e4128e1c5b21980c9e5137a888ec56.tar.bz2
otp-c054d38535e4128e1c5b21980c9e5137a888ec56.zip
Add special tagging for scb in order for event generation to be backward compatible
Diffstat (limited to 'lib/common_test/src')
-rw-r--r--lib/common_test/src/ct_framework.erl20
-rw-r--r--lib/common_test/src/ct_suite_callback.erl27
2 files changed, 37 insertions, 10 deletions
diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl
index 487f093d38..9b749523e8 100644
--- a/lib/common_test/src/ct_framework.erl
+++ b/lib/common_test/src/ct_framework.erl
@@ -485,12 +485,13 @@ end_tc(Mod,Func,TCPid,Result,Args,Return) ->
case get('$test_server_framework_test') of
undefined ->
FinalResult = ct_suite_callback:end_tc(
- Mod, FuncSpec, Args, Result),
+ Mod, FuncSpec, Args, Result, Return),
% send sync notification so that event handlers may print
% in the log file before it gets closed
ct_event:sync_notify(#event{name=tc_done,
node=node(),
- data={Mod,FuncSpec,tag(FinalResult)}});
+ data={Mod,FuncSpec,
+ tag_scb(FinalResult)}});
Fun ->
% send sync notification so that event handlers may print
% in the log file before it gets closed
@@ -542,6 +543,21 @@ tag(E = testcase_aborted_or_killed) ->
tag(Other) ->
Other.
+tag_scb({STag,Reason}) when STag == skip; STag == skipped ->
+ {skipped,Reason};
+tag_scb({fail, Reason}) ->
+ {failed, Reason};
+tag_scb(E = {ETag,_}) when ETag == error; ETag == 'EXIT';
+ ETag == timetrap_timeout;
+ ETag == testcase_aborted ->
+ {failed,E};
+tag_scb(E = testcase_aborted_or_killed) ->
+ {failed,E};
+tag_scb(List) when is_list(List) ->
+ ok;
+tag_scb(Other) ->
+ Other.
+
%%%-----------------------------------------------------------------
%%% @spec error_notification(Mod,Func,Args,Error) -> ok
%%% Mod = atom()
diff --git a/lib/common_test/src/ct_suite_callback.erl b/lib/common_test/src/ct_suite_callback.erl
index e0822308a2..00fbb425a1 100644
--- a/lib/common_test/src/ct_suite_callback.erl
+++ b/lib/common_test/src/ct_suite_callback.erl
@@ -26,7 +26,7 @@
%% API Exports
-export([init/1]).
-export([init_tc/3]).
--export([end_tc/4]).
+-export([end_tc/5]).
-export([terminate/1]).
-type proplist() :: [{atom(),term()}].
@@ -79,23 +79,34 @@ init_tc(_Mod, TC, Config) ->
-spec end_tc(Mod :: atom(),
Func :: atom(),
Args :: list(),
- Result :: term()) ->
+ Result :: term(),
+ Resturn :: term()) ->
NewConfig :: proplist() |
{skip, Reason :: term()} |
{auto_skip, Reason :: term()} |
{fail, Reason :: term()} |
ok.
-end_tc(ct_framework, _Func, _Args, Result) ->
+end_tc(ct_framework, _Func, _Args, Result, _Return) ->
Result;
-end_tc(Mod, init_per_suite, _Config, Result) ->
+
+end_tc(Mod, init_per_suite, _Config, _Result, Return) when is_list(Return) ->
+ call(fun call_generic/3, Return, {post_init_per_suite, Mod});
+end_tc(Mod, init_per_suite, _Config, Result, _Return) ->
call(fun call_generic/3, Result, {post_init_per_suite, Mod});
-end_tc(Mod, end_per_suite, _Config, Result) ->
+
+end_tc(Mod, end_per_suite, _Config, Result, _Return) ->
call(fun call_generic/3, Result, {post_end_per_suite, Mod});
-end_tc(_Mod, {init_per_group, GroupName, _}, _Config, Result) ->
+
+end_tc(_Mod, {init_per_group, GroupName, _}, _Config, _Result, Return)
+ when is_list(Return) ->
+ call(fun call_generic/3, Return, {post_init_per_group, GroupName});
+end_tc(_Mod, {init_per_group, GroupName, _}, _Config, Result, _Return) ->
call(fun call_generic/3, Result, {post_init_per_group, GroupName});
-end_tc(_Mod, {end_per_group, GroupName, _}, _Config, Result) ->
+
+end_tc(_Mod, {end_per_group, GroupName, _}, _Config, Result, _Return) ->
call(fun call_generic/3, Result, {post_end_per_group, GroupName});
-end_tc(_Mod, TC, _Config, Result) ->
+
+end_tc(_Mod, TC, _Config, Result, _Return) ->
call(fun call_generic/3, Result, {post_end_per_testcase, TC}).
%% -------------------------------------------------------------------------