File 0330-test-supervisor-attempt-to-prevent-inter-testcase-fl.patch of Package erlang
From 9ce88504493d141fe3f204ed16a7f9f4819c9edd Mon Sep 17 00:00:00 2001
From: Thales Macedo Garitezi <thalesmg@gmail.com>
Date: Thu, 27 Apr 2023 15:08:57 -0300
Subject: [PATCH 2/2] test(supervisor): attempt to prevent inter-testcase
flakiness
---
lib/stdlib/test/supervisor_SUITE.erl | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lib/stdlib/test/supervisor_SUITE.erl b/lib/stdlib/test/supervisor_SUITE.erl
index 9532aaf118..f7f3aa0ba3 100644
--- a/lib/stdlib/test/supervisor_SUITE.erl
+++ b/lib/stdlib/test/supervisor_SUITE.erl
@@ -3679,6 +3679,8 @@ significant_upgrade_child(_Config) ->
%% Test trying to start a child that uses an already registered name.
already_started_outside_supervisor(_Config) ->
+ %% Avoid inter-testcase flakiness
+ ensure_supervisor_is_stopped(),
process_flag(trap_exit, true),
{ok, SupPid} = start_link({ok, {#{}, []}}),
RegName = registered_name,
@@ -3795,3 +3797,11 @@ check_no_exit(Timeout) ->
start_registered_name(Name) ->
supervisor:start_link({local, Name}, ?MODULE, []).
+
+ensure_supervisor_is_stopped() ->
+ case whereis(sup_test) of
+ undefined ->
+ ok;
+ Pid ->
+ terminate(Pid, shutdown)
+ end.
--
2.35.3