diff options
author | Hans Bolinder <[email protected]> | 2015-09-09 12:51:47 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2015-09-09 12:51:47 +0200 |
commit | ddd1acec5100f5bcc96b29f09b80edd717746edf (patch) | |
tree | dcd67499c1684f208e761cf5411286a3bbc3d2c0 /lib/stdlib/test/proc_lib_SUITE.erl | |
parent | fc04b7b20834cf29a6c62e4f17ff8a540d493cf1 (diff) | |
parent | 59911612aec5f18b099dbc518089dd3ce48fdd97 (diff) | |
download | otp-ddd1acec5100f5bcc96b29f09b80edd717746edf.tar.gz otp-ddd1acec5100f5bcc96b29f09b80edd717746edf.tar.bz2 otp-ddd1acec5100f5bcc96b29f09b80edd717746edf.zip |
Merge branch 'maint'
* maint:
dialyzer: Add a testcase
Add documentation
Introduce sasl_report_SUITE
Teach sasl_report to limit crash reports
proc_lib: Add format/3
Teach error_logger_tty_h to truncate big messages
error_logger_tty_h: Refactor and modernize code
Teach error_logger_file_h to truncate big messages
error_logger_file_h: Refactor and modernize code
Remove unused code in error logger handlers
Add error_logger_h_SUITE
sasl_SUITE: Add a rudimentary test of the utc_log configuration
sasl_SUITE: Correct the log_file/1 test case
proc_lib_SUITE: Remove added report handlers
zip_SUITE: Don't trust priv_dir to be empty
Diffstat (limited to 'lib/stdlib/test/proc_lib_SUITE.erl')
-rw-r--r-- | lib/stdlib/test/proc_lib_SUITE.erl | 56 |
1 files changed, 53 insertions, 3 deletions
diff --git a/lib/stdlib/test/proc_lib_SUITE.erl b/lib/stdlib/test/proc_lib_SUITE.erl index 36f009eec6..3a8fa74d36 100644 --- a/lib/stdlib/test/proc_lib_SUITE.erl +++ b/lib/stdlib/test/proc_lib_SUITE.erl @@ -28,7 +28,7 @@ init_per_group/2,end_per_group/2, crash/1, sync_start_nolink/1, sync_start_link/1, spawn_opt/1, sp1/0, sp2/0, sp3/1, sp4/2, sp5/1, - hibernate/1, stop/1]). + hibernate/1, stop/1, t_format/1]). -export([ otp_6345/1, init_dont_hang/1]). -export([hib_loop/1, awaken/1]). @@ -51,7 +51,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [crash, {group, sync_start}, spawn_opt, hibernate, - {group, tickets}, stop]. + {group, tickets}, stop, t_format]. groups() -> [{tickets, [], [otp_6345, init_dont_hang]}, @@ -149,7 +149,11 @@ crash(Config) when is_list(Config) -> ?line ?t:fail({unexpected_message,Any}) after 2000 -> ok - end. + end, + + error_logger:delete_report_handler(?MODULE), + ok. + sync_start_nolink(Config) when is_list(Config) -> @@ -301,6 +305,7 @@ hibernate(Config) when is_list(Config) -> ?line {value,{initial_call,{?MODULE,hib_loop,[_]}}} = lists:keysearch(initial_call, 1, Report), + error_logger:delete_report_handler(?MODULE), ok. hib_loop(LoopData) -> @@ -452,6 +457,51 @@ system_terminate(crash,_Parent,_Deb,_State) -> system_terminate(Reason,_Parent,_Deb,_State) -> exit(Reason). + +t_format(_Config) -> + error_logger:tty(false), + try + t_format() + after + error_logger:tty(true) + end, + ok. + +t_format() -> + error_logger:add_report_handler(?MODULE, self()), + Pid = proc_lib:spawn(fun t_format_looper/0), + HugeData = gb_sets:from_list(lists:seq(1, 100)), + Pid ! {die,HugeData}, + Report = receive + {crash_report, Pid, Report0} -> Report0 + end, + Usz = do_test_format(Report, unlimited), + Tsz = do_test_format(Report, 20), + + if + Tsz >= Usz -> + ?t:fail(); + true -> + ok + end, + + ok. + +do_test_format(Report, Depth) -> + io:format("*** Depth = ~p", [Depth]), + S0 = proc_lib:format(Report, latin1, Depth), + S = lists:flatten(S0), + io:put_chars(S), + length(S). + +t_format_looper() -> + receive + {die,Data} -> + exit(Data); + _ -> + t_format_looper() + end. + %%----------------------------------------------------------------- %% The error_logger handler used. %%----------------------------------------------------------------- |