aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_util.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2010-09-20 15:46:12 +0200
committerLukas Larsson <[email protected]>2010-12-08 18:07:46 +0100
commitec4c840624a9a44d4d7d6b1e51e1f33a291a704b (patch)
tree6119a9f5fbc6a98424c37a57d57ef686aaedbefe /lib/common_test/src/ct_util.erl
parent9f4d45da9bfa3b1f5d3d345e48447ad89088afc9 (diff)
downloadotp-ec4c840624a9a44d4d7d6b1e51e1f33a291a704b.tar.gz
otp-ec4c840624a9a44d4d7d6b1e51e1f33a291a704b.tar.bz2
otp-ec4c840624a9a44d4d7d6b1e51e1f33a291a704b.zip
Add support for suite_callback in spec, command_line and interactive. Start work on suite_callback functionality.
Diffstat (limited to 'lib/common_test/src/ct_util.erl')
-rw-r--r--lib/common_test/src/ct_util.erl22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl
index b5ab4cbb6e..4696b3c954 100644
--- a/lib/common_test/src/ct_util.erl
+++ b/lib/common_test/src/ct_util.erl
@@ -32,7 +32,9 @@
-export([close_connections/0]).
--export([save_suite_data/3, save_suite_data/2, read_suite_data/1,
+-export([save_suite_data/3, save_suite_data/2,
+ save_suite_data_async/3, save_suite_data_async/2,
+ read_suite_data/1,
delete_suite_data/0, delete_suite_data/1, match_delete_suite_data/1,
delete_testdata/0, delete_testdata/1, set_testdata/1, get_testdata/1,
update_testdata/2]).
@@ -159,6 +161,11 @@ do_start(Parent,Mode,LogDir) ->
ok
end,
{StartTime,TestLogDir} = ct_logs:init(Mode),
+
+ %% Initiate suite_callbacks
+ ok = ct_suite_callback:init(Opts),
+
+
ct_event:notify(#event{name=test_start,
node=node(),
data={StartTime,
@@ -182,12 +189,19 @@ read_opts() ->
{error,{bad_installation,Error}}
end.
+
save_suite_data(Key, Value) ->
call({save_suite_data, {Key, undefined, Value}}).
save_suite_data(Key, Name, Value) ->
call({save_suite_data, {Key, Name, Value}}).
+save_suite_data_async(Key, Value) ->
+ save_suite_data_async(Key, undefined, Value).
+
+save_suite_data_async(Key, Name, Value) ->
+ cast({save_suite_data, {Key, Name, Value}}).
+
read_suite_data(Key) ->
call({read_suite_data, Key}).
@@ -308,6 +322,9 @@ loop(Mode,TestData,StartDir) ->
ct_config:stop(),
file:set_cwd(StartDir),
return(From,ok);
+ {Ref, _Msg} when is_reference(Ref) ->
+ %% This clause is used when doing cast operations.
+ loop(Mode,TestData,StartDir);
{get_mode,From} ->
return(From,Mode),
loop(Mode,TestData,StartDir);
@@ -713,6 +730,9 @@ call(Msg) ->
return({To,Ref},Result) ->
To ! {Ref, Result}.
+cast(Msg) ->
+ ct_util_server ! {Msg, {ct_util_server, make_ref()}}.
+
seconds(T) ->
test_server:seconds(T).