aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/logger_std_h_SUITE.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-06-15 11:16:00 +0200
committerSiri Hansen <[email protected]>2018-06-15 11:16:00 +0200
commit1bf30863a847aec45799361d39ccd440346b2d6a (patch)
treeeaf29208480ef4ec671ee429f6ad171013c3f2f7 /lib/kernel/test/logger_std_h_SUITE.erl
parent3c2ab242ecf10cc49e81e053514634a5fa10af1a (diff)
parent5e23103186cb71c64f7f2fa28cbfd8c62d7ee21b (diff)
downloadotp-1bf30863a847aec45799361d39ccd440346b2d6a.tar.gz
otp-1bf30863a847aec45799361d39ccd440346b2d6a.tar.bz2
otp-1bf30863a847aec45799361d39ccd440346b2d6a.zip
Merge branch 'siri/logger-fix'
* siri/logger-fix: [logger] Update documentation [logger] Adjust priority settings in test [logger] Unregister handler names before terminating [logger] Stress overload_kill tests in disk_log handler
Diffstat (limited to 'lib/kernel/test/logger_std_h_SUITE.erl')
-rw-r--r--lib/kernel/test/logger_std_h_SUITE.erl31
1 files changed, 21 insertions, 10 deletions
diff --git a/lib/kernel/test/logger_std_h_SUITE.erl b/lib/kernel/test/logger_std_h_SUITE.erl
index 134358bb64..ca54458ac1 100644
--- a/lib/kernel/test/logger_std_h_SUITE.erl
+++ b/lib/kernel/test/logger_std_h_SUITE.erl
@@ -992,7 +992,7 @@ qlen_kill_new(Config) ->
ct:pal("Slow shutdown, handler process was killed!", [])
end,
file_delete(Log),
- {ok,_} = wait_for_process_up(h_proc_name(), RestartAfter * 3),
+ {ok,_} = wait_for_process_up(RestartAfter * 3),
ok
after
5000 ->
@@ -1043,7 +1043,7 @@ mem_kill_new(Config) ->
ct:pal("Slow shutdown, handler process was killed!", [])
end,
file_delete(Log),
- {ok,_} = wait_for_process_up(h_proc_name(), RestartAfter * 3),
+ {ok,_} = wait_for_process_up(RestartAfter * 3),
ok
after
5000 ->
@@ -1074,7 +1074,7 @@ restart_after(Config) ->
receive
{'DOWN', MRef1, _, _, _Reason1} ->
file_delete(Log),
- error = wait_for_process_up(h_proc_name(),?OVERLOAD_KILL_RESTART_AFTER * 3),
+ error = wait_for_process_up(?OVERLOAD_KILL_RESTART_AFTER * 3),
ok
after
5000 ->
@@ -1097,7 +1097,7 @@ restart_after(Config) ->
receive
{'DOWN', MRef2, _, _, _Reason2} ->
file_delete(Log),
- {ok,Pid1} = wait_for_process_up(h_proc_name(),RestartAfter * 3),
+ {ok,Pid1} = wait_for_process_up(RestartAfter * 3),
false = (Pid1 == Pid0),
ok
after
@@ -1254,13 +1254,9 @@ send_n_burst(N, seq, Text, Class) ->
send_n_burst(N-1, seq, Text, Class);
send_n_burst(N, {spawn,Ps,TO}, Text, Class) ->
ct:pal("~w processes each sending ~w messages", [Ps,N]),
- PerProc = fun() ->
- process_flag(priority,high),
- send_n_burst(N, seq, Text, Class)
- end,
MRefs = [begin if TO == 0 -> ok; true -> timer:sleep(TO) end,
- monitor(process,spawn_link(PerProc)) end ||
- _ <- lists:seq(1,Ps)],
+ monitor(process,spawn_link(per_proc_fun(N,Text,Class,X)))
+ end || X <- lists:seq(1,Ps)],
lists:foreach(fun(MRef) ->
receive
{'DOWN', MRef, _, _, _} ->
@@ -1279,6 +1275,16 @@ send_t_burst(T0, T, Text, Class, N) ->
send_t_burst(T0, T, Text, Class, N+1)
end.
+per_proc_fun(N,Text,Class,X) when X rem 2 == 0 ->
+ fun() ->
+ process_flag(priority,high),
+ send_n_burst(N, seq, Text, Class)
+ end;
+per_proc_fun(N,Text,Class,_) ->
+ fun() ->
+ send_n_burst(N, seq, Text, Class)
+ end.
+
%%%-----------------------------------------------------------------
%%% Formatter callback
%%% Using this to send the formatted string back to the test case
@@ -1567,6 +1573,9 @@ h_proc_name(Name) ->
file_delete(Log) ->
file:delete(Log).
+wait_for_process_up(T) ->
+ wait_for_process_up(h_proc_name(),T).
+
wait_for_process_up(Name,T) ->
N = (T div 500) + 1,
wait_for_process_up1(Name,N).
@@ -1577,8 +1586,10 @@ wait_for_process_up1(Name,N) ->
timer:sleep(500),
case whereis(Name) of
Pid when is_pid(Pid) ->
+ %% ct:pal("Process ~p up (~p tries left)",[Name,N]),
{ok,Pid};
undefined ->
+ %% ct:pal("Waiting for process ~p (~p tries left)",[Name,N]),
wait_for_process_up1(Name,N-1)
end.