aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common_test/src')
-rw-r--r--lib/common_test/src/ct.erl14
-rw-r--r--lib/common_test/src/ct_framework.erl6
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/common_test/src/ct.erl b/lib/common_test/src/ct.erl
index 63a8adbc63..296416737f 100644
--- a/lib/common_test/src/ct.erl
+++ b/lib/common_test/src/ct.erl
@@ -993,13 +993,21 @@ remove_config(Callback, Config) ->
%%%-----------------------------------------------------------------
%%% @spec timetrap(Time) -> ok
-%%% Time = {hours,Hours} | {minutes,Mins} | {seconds,Secs} | Millisecs | infinity
+%%% Time = {hours,Hours} | {minutes,Mins} | {seconds,Secs} | Millisecs | infinity | Func
%%% Hours = integer()
%%% Mins = integer()
%%% Secs = integer()
%%% Millisecs = integer() | float()
-%%%
-%%% @doc <p>Use this function to set a new timetrap for the running test case.</p>
+%%% Func = {M,F,A} | fun()
+%%% M = atom()
+%%% F = atom()
+%%% A = list()
+%%%
+%%% @doc <p>Use this function to set a new timetrap for the running test case.
+%%% If the argument is <code>Func</code>, the timetrap will be triggered
+%%% when this function returns. <code>Func</code> may also return a new
+%%% <code>Time</code> value, which in that case will be the value for the
+%%% new timetrap.</p>
timetrap(Time) ->
test_server:timetrap_cancel(),
test_server:timetrap(Time).
diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl
index 187794e78b..c8aff3c039 100644
--- a/lib/common_test/src/ct_framework.erl
+++ b/lib/common_test/src/ct_framework.erl
@@ -212,7 +212,7 @@ init_tc2(Mod,Suite,Func,SuiteInfo,MergeResult,Config) ->
{auto_skip,{require_failed,Reason}};
{'EXIT',Reason} ->
{auto_skip,Reason};
- {ok,FinalConfig} ->
+ {ok,Config1} ->
case MergeResult of
{error,Reason} ->
%% suite0 configure finished now, report that
@@ -221,9 +221,9 @@ init_tc2(Mod,Suite,Func,SuiteInfo,MergeResult,Config) ->
_ ->
case get('$test_server_framework_test') of
undefined ->
- ct_suite_init(Suite, FuncSpec, FinalConfig);
+ ct_suite_init(Mod, FuncSpec, Config1);
Fun ->
- case Fun(init_tc, FinalConfig) of
+ case Fun(init_tc, Config1) of
NewConfig when is_list(NewConfig) ->
{ok,NewConfig};
Else ->