aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/proc_lib_SUITE.erl
diff options
context:
space:
mode:
authorDaniil Fedotov <[email protected]>2017-06-16 17:41:59 +0100
committerHans Bolinder <[email protected]>2017-06-22 08:49:59 +0200
commit112b7d7a1946f6b90b3497ef4c176c6d066571e2 (patch)
treec2cdf595cc0586b70221d0b5f2a482ea4b2cb02a /lib/stdlib/test/proc_lib_SUITE.erl
parent040bdce67f88d833bfb59adae130a4ffb4c180f0 (diff)
downloadotp-112b7d7a1946f6b90b3497ef4c176c6d066571e2.tar.gz
otp-112b7d7a1946f6b90b3497ef4c176c6d066571e2.tar.bz2
otp-112b7d7a1946f6b90b3497ef4c176c6d066571e2.zip
Support arbitrary crash report in proc_lib.
The `error_logger_format_depth` variable is `unlimited` by default. This can cause errors when logging crash reports using sasl logger, because `io_lib:format("~P"...` does not support `unlimited` as a depth parameter. Use formatter string "~p" for unlimited depth. A way to reproduce the error: Start erl with sasl logger: erl -boot start_sasl -sasl errlog_type error -sasl sasl_error_logger tty Report arbitrary error: error_logger:error_report(crash_report, [fake_crash_report, foo]).
Diffstat (limited to 'lib/stdlib/test/proc_lib_SUITE.erl')
-rw-r--r--lib/stdlib/test/proc_lib_SUITE.erl17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/stdlib/test/proc_lib_SUITE.erl b/lib/stdlib/test/proc_lib_SUITE.erl
index 029e6286e4..0d5bbdf19f 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, stacktrace/1, sync_start_nolink/1, sync_start_link/1,
spawn_opt/1, sp1/0, sp2/0, sp3/1, sp4/2, sp5/1, '\x{447}'/0,
- hibernate/1, stop/1, t_format/1]).
+ hibernate/1, stop/1, t_format/1, t_format_arbitrary/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, stacktrace, {group, sync_start}, spawn_opt, hibernate,
- {group, tickets}, stop, t_format].
+ {group, tickets}, stop, t_format, t_format_arbitrary].
groups() ->
[{tickets, [], [otp_6345, init_dont_hang]},
@@ -562,6 +562,19 @@ t_format() ->
ok.
+t_format_arbitrary(_Config) ->
+ error_logger:tty(false),
+ try
+ t_format_arbitrary()
+ after
+ error_logger:tty(true)
+ end,
+ ok.
+
+t_format_arbitrary() ->
+ do_test_format([fake_report, []], unlimited),
+ do_test_format([fake_report, []], 20).
+
do_test_format(Report, Depth) ->
io:format("*** Depth = ~p", [Depth]),
S0 = proc_lib:format(Report, latin1, Depth),