From 8b8709b08df7444c1d3c1474ae55311505b5b4b5 Mon Sep 17 00:00:00 2001
From: Lukas Larsson
Date: Mon, 21 Feb 2011 15:44:47 +0100
Subject: Update ct_hooks to fail gracefully when a hook is entered incorrectly
in suite/0
---
lib/common_test/src/ct_hooks.erl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/common_test/src/ct_hooks.erl b/lib/common_test/src/ct_hooks.erl
index 77b7566d9e..f3984ea46e 100644
--- a/lib/common_test/src/ct_hooks.erl
+++ b/lib/common_test/src/ct_hooks.erl
@@ -66,11 +66,11 @@ 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 = case catch 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]}]
end,
call(fun call_generic/3, Config ++ Info, [pre_init_per_suite, Mod]);
init_tc(Mod, end_per_suite, Config) ->
--
cgit v1.2.3
From f281f2cc52b34bbf5622379a7875b68c54aa7114 Mon Sep 17 00:00:00 2001
From: Lukas Larsson
Date: Tue, 8 Mar 2011 17:39:58 +0100
Subject: Update links info in ct_hooks to point to the right place
---
lib/common_test/doc/src/ct_hooks.xml | 4 ++--
1 file changed, 2 insertions(+), 2 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 if it exists. It behaves the same way as
pre_init_per_suite, but for the
-
+
end_per_suite function instead.
@@ -438,7 +438,7 @@
end_per_suite if it exists. It behaves the same way as
post_init_per_suite, but for the
-
+
end_per_suite function instead.
--
cgit v1.2.3
From 8c45bb73bfba60c5467798928d55ced6648991c1 Mon Sep 17 00:00:00 2001
From: Lukas Larsson
Date: Wed, 9 Mar 2011 10:28:47 +0100
Subject: Update init_per_suite to not crash when there is no suite/0
---
lib/common_test/src/ct_hooks.erl | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/common_test/src/ct_hooks.erl b/lib/common_test/src/ct_hooks.erl
index f3984ea46e..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}];
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) ->
--
cgit v1.2.3