aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-05-06 12:23:24 +0200
committerLukas Larsson <[email protected]>2011-05-06 12:23:24 +0200
commit1ab60eaaba8ba089a5b9a7d4b3119650ba08dac6 (patch)
treebbe1cd3b44fe3af07fd86267fe9b2024ade0ed44 /lib/common_test/src
parent3269ff93e20ea68162c9d38c300758feb0c48f10 (diff)
parent1fac6e5ea2a2932e960ee5ba8ae941744a5306f0 (diff)
downloadotp-1ab60eaaba8ba089a5b9a7d4b3119650ba08dac6.tar.gz
otp-1ab60eaaba8ba089a5b9a7d4b3119650ba08dac6.tar.bz2
otp-1ab60eaaba8ba089a5b9a7d4b3119650ba08dac6.zip
Merge branch 'lukas/common_test/ct_hook_bugs/OTP-9264' into dev
* lukas/common_test/ct_hook_bugs/OTP-9264: 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) ->