aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-03-22 18:36:54 +0100
committerLukas Larsson <[email protected]>2011-03-22 18:36:54 +0100
commit1fac6e5ea2a2932e960ee5ba8ae941744a5306f0 (patch)
tree96c22f62d8378b517eb2f4e20a37d7c9f6661372 /lib/common_test/src
parentf861b4fdb3fd39e35f2951c53a73b30a98c7f973 (diff)
downloadotp-1fac6e5ea2a2932e960ee5ba8ae941744a5306f0.tar.gz
otp-1fac6e5ea2a2932e960ee5ba8ae941744a5306f0.tar.bz2
otp-1fac6e5ea2a2932e960ee5ba8ae941744a5306f0.zip
Fix bug which would make cth's to not be removed when out of scope when adding a cth in suite/0 and crashing in pre_init_per_suite.
Diffstat (limited to 'lib/common_test/src')
-rw-r--r--lib/common_test/src/ct_hooks.erl15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/common_test/src/ct_hooks.erl b/lib/common_test/src/ct_hooks.erl
index 5eddefffce..984e04b90f 100644
--- a/lib/common_test/src/ct_hooks.erl
+++ b/lib/common_test/src/ct_hooks.erl
@@ -122,11 +122,11 @@ end_tc(_Mod, TC, Config, Result, _Return) ->
call(fun call_generic/3, Result, [post_end_per_testcase, TC, Config],
'$ct_no_change').
-on_tc_skip(How, {_Suite, Case, Reason}) ->
- call(fun call_cleanup/3, {How, Reason}, [on_tc_skip, Case]).
+on_tc_skip(How, {Suite, Case, Reason}) ->
+ call(fun call_cleanup/3, {How, Reason}, [on_tc_skip, Suite, Case]).
-on_tc_fail(_How, {_Suite, Case, Reason}) ->
- call(fun call_cleanup/3, Reason, [on_tc_fail, Case]).
+on_tc_fail(_How, {Suite, Case, Reason}) ->
+ call(fun call_cleanup/3, Reason, [on_tc_fail, Suite, Case]).
%% -------------------------------------------------------------------------
%% Internal Functions
@@ -145,7 +145,7 @@ call_terminate({Mod, State}, _, _) ->
catch_apply(Mod,terminate,[State], ok),
{[],{Mod,State}}.
-call_cleanup({Mod, State}, Reason, [Function | Args]) ->
+call_cleanup({Mod, State}, Reason, [Function, _Suite | Args]) ->
NewState = catch_apply(Mod,Function, Args ++ [Reason, State],
State),
{Reason, {Mod, NewState}}.
@@ -229,6 +229,11 @@ scope([post_init_per_suite, SuiteName|_]) ->
scope(init) ->
none.
+terminate_if_scope_ends(HookId, [on_tc_skip,_Suite,{end_per_group,Name}],
+ Hooks) ->
+ terminate_if_scope_ends(HookId, [post_end_per_group, Name], Hooks);
+terminate_if_scope_ends(HookId, [on_tc_skip,Suite,end_per_suite], Hooks) ->
+ terminate_if_scope_ends(HookId, [post_end_per_suite, Suite], Hooks);
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) ->