File 0502-Add-test.patch of Package erlang
From 8798603636f4b05c1d4061383f441d7bd756ba65 Mon Sep 17 00:00:00 2001
From: Jonathan Klabunde Tomer <jkt@fb.com>
Date: Thu, 25 Feb 2021 17:01:46 -0800
Subject: [PATCH 2/2] Add test.
With this change to the test but not the fix in the previous commit, running
os_signal_SUITE with emulator arg +Bd or +Bi will fail (BEAM will die with a
signal, which is not the best way to fail a test, but we don't have a shell
test suite to catch it).
To confirm, you can use ts, with
`ts:run(emulator, os_signal_SUITE, [{vars, [{erl_start_args, "+Bd"}]}]).`.
---
erts/emulator/test/os_signal_SUITE.erl | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/erts/emulator/test/os_signal_SUITE.erl b/erts/emulator/test/os_signal_SUITE.erl
index 7bd8985dc7..5242d96571 100644
--- a/erts/emulator/test/os_signal_SUITE.erl
+++ b/erts/emulator/test/os_signal_SUITE.erl
@@ -52,14 +52,14 @@ suite() ->
all() ->
case os:type() of
{win32, _} -> [];
- _ -> [set_unset,
- t_sighup,
+ _ -> [t_sighup,
t_sigusr1,
t_sigusr2,
t_sigterm,
t_sigalrm,
t_sigchld,
- t_sigchld_fork]
+ t_sigchld_fork,
+ set_unset]
end.
init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) ->
@@ -135,7 +135,7 @@ t_sighup(_Config) ->
t_sigusr1(_Config) ->
Pid1 = setup_service(),
OsPid = os:getpid(),
- os:set_signal(sigusr1, handle),
+ % shouldn't need to explicitly set_signal to handle USR1, it's the default
ok = kill("USR1", OsPid),
ok = kill("USR1", OsPid),
ok = kill("USR1", OsPid),
@@ -157,7 +157,7 @@ t_sigusr1(_Config) ->
Msgs2 = fetch_msgs(Pid2),
io:format("Msgs2: ~p~n", [Msgs2]),
[] = Msgs2,
- %% reset to ignore (it's the default)
+ %% reset to handle (default) so as not to break other tests
os:set_signal(sigusr1, handle),
ok.
--
2.26.2