From 6e59d93aee950461947904b4f24a7f52c6c85f58 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Wed, 15 Jun 2011 15:07:57 +0100 Subject: [perl #92828] eintr.t hangs on FreeBSD My commit df375c6d048b938ecdeaecc7b264a7f1a190120a attempted to convert t/io/eintr.t from OS-based skipping to capability-based skipping, but it only tested whether reads from pipes are interruptible. Some OSes (like FreeBSD) only hang on write; so probe for that too. --- t/io/eintr.t | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/t/io/eintr.t b/t/io/eintr.t index 90fce80a97..a36b4275df 100644 --- a/t/io/eintr.t +++ b/t/io/eintr.t @@ -50,6 +50,7 @@ if (exists $ENV{PERLIO} && $ENV{PERLIO} =~ /stdio/ ) { { my $pipe; + note("checking for read interruptibility..."); my $pid = eval { open($pipe, '-|') }; unless (defined $pid) { skip_all("can't do -| open"); @@ -75,6 +76,34 @@ if (exists $ENV{PERLIO} && $ENV{PERLIO} =~ /stdio/ ) { exit 0; } alarm(0); + + $SIG{PIPE} = 'IGNORE'; + + note("checking for write interruptibility..."); + $pid = eval { open($pipe, '|-') }; + unless (defined $pid) { + skip_all("can't do |- open"); + exit 0; + } + unless ($pid) { + #child + sleep 3; + close $pipe; + exit 0; + } + + # parent + + $intr = 0; + my $buf = "a" x 1_000_000 . "\n"; # bigger than any pipe buffer hopefully + alarm(1); + $x = print $pipe $buf; + + unless ($intr) { + skip_all("writes aren't interruptible"); + exit 0; + } + alarm(0); } -- cgit v1.2.1