diff options
Diffstat (limited to 'lib/common_test/src/ct_suite_callback.erl')
-rw-r--r-- | lib/common_test/src/ct_suite_callback.erl | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lib/common_test/src/ct_suite_callback.erl b/lib/common_test/src/ct_suite_callback.erl index 06c7fc3833..4973ed685c 100644 --- a/lib/common_test/src/ct_suite_callback.erl +++ b/lib/common_test/src/ct_suite_callback.erl @@ -91,25 +91,25 @@ init_tc(_Mod, TC, Config) -> end_tc(ct_framework, _Func, _Args, Result, _Return) -> 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, Config]); -end_tc(Mod, init_per_suite, Config, Result, _Return) -> - call(fun call_generic/3, Result, [post_init_per_suite, Mod, Config]); +end_tc(Mod, init_per_suite, Config, Result, Return) -> + call(fun call_generic/3, Return, [post_init_per_suite, Mod, Config], + '$ct_no_change'); end_tc(Mod, end_per_suite, Config, Result, _Return) -> - call(fun call_generic/3, Result, [post_end_per_suite, Mod, Config]); + call(fun call_generic/3, Result, [post_end_per_suite, Mod, Config], + '$ct_no_change'); -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, Config]); -end_tc(_Mod, {init_per_group, GroupName, _}, Config, Result, _Return) -> - call(fun call_generic/3, Result, [post_init_per_group, GroupName, Config]); +end_tc(_Mod, {init_per_group, GroupName, _}, Config, Result, Return) -> + call(fun call_generic/3, Return, [post_init_per_group, GroupName, Config], + '$ct_no_change'); end_tc(_Mod, {end_per_group, GroupName, _}, Config, Result, _Return) -> - call(fun call_generic/3, Result, [post_end_per_group, GroupName, Config]); + call(fun call_generic/3, Result, [post_end_per_group, GroupName, Config], + '$ct_no_change'); end_tc(_Mod, TC, Config, Result, _Return) -> - call(fun call_generic/3, Result, [post_end_per_testcase, TC, Config]). + 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]). @@ -146,6 +146,12 @@ call(Fun, Config, Meta) -> call([{CBId,Fun} || {CBId,_, _} <- CBs] ++ get_new_callbacks(Config, Fun), remove(?config_name,Config), Meta, CBs). +call(Fun, Config, Meta, NoChangeRet) when is_function(Fun) -> + case call(Fun,Config,Meta) of + Config -> NoChangeRet; + NewReturn -> NewReturn + end; + call([{CB, call_init, NextFun} | Rest], Config, Meta, CBs) -> try {Config, {NewId, _, {Mod,_State}} = NewCB} = call_init(CB, Config, Meta), |