File 0500-erts-Fix-process_SUITE-max_heap-tests.patch of Package erlang
From 5558739ec463bf20e8b7e57be9a0351d4f3e3933 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Mon, 7 Jan 2019 17:18:36 +0100
Subject: [PATCH] erts: Fix process_SUITE:max_heap tests
Make sure to flush all queued emulator logger messages
before starting the test. The trap_exit_badarg could sometimes
leave messages and since the handler and messages now are
handled in different processes this becomes a problem.
---
erts/emulator/test/process_SUITE.erl | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/erts/emulator/test/process_SUITE.erl b/erts/emulator/test/process_SUITE.erl
index 57eb082d64..b23f77a0b2 100644
--- a/erts/emulator/test/process_SUITE.erl
+++ b/erts/emulator/test/process_SUITE.erl
@@ -2104,6 +2104,13 @@ spawn_opt_max_heap_size(_Config) ->
error_logger:add_report_handler(?MODULE, self()),
+ %% flush any prior messages in error_logger
+ Pid = spawn(fun() -> ok = nok end),
+ receive
+ {error, _, {emulator, _, [Pid|_]}} ->
+ flush()
+ end,
+
%% Test that numerical limit works
max_heap_size_test(1024, 1024, true, true),
@@ -2208,6 +2215,13 @@ receive_unexpected() ->
ok
end.
+flush() ->
+ receive
+ _M -> flush()
+ after 0 ->
+ ok
+ end.
+
%% error_logger report handler proxy
init(Pid) ->
{ok, Pid}.
--
2.16.4