File 2981-5719-Adding-Stacktrace-to-thrown.patch of Package erlang
From 8bd699ba4695c68750f1887b87a56b6ede9e22e9 Mon Sep 17 00:00:00 2001
From: Ben Adams <Ben@MessageMap.IO>
Date: Sun, 29 May 2022 18:12:09 +0000
Subject: [PATCH] 5719 - Adding Stacktrace to thrown - For Common_tests: Added
to Match Results for thrown and not hard coded to Content of stacktrace
---
lib/common_test/src/test_server.erl | 2 +-
lib/common_test/test/ct_error_SUITE.erl | 11 +++++------
lib/common_test/test/ct_test_support.erl | 3 +++
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/lib/common_test/src/test_server.erl b/lib/common_test/src/test_server.erl
index 6c383b04d0..aba1078bd1 100644
--- a/lib/common_test/src/test_server.erl
+++ b/lib/common_test/src/test_server.erl
@@ -1789,7 +1789,7 @@ ts_tc(M, F, A) ->
set_loc(Stk),
case Type of
throw ->
- {failed,{thrown,Reason}};
+ {failed,{thrown,{Reason,Stk}}};
error ->
{'EXIT',{Reason,Stk}};
exit ->
diff --git a/lib/common_test/test/ct_error_SUITE.erl b/lib/common_test/test/ct_error_SUITE.erl
index 3b62380f87..38d03536b8 100644
--- a/lib/common_test/test/ct_error_SUITE.erl
+++ b/lib/common_test/test/ct_error_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2009-2021. All Rights Reserved.
+%% Copyright Ericsson AB 2009-2022. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -729,9 +729,8 @@ test_events(lib_error) ->
{lib_error_1_SUITE,lines_hang,{failed,{timetrap_timeout,3000}}}},
{?eh,test_stats,{0,3,{0,0}}},
{?eh,tc_start,{lib_error_1_SUITE,lines_throw}},
- {?eh,tc_done,
- {lib_error_1_SUITE,lines_throw,
- {failed,{error,{thrown,catch_me_if_u_can}}}}},
+ {?eh,tc_done,{lib_error_1_SUITE,lines_throw,{failed,
+ {error,{thrown,{catch_me_if_u_can,'_'}}}}}},
{?eh,test_stats,{0,4,{0,0}}},
{?eh,tc_start,{lib_error_1_SUITE,no_lines_error}},
{?eh,tc_done,
@@ -748,8 +747,8 @@ test_events(lib_error) ->
{lib_error_1_SUITE,no_lines_hang,{failed,{timetrap_timeout,3000}}}},
{?eh,test_stats,{0,7,{0,0}}},
{?eh,tc_start,{lib_error_1_SUITE,no_lines_throw}},
- {?eh,tc_done,
- {lib_error_1_SUITE,no_lines_throw,{failed,{error,{thrown,catch_me_if_u_can}}}}},
+ {?eh,tc_done,{lib_error_1_SUITE,no_lines_throw,{failed,
+ {error,{thrown,{catch_me_if_u_can,'_'}}}}}},
{?eh,test_stats,{0,8,{0,0}}},
{?eh,tc_start,{lib_error_1_SUITE,init_tc_error}},
{?eh,tc_done,{lib_error_1_SUITE,init_tc_error,
diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl
index 05694535ad..d24551eed2 100644
--- a/lib/common_test/test/ct_test_support.erl
+++ b/lib/common_test/test/ct_test_support.erl
@@ -1217,6 +1217,9 @@ result_match({failed,{timetrap_timeout,{'$approx',Num}}},
result_match({user_timetrap_error,{Why,'_'}},
{user_timetrap_error,{Why,_Stack}}) ->
true;
+result_match({SkipOrFail,{ErrorInd,{thrown,{Why,'_'}}}},
+ {SkipOrFail,{ErrorInd,{thrown,{Why,_Stack}}}}) ->
+ true;
result_match(Result, Result) ->
true;
result_match(_, _) ->
--
2.35.3