diff options
author | Siri Hansen <[email protected]> | 2019-06-10 13:12:09 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2019-06-10 13:12:09 +0200 |
commit | a8bb18c1f759102eb0f7a794914b28506ada8048 (patch) | |
tree | b4a6f924d53eee10f8e31b10151ff3317da6e32b /lib/common_test/src | |
parent | 163cc998f96a4dc6e2d9151cce257dabeb1b1353 (diff) | |
parent | fe8521bf93994a1d0d2021099f3a99473e1d3731 (diff) | |
download | otp-a8bb18c1f759102eb0f7a794914b28506ada8048.tar.gz otp-a8bb18c1f759102eb0f7a794914b28506ada8048.tar.bz2 otp-a8bb18c1f759102eb0f7a794914b28506ada8048.zip |
Merge branch 'siri/ct/hook-terminated-not-initiated/ERIERL-370/OTP-15863' into maint
* 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.erl | 11 |
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 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 |