diff options
author | Björn Gustavsson <bjorn@erlang.org> | 2021-04-20 05:59:50 +0200 |
---|---|---|
committer | Björn Gustavsson <bjorn@erlang.org> | 2021-05-24 13:24:42 +0200 |
commit | a543df40d92830287ce04dcddebb489d2df95c61 (patch) | |
tree | 03c0a78488b574b9dc6c3b377255c774d716da39 /erts/emulator/test/exception_SUITE.erl | |
parent | 1e4b9dc0185ddc18111056d4fd2e37bbf9266634 (diff) | |
download | erlang-a543df40d92830287ce04dcddebb489d2df95c61.tar.gz |
Allow stacktrace variation in exception test cases
The JIT for ARM will give a more detailed stacktrace for operators
such as '+'/2 (the top stacktrace entry will be for the operator
including its arguments). Update test cases that test for exceptions
to allow for this variation.
Diffstat (limited to 'erts/emulator/test/exception_SUITE.erl')
-rw-r--r-- | erts/emulator/test/exception_SUITE.erl | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/erts/emulator/test/exception_SUITE.erl b/erts/emulator/test/exception_SUITE.erl index 8345eb4a1b..9d89569fdc 100644 --- a/erts/emulator/test/exception_SUITE.erl +++ b/erts/emulator/test/exception_SUITE.erl @@ -1406,11 +1406,23 @@ line_numbers(Config) when is_list(Config) -> [{file,"fake_file.erl"},{line,3}]}, {?MODULE,line_numbers,1,_}|_]}} = (catch line1(bad_tag, 0)), - {'EXIT',{badarith, - [{?MODULE,line1,2, - [{file,"fake_file.erl"},{line,5}]}, - {?MODULE,line_numbers,1,_}|_]}} = - (catch line1(a, not_an_integer)), + + %% The stacktrace for operators such a '+' can vary depending on + %% whether the JIT is used or not. + case catch line1(a, not_an_integer) of + {'EXIT',{badarith, + [{erlang,'+',[not_an_integer,1],_}, + {?MODULE,line1,2, + [{file,"fake_file.erl"},{line,5}]}, + {?MODULE,line_numbers,1,_}|_]}} -> + ok; + {'EXIT',{badarith, + [{?MODULE,line1,2, + [{file,"fake_file.erl"},{line,5}]}, + {?MODULE,line_numbers,1,_}|_]}} -> + ok + end, + {'EXIT',{{badmatch,{ok,1}}, [{?MODULE,line1,2, [{file,"fake_file.erl"},{line,7}]}, @@ -1494,14 +1506,29 @@ line_numbers(Config) when is_list(Config) -> {?MODULE,line_numbers,1,_}|_]}} = (catch applied_bif_2()), - {'EXIT',{badarith, - [{?MODULE,increment1,1,[{file,"increment.erl"},{line,45}]}, - {?MODULE,line_numbers,1,_}|_]}} = - (catch increment1(x)), - {'EXIT',{badarith, - [{?MODULE,increment2,1,[{file,"increment.erl"},{line,48}]}, - {?MODULE,line_numbers,1,_}|_]}} = - (catch increment2(x)), + case catch increment1(x) of + {'EXIT',{badarith, + [{erlang,'+',[x,1],_}, + {?MODULE,increment1,1,[{file,"increment.erl"},{line,45}]}, + {?MODULE,line_numbers,1,_}|_]}} -> + ok; + {'EXIT',{badarith, + [{?MODULE,increment1,1,[{file,"increment.erl"},{line,45}]}, + {?MODULE,line_numbers,1,_}|_]}} -> + ok + end, + + case catch increment2(x) of + {'EXIT',{badarith, + [{erlang,'+',[x,1],_}, + {?MODULE,increment2,1,[{file,"increment.erl"},{line,48}]}, + {?MODULE,line_numbers,1,_}|_]}} -> + ok; + {'EXIT',{badarith, + [{?MODULE,increment2,1,[{file,"increment.erl"},{line,48}]}, + {?MODULE,line_numbers,1,_}|_]}} -> + ok + end, {'EXIT',{{badmap,not_a_map}, [{?MODULE,update_map,1,[{file,"map.erl"},{line,3}]}|_]}} = |