diff options
author | Siri Hansen <[email protected]> | 2019-06-10 13:15:13 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2019-06-10 13:15:13 +0200 |
commit | 034793ea69616d55c88e775906898c912ca7eb9c (patch) | |
tree | 16fc7beaef1f85f763ea3699e79b897ec7b8e280 | |
parent | eaab867877368e9922256277c72c8bc8f70a72b7 (diff) | |
parent | a8bb18c1f759102eb0f7a794914b28506ada8048 (diff) | |
download | otp-034793ea69616d55c88e775906898c912ca7eb9c.tar.gz otp-034793ea69616d55c88e775906898c912ca7eb9c.tar.bz2 otp-034793ea69616d55c88e775906898c912ca7eb9c.zip |
Merge branch 'maint'
-rw-r--r-- | lib/common_test/src/ct_hooks.erl | 11 | ||||
-rw-r--r-- | lib/common_test/test/ct_hooks_SUITE.erl | 10 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/common_test/src/ct_hooks.erl b/lib/common_test/src/ct_hooks.erl index 97c349578f..94551d6815 100644 --- a/lib/common_test/src/ct_hooks.erl +++ b/lib/common_test/src/ct_hooks.erl @@ -363,7 +363,16 @@ terminate_if_scope_ends(HookId, Function0, Hooks) -> Function = strip_config(Function0), case lists:keyfind(HookId, #ct_hook_config.id, Hooks) of #ct_hook_config{ id = HookId, scope = Function} = Hook -> - terminate([Hook]), + case Function of + [AllOrGroup,_] when AllOrGroup=:=post_all; + AllOrGroup=:=post_groups -> + %% The scope only contains one function (post_all + %% or post_groups), and init has not been called, + %% so skip terminate as well. + ok; + _ -> + terminate([Hook]) + end, lists:keydelete(HookId, #ct_hook_config.id, Hooks); _ -> Hooks diff --git a/lib/common_test/test/ct_hooks_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE.erl index 340b8f3d52..08c18d91e2 100644 --- a/lib/common_test/test/ct_hooks_SUITE.erl +++ b/lib/common_test/test/ct_hooks_SUITE.erl @@ -671,9 +671,15 @@ test_events(scope_suite_cth) -> {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, %% check that post_groups and post_all comes before init when hook %% is installed in suite/0 + %% And there should be no terminate after these, since init is + %% not yet called. {?eh,cth,{'_',post_groups,['_',[]]}}, - {?eh,cth,{'_',post_all,['_','_',[]]}}, - {?eh,tc_start,{ct_scope_suite_cth_SUITE,init_per_suite}}, + {negative, + {?eh,cth,{'_',terminate,['_']}}, + {?eh,cth,{'_',post_all,['_','_',[]]}}}, + {negative, + {?eh,cth,{'_',terminate,['_']}}, + {?eh,tc_start,{ct_scope_suite_cth_SUITE,init_per_suite}}}, {?eh,cth,{'_',id,[[]]}}, {?eh,cth,{'_',init,['_',[]]}}, {?eh,cth,{'_',pre_init_per_suite,[ct_scope_suite_cth_SUITE,'$proplist',[]]}}, |