File 0231-logger-Make-sure-to-stop-handler-after-testcase.patch of Package erlang
From 9f12208a442999a3feda03c07a51f20a166331bb Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Thu, 15 Apr 2021 10:21:07 +0200
Subject: [PATCH] logger: Make sure to stop handler after testcase
---
lib/kernel/test/logger_disk_log_h_SUITE.erl | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/lib/kernel/test/logger_disk_log_h_SUITE.erl b/lib/kernel/test/logger_disk_log_h_SUITE.erl
index 13c1a0b910..8c5a679f58 100644
--- a/lib/kernel/test/logger_disk_log_h_SUITE.erl
+++ b/lib/kernel/test/logger_disk_log_h_SUITE.erl
@@ -1360,7 +1360,23 @@ start_handler(Name, FuncName, Config) ->
stop_handler(Name) ->
ct:pal("Stopping handler ~p!", [Name]),
- logger:remove_handler(Name).
+ Res = logger:remove_handler(Name),
+ RegName = ?name_to_reg_name(logger_disk_log_h, Name),
+ erlang:monitor(process, RegName),
+ receive
+ {'DOWN',_,_,_,_} ->
+ Res
+ after 5000 ->
+ %% If the removal fails, we make sure that it is removed
+ %% so that the next testcase is not effected.
+ exit(whereis(RegName), kill),
+ receive
+ {'DOWN',_,_,_,_} ->
+ %% We fail this testcase in order to catch any bugs
+ %% in shutdown
+ ct:fail("Failed to stop handler")
+ end
+ end.
send_burst(NorT, Type, {chars,Sz}, Class) ->
Text = [34 + rand:uniform(126-34) || _ <- lists:seq(1,Sz)],
--
2.26.2