2 # Test that timeout handles blocked SIGALRM from its parent.
4 # Copyright (C) 2013-2024 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
21 (my $ME = $0) =~ s
|.*/||;
23 eval { require POSIX
; };
25 and CuSkip
::skip
"$ME: this script requires Perl's POSIX module\n";
27 use POSIX
qw(:signal_h);
28 my $sigset = POSIX
::SigSet
->new(SIGALRM
); # define the signals to block
29 my $old_sigset = POSIX
::SigSet
->new; # where the old sigmask will be kept
30 unless (defined sigprocmask
(SIG_BLOCK
, $sigset, $old_sigset)) {
31 CuSkip
::skip
"$ME: sigprocmask failed; skipped";
36 # test-name, [option, option, ...] {OUT=>"expected-output"}
39 ['block-alrm', ".1 sleep 10", {EXIT
=> 124}],
42 my $save_temps = $ENV{DEBUG
};
43 my $verbose = $ENV{VERBOSE
};
46 my $fail = run_tests
($ME, $prog, \
@Tests, $save_temps, $verbose);