From 040151ff7063747496020558c593f95f43408de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 4 Dec 2023 16:23:12 +0100 Subject: Handle emulator errors properly for OTP-26+ --- src/ct_helper_error_h.erl | 19 +++++++++++++++---- 1 file 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,\\[{([^,]+),([^,]+),(.+)", -- cgit v1.2.3