shred: enable direct I/O when possible
[coreutils.git] / tests / misc / timeout-blocked.pl
blob6f16ba4c89584dcc5dabb6bb74a111047292c346
1 #!/usr/bin/perl
2 # Test that timeout handles blocked SIGALRM from its parent.
4 # Copyright (C) 2013 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 <http://www.gnu.org/licenses/>.
19 use strict;
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";
34 my @Tests =
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};
45 my $prog = 'timeout';
46 my $fail = run_tests ($ME, $prog, \@Tests, $save_temps, $verbose);
48 exit $fail;