aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/test/ct_test_support_eh.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2010-06-03 14:34:09 +0200
committerRaimo Niskanen <[email protected]>2010-06-09 16:19:21 +0200
commit7c6504029f84c52de40a6b29b2fd1b17c053ccec (patch)
tree048864f9673af5757359e25a99b613c91253a4a1 /lib/common_test/test/ct_test_support_eh.erl
parent4da38a84f7540856fa590afdba2eb7958978788c (diff)
downloadotp-7c6504029f84c52de40a6b29b2fd1b17c053ccec.tar.gz
otp-7c6504029f84c52de40a6b29b2fd1b17c053ccec.tar.bz2
otp-7c6504029f84c52de40a6b29b2fd1b17c053ccec.zip
Add event_handler_init start flag that can pass init arguments to event handlers
Also changed: The userconfig option in ct:run_test/1 from 3-tuple to 2-tuple.
Diffstat (limited to 'lib/common_test/test/ct_test_support_eh.erl')
-rw-r--r--lib/common_test/test/ct_test_support_eh.erl17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/common_test/test/ct_test_support_eh.erl b/lib/common_test/test/ct_test_support_eh.erl
index fd3ae18746..1454d20e47 100644
--- a/lib/common_test/test/ct_test_support_eh.erl
+++ b/lib/common_test/test/ct_test_support_eh.erl
@@ -44,8 +44,20 @@
%% Description: Whenever a new event handler is added to an event manager,
%% this function is called to initialize the event handler.
%%--------------------------------------------------------------------
+init(String = [X|_]) when is_integer(X) ->
+ case erl_scan:string(String++".") of
+ {ok,Ts,_} ->
+ case erl_parse:parse_term(Ts) of
+ {ok,Args} ->
+ init(Args);
+ _ ->
+ init(String)
+ end;
+ _ ->
+ init(String)
+ end;
+
init(Args) ->
-
S1 = case lists:keysearch(cbm, 1, Args) of
{_,{cbm,CBM}} ->
#state{cbm=CBM};
@@ -58,7 +70,8 @@ init(Args) ->
_ ->
S1
end,
- print(S2#state.trace_level, "Event Handler ~w started!~n", [?MODULE]),
+ print(S2#state.trace_level, "Event Handler ~w started with ~p~n",
+ [?MODULE,Args]),
{ok,S2}.
%%--------------------------------------------------------------------