aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-02-28 08:18:09 +0100
committerBjörn Gustavsson <[email protected]>2016-03-09 13:19:54 +0100
commit8d7d5627919305a0b9bd4712dfe5238ad670d6fe (patch)
treea22d85ae878da1aae4d9334dd758eb1b925363e4 /lib/stdlib/test
parentd1fa4cb61880930ee19f81fbbfc59c8edb472a0f (diff)
downloadotp-8d7d5627919305a0b9bd4712dfe5238ad670d6fe.tar.gz
otp-8d7d5627919305a0b9bd4712dfe5238ad670d6fe.tar.bz2
otp-8d7d5627919305a0b9bd4712dfe5238ad670d6fe.zip
Replace calls to test_server:sleep/1 with ct:sleep/1 or timer:sleep/1
Note that the sleeping time in ct:sleep/1 will be scaled if the test is run with (for example) cover. When it is important that the sleep time is not adjusted, use timer:sleep/1.
Diffstat (limited to 'lib/stdlib/test')
-rw-r--r--lib/stdlib/test/gen_event_SUITE.erl2
-rw-r--r--lib/stdlib/test/gen_fsm_SUITE.erl4
-rw-r--r--lib/stdlib/test/gen_server_SUITE.erl16
-rw-r--r--lib/stdlib/test/proc_lib_SUITE.erl4
-rw-r--r--lib/stdlib/test/slave_SUITE.erl2
-rw-r--r--lib/stdlib/test/supervisor_SUITE.erl6
-rw-r--r--lib/stdlib/test/sys_SUITE.erl4
7 files changed, 19 insertions, 19 deletions
diff --git a/lib/stdlib/test/gen_event_SUITE.erl b/lib/stdlib/test/gen_event_SUITE.erl
index 6386619904..ac22a46d21 100644
--- a/lib/stdlib/test/gen_event_SUITE.erl
+++ b/lib/stdlib/test/gen_event_SUITE.erl
@@ -264,7 +264,7 @@ add_sup_handler(Config) when is_list(Config) ->
?line ok = gen_event:add_sup_handler(my_dummy_handler, dummy_h, [self()]),
?line [dummy_h] = gen_event:which_handlers(my_dummy_handler),
?line exit(Pid, sup_died),
- ?t:sleep(1000),
+ ct:sleep(1000),
?line [] = gen_event:which_handlers(my_dummy_handler),
?line ok = gen_event:add_sup_handler(my_dummy_handler, dummy_h, [self()]),
diff --git a/lib/stdlib/test/gen_fsm_SUITE.erl b/lib/stdlib/test/gen_fsm_SUITE.erl
index c097f3b645..67fc14e748 100644
--- a/lib/stdlib/test/gen_fsm_SUITE.erl
+++ b/lib/stdlib/test/gen_fsm_SUITE.erl
@@ -977,7 +977,7 @@ init(stop) ->
init(stop_shutdown) ->
{stop, shutdown};
init(sleep) ->
- test_server:sleep(1000),
+ ct:sleep(1000),
{ok, idle, data};
init({timeout, T}) ->
{ok, idle, state, T};
@@ -1010,7 +1010,7 @@ idle(_, Data) ->
idle({connect, _Pid}, _From, Data) ->
{reply, accept, wfor_conf, Data};
idle({delayed_answer, T}, _From, Data) ->
- test_server:sleep(T),
+ ct:sleep(T),
{reply, delayed, idle, Data};
idle(badreturn, _From, _Data) ->
badreturn;
diff --git a/lib/stdlib/test/gen_server_SUITE.erl b/lib/stdlib/test/gen_server_SUITE.erl
index 1ada226215..72457628ad 100644
--- a/lib/stdlib/test/gen_server_SUITE.erl
+++ b/lib/stdlib/test/gen_server_SUITE.erl
@@ -186,7 +186,7 @@ start(Config) when is_list(Config) ->
gen_server:start({global, my_test_name},
gen_server_SUITE, [], []),
?line ok = gen_server:call({global, my_test_name}, stop),
- test_server:sleep(1),
+ ct:sleep(1),
?line {'EXIT', {noproc,_}} = (catch gen_server:call(Pid4, started_p, 10)),
%% global register linked
@@ -215,7 +215,7 @@ start(Config) when is_list(Config) ->
gen_server:start({via, dummy_via, my_test_name},
gen_server_SUITE, [], []),
?line ok = gen_server:call({via, dummy_via, my_test_name}, stop),
- test_server:sleep(1),
+ ct:sleep(1),
?line {'EXIT', {noproc,_}} = (catch gen_server:call(Pid6, started_p, 10)),
%% via register linked
@@ -422,10 +422,10 @@ call(Config) when is_list(Config) ->
%% two requests within a specified time.
?line ok = gen_server:call(my_test_name, {call_within, 1000}),
- test_server:sleep(500),
+ timer:sleep(500),
?line ok = gen_server:call(my_test_name, next_call),
?line ok = gen_server:call(my_test_name, {call_within, 1000}),
- test_server:sleep(1500),
+ timer:sleep(1500),
?line false = gen_server:call(my_test_name, next_call),
%% timeout call.
@@ -582,7 +582,7 @@ cast_fast(Config) when is_list(Config) ->
?line FalseNode = list_to_atom("hopp@"++Host),
?line true = rpc:cast(Node, ?MODULE, cast_fast_messup, []),
% ?line io:format("Nodes ~p~n", [rpc:call(N, ?MODULE, cast_fast_messup, [])]),
- ?line test_server:sleep(1000),
+ ct:sleep(1000),
?line [Node] = nodes(),
?line {Time,ok} = test_server:timecall(gen_server, cast,
[{hopp,FalseNode},hopp]),
@@ -802,12 +802,12 @@ multicall(Config) when is_list(Config) ->
%% two requests within a specified time.
?line {[{Node,ok}],[]} =
gen_server:multi_call([Node], my_test_name, {call_within, 1000}),
- test_server:sleep(500),
+ timer:sleep(500),
?line {[{Node,ok}],[]} =
gen_server:multi_call([Node], my_test_name, next_call),
?line {[{Node,ok}],[]} =
gen_server:multi_call([Node], my_test_name, {call_within, 1000}),
- test_server:sleep(1500),
+ timer:sleep(1500),
?line {[{Node,false}],[]} =
gen_server:multi_call([Node],my_test_name, next_call),
@@ -1384,7 +1384,7 @@ init(stop) ->
init(hibernate) ->
{ok,[],hibernate};
init(sleep) ->
- test_server:sleep(1000),
+ ct:sleep(1000),
{ok, []};
init({state,State}) ->
{ok, State}.
diff --git a/lib/stdlib/test/proc_lib_SUITE.erl b/lib/stdlib/test/proc_lib_SUITE.erl
index ad0c06794a..f877313069 100644
--- a/lib/stdlib/test/proc_lib_SUITE.erl
+++ b/lib/stdlib/test/proc_lib_SUITE.erl
@@ -115,7 +115,7 @@ crash(Config) when is_list(Config) ->
%% Spawn function with neighbour.
Pid4 = proc_lib:spawn(?MODULE, sp2, []),
- test_server:sleep(100),
+ ct:sleep(100),
{?MODULE,sp2,[]} = proc_lib:initial_call(Pid4),
{?MODULE,sp2,0} = proc_lib:translate_initial_call(Pid4),
Pid4 ! die,
@@ -241,7 +241,7 @@ spawn_opt(Config) when is_list(Config) ->
FunMFArity = {?MODULE,Fname,0},
?line Pid1 = proc_lib:spawn_opt(node(), F, [{priority,low}]),
?line Pid = proc_lib:spawn_opt(F, [{priority,low}]),
- ?line test_server:sleep(100),
+ ct:sleep(100),
?line FunMFArgs = proc_lib:initial_call(Pid),
?line FunMFArity = proc_lib:translate_initial_call(Pid),
?line Pid ! die,
diff --git a/lib/stdlib/test/slave_SUITE.erl b/lib/stdlib/test/slave_SUITE.erl
index b7d5024311..165dfef73b 100644
--- a/lib/stdlib/test/slave_SUITE.erl
+++ b/lib/stdlib/test/slave_SUITE.erl
@@ -91,7 +91,7 @@ t_start_link(Config) when is_list(Config) ->
?line wait_alive(Slave2),
?line exit(Pid, kill),
?line receive {'EXIT', Pid, killed} -> ok end,
- ?line test_server:sleep(250),
+ ct:sleep(250),
?line is_dead(Slave1),
?line is_dead(Slave2),
diff --git a/lib/stdlib/test/supervisor_SUITE.erl b/lib/stdlib/test/supervisor_SUITE.erl
index fab321f9df..42775cf77d 100644
--- a/lib/stdlib/test/supervisor_SUITE.erl
+++ b/lib/stdlib/test/supervisor_SUITE.erl
@@ -1484,18 +1484,18 @@ count_restarting_children(Config) when is_list(Config) ->
supervisor_deadlock:restart_child(Ch1_1),
supervisor_deadlock:restart_child(Ch1_2),
supervisor_deadlock:restart_child(Ch1_3),
- test_server:sleep(400),
+ ct:sleep(400),
[1,3,0,3] = get_child_counts(SupPid),
[Ch2_1, Ch2_2, Ch2_3] = [C || {_,C,_,_} <- supervisor:which_children(SupPid)],
ets:insert(supervisor_deadlock,{fail_start,true}),
supervisor_deadlock:restart_child(Ch2_1),
supervisor_deadlock:restart_child(Ch2_2),
- test_server:sleep(4000), % allow restart to happen before proceeding
+ ct:sleep(4000), % allow restart to happen before proceeding
[1,1,0,3] = get_child_counts(SupPid),
ets:insert(supervisor_deadlock,{fail_start,false}),
- test_server:sleep(4000), % allow restart to happen before proceeding
+ ct:sleep(4000), % allow restart to happen before proceeding
[1,3,0,3] = get_child_counts(SupPid),
ok = supervisor:terminate_child(SupPid, Ch2_3),
diff --git a/lib/stdlib/test/sys_SUITE.erl b/lib/stdlib/test/sys_SUITE.erl
index 102a147fcd..ad4751f9de 100644
--- a/lib/stdlib/test/sys_SUITE.erl
+++ b/lib/stdlib/test/sys_SUITE.erl
@@ -98,12 +98,12 @@ stats(Config) when is_list(Config) ->
trace(suite) -> [];
trace(Config) when is_list(Config) ->
{ok,_Server} = start(),
- test_server:sleep(2000),
+ ct:sleep(2000),
test_server:capture_start(),
sys:trace(?server,true),
{ok,-44} = public_call(44),
%% ho, hum, allow for the io to reach us..
- test_server:sleep(1000),
+ ct:sleep(1000),
test_server:capture_stop(),
[Msg1,Msg2] = test_server:capture_get(),
lists:prefix("*DBG* sys_SUITE_server got call {req,44} from ",Msg1),