File 2564-ct_util-Stop-using-get_stacktrace-0-inappropriately.patch of Package erlang
From ba5d07704cc4b54139c48c7d034f389a31c37a89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Wed, 10 May 2017 07:31:53 +0200
Subject: [PATCH 2/4] ct_util: Stop using get_stacktrace/0 inappropriately
The return value of erlang:get_stacktrace/0 is not defined
when called like this:
try Expr of
Pattern ->
erlang:get_stacktrace()
end
Currently, the stacktrace will be from a random earlier error.
In a future release, it may be [].
Note: We can remove the entire 'case' statement because
CTHReason can never be an atom.
---
lib/common_test/src/ct_util.erl | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl
index 4d3a2ae7e..802e9be97 100644
--- a/lib/common_test/src/ct_util.erl
+++ b/lib/common_test/src/ct_util.erl
@@ -201,14 +201,7 @@ do_start(Parent, Mode, LogDir, Verbosity) ->
ok ->
Parent ! {self(),started};
{fail,CTHReason} ->
- ErrorInfo = if is_atom(CTHReason) ->
- io_lib:format("{~p,~p}",
- [CTHReason,
- erlang:get_stacktrace()]);
- true ->
- CTHReason
- end,
- ct_logs:tc_print('Suite Callback',ErrorInfo,[]),
+ ct_logs:tc_print('Suite Callback',CTHReason,[]),
self() ! {{stop,{self(),{user_error,CTHReason}}},
{Parent,make_ref()}}
catch
--
2.13.0