aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-03-10 11:04:03 +0100
committerLukas Larsson <[email protected]>2011-03-10 11:04:03 +0100
commitcc5885e81da81dc52bd7890ff3612a48d2f4a9f2 (patch)
treeaaccc24182ee30da64c550713140e2503e95b84a /lib
parent8533b8bcae728783b1c066b9fecb96b1cc2eb03c (diff)
parent8c45bb73bfba60c5467798928d55ced6648991c1 (diff)
downloadotp-cc5885e81da81dc52bd7890ff3612a48d2f4a9f2.tar.gz
otp-cc5885e81da81dc52bd7890ff3612a48d2f4a9f2.tar.bz2
otp-cc5885e81da81dc52bd7890ff3612a48d2f4a9f2.zip
Merge branch 'lukas/common_test/suite_callback/OTP-8851' into dev
* lukas/common_test/suite_callback/OTP-8851: Update init_per_suite to not crash when there is no suite/0 Update links info in ct_hooks to point to the right place Update ct_hooks to fail gracefully when a hook is entered incorrectly in suite/0
Diffstat (limited to 'lib')
-rw-r--r--lib/common_test/doc/src/ct_hooks.xml4
-rw-r--r--lib/common_test/src/ct_hooks.erl8
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/common_test/doc/src/ct_hooks.xml b/lib/common_test/doc/src/ct_hooks.xml
index 0d59ce3b22..b52eb737ad 100644
--- a/lib/common_test/doc/src/ct_hooks.xml
+++ b/lib/common_test/doc/src/ct_hooks.xml
@@ -409,7 +409,7 @@
end_per_suite</seealso> if it exists. It behaves the same way as
<seealso marker="ct_hooks#Module:pre_init_per_suite-3">
pre_init_per_suite</seealso>, but for the
- <seealso marker="common_test#Module:end_per_suite-2">
+ <seealso marker="common_test#Module:end_per_suite-1">
end_per_suite</seealso> function instead.</p>
</desc>
</func>
@@ -438,7 +438,7 @@
end_per_suite</seealso> if it exists. It behaves the same way as
<seealso marker="ct_hooks#Module:post_init_per_suite-4">
post_init_per_suite</seealso>, but for the
- <seealso marker="common_test#Module:end_per_suite-2">
+ <seealso marker="common_test#Module:end_per_suite-1">
end_per_suite</seealso> function instead.</p>
</desc>
</func>
diff --git a/lib/common_test/src/ct_hooks.erl b/lib/common_test/src/ct_hooks.erl
index 77b7566d9e..6f315d4b82 100644
--- a/lib/common_test/src/ct_hooks.erl
+++ b/lib/common_test/src/ct_hooks.erl
@@ -66,11 +66,13 @@ terminate(Hooks) ->
init_tc(ct_framework, _Func, Args) ->
Args;
init_tc(Mod, init_per_suite, Config) ->
- Info = case catch proplists:get_value(ct_hooks, Mod:suite()) of
+ Info = try proplists:get_value(ct_hooks, Mod:suite(),[]) of
List when is_list(List) ->
[{ct_hooks,List}];
- _Else ->
- []
+ CTHook when is_atom(CTHook) ->
+ [{ct_hooks,[CTHook]}]
+ catch error:undef ->
+ [{ct_hooks,[]}]
end,
call(fun call_generic/3, Config ++ Info, [pre_init_per_suite, Mod]);
init_tc(Mod, end_per_suite, Config) ->