This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perluniprops: Make sc property refer to scx
[perl5.git] / t / io / errnosig.t
CommitLineData
d0166017
LR
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
624c42e2
N
5 require "./test.pl";
6 set_up_inc( qw(. ../lib) );
d0166017
LR
7}
8
9require Config; import Config;
d0166017
LR
10plan(tests => 1);
11
12SKIP: {
13 skip("Alarm not supported", 1) unless exists $Config{'d_alarm'};
14
15 $SIG{ALRM} = sub {
16 # We could call anything that modifies $! here, but
17 # this way we can be sure that it isn't the same
18 # errno as interrupted sleep() would return, and are
19 # able to check it thereafter.
20 $! = -1;
21 };
22
23 alarm 1;
24 sleep 2;
25
26 # Interrupted sleeps sets errno to EAGAIN, but signal
27 # that # hits after it (if safe signal handling is enabled)
28 # causes a routing that modifies $! to be run afterwards
29 isnt($! + 0, -1, 'Signal does not modify $!');
30}