summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2023-12-04 16:23:12 +0100
committerLoïc Hoguin <[email protected]>2023-12-04 16:23:12 +0100
commit040151ff7063747496020558c593f95f43408de2 (patch)
treec08540614d7d12b54030b7f805bd6e7fd17cbeeb
parentbf7acaf727ed7c5942fc1d9417de1d0c2825fac1 (diff)
downloadct_helper-040151ff7063747496020558c593f95f43408de2.tar.gz
ct_helper-040151ff7063747496020558c593f95f43408de2.tar.bz2
ct_helper-040151ff7063747496020558c593f95f43408de2.zip
Handle emulator errors properly for OTP-26+
-rw-r--r--src/ct_helper_error_h.erl19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/ct_helper_error_h.erl b/src/ct_helper_error_h.erl
index 2cf88c8..5d7cf02 100644
--- a/src/ct_helper_error_h.erl
+++ b/src/ct_helper_error_h.erl
@@ -58,11 +58,22 @@ handle_event({error_report, _, {_, crash_report,
State) ->
{ok, State};
%% Ignore emulator reports that are a duplicate of what Ranch gives us.
-%%
-%% The emulator always sends strings for errors, which makes it very
-%% difficult to extract the information we need, hence the regexps.
+handle_event(Event = {error, GL, {emulator, "Error in process ~p" ++ _, Args}}, State)
+ when node(GL) =:= node(), is_list(Args) ->
+ [Pid, _Node, {_Error, [{Mod, Fun, Arity, _}|_]}] = Args,
+ Crash = {Pid, Mod, Fun, Arity},
+ case lists:member(Crash, State) of
+ true ->
+ {ok, lists:delete(Crash, State)};
+ false ->
+ write_event(Event),
+ {ok, State}
+ end;
+%% The emulator always sends strings for errors in older OTP versions,
+%% which makes it very difficult to extract the information we need,
+%% hence the regexps.
handle_event(Event = {error, GL, {emulator, _, Msg}}, State)
- when node(GL) =:= node() ->
+ when node(GL) =:= node(), is_list(Msg) ->
Result = re:run(Msg,
"Error in process ([^\s]+).+? with exit value: "
".+?{stacktrace,\\[{([^,]+),([^,]+),(.+)",