X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Falarm.t;h=118ee9d6ae7e31b9a4e865374ef9fc432c798646;hb=6ec5370cb0aeb185d92b8fd2bad21bb10f75b30e;hp=907c385264169024680032d1338b04a8f19c793a;hpb=dfcfdb64cf0cdaf3745a1082d9b4a94480414c62;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/alarm.t b/t/op/alarm.t index 907c385..118ee9d 100644 --- a/t/op/alarm.t +++ b/t/op/alarm.t @@ -13,7 +13,7 @@ BEGIN { } } -plan tests => 4; +plan tests => 5; my $Perl = which_perl(); my $start_time = time; @@ -44,4 +44,16 @@ $diff = time - $start_time; # alarm time might be one second less than you said. is( $@, "ALARM!\n", 'alarm w/$SIG{ALRM} vs system()' ); -ok( abs($diff - 3) <= 1, ' right time' ); +{ + local $TODO = "Why does system() block alarm() on $^O?" + if $^O eq 'VMS' || $^O eq 'dos'; + ok( abs($diff - 3) <= 1, " right time (waited $diff secs for 3-sec alarm)" ); +} + + +{ + local $SIG{"ALRM"} = sub { die }; + eval { alarm(1); my $x = qx($Perl -e "sleep 3") }; + chomp (my $foo = "foo\n"); + ok($foo eq "foo", '[perl #33928] chomp() fails after alarm(), `sleep`'); +}