aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2019-06-14 08:47:44 +0200
committerErlang/OTP <[email protected]>2019-06-14 08:47:44 +0200
commit54eec90366a910e28272fa3d33e688c22c91ec7f (patch)
tree1178452341439afce00245d99f6ce27d53c3c7bf /lib/common_test/src
parentd2ea4fb717bad10971932a7c2c995942156d869e (diff)
parentfe8521bf93994a1d0d2021099f3a99473e1d3731 (diff)
downloadotp-54eec90366a910e28272fa3d33e688c22c91ec7f.tar.gz
otp-54eec90366a910e28272fa3d33e688c22c91ec7f.tar.bz2
otp-54eec90366a910e28272fa3d33e688c22c91ec7f.zip
Merge branch 'siri/ct/hook-terminated-not-initiated/ERIERL-370/OTP-15863' into maint-20
* siri/ct/hook-terminated-not-initiated/ERIERL-370/OTP-15863: [ct] Fix bug where Hook:terminate/1 was called before Hook:init/2
Diffstat (limited to 'lib/common_test/src')
-rw-r--r--lib/common_test/src/ct_hooks.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/common_test/src/ct_hooks.erl b/lib/common_test/src/ct_hooks.erl
index 903710963c..dc189c3000 100644
--- a/lib/common_test/src/ct_hooks.erl
+++ b/lib/common_test/src/ct_hooks.erl
@@ -373,7 +373,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