diff options
Diffstat (limited to 'lib/IPC/Run/t/signal.t')
-rw-r--r-- | lib/IPC/Run/t/signal.t | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/lib/IPC/Run/t/signal.t b/lib/IPC/Run/t/signal.t deleted file mode 100644 index 399bd527e4..0000000000 --- a/lib/IPC/Run/t/signal.t +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -signal.t - Test suite IPC::Run->signal - -=cut - -BEGIN { - if( $ENV{PERL_CORE} ) { - use Cwd; - $^X = Cwd::abs_path($^X); - $^X = qq("$^X") if $^X =~ /\s/; - chdir '../lib/IPC/Run' if -d '../lib/IPC/Run'; - unshift @INC, 'lib', '../..'; - } -} - -use strict ; - -use Test ; - -use IPC::Run qw( :filters :filter_imp start run filter_tests ) ; -use UNIVERSAL qw( isa ) ; - -sub Win32_MODE() ; -*Win32_MODE = \&IPC::Run::Win32_MODE ; - -## Win32 does not support a lot of things that Unix does. These -## skip_unless subs help that. -## -## TODO: There are also a few things that Win32 supports (passing Win32 OS -## handles) that we should test for, conversely. -sub skip_unless_signals(&) { - if ( Win32_MODE ) { - return sub { - skip "$^O does not support signals", 0 ; - } ; - } - shift ; -} - -use IPC::Run qw( start ) ; - -my @receiver = ( - $^X, - '-e', - <<'END_RECEIVER', - my $which = " " ; - sub s{ $which = $_[0] } ; - $SIG{$_}=\&s for (qw(USR1 USR2)); - $| = 1 ; - print "Ok\n"; - for (1..10) { sleep 1 ; print $which, "\n" } -END_RECEIVER -) ; - -my $h ; -my $out ; - -my @tests = ( -skip_unless_signals { - $h = start \@receiver, \undef, \$out ; - pump $h until $out =~ /Ok/ ; - ok 1 ; -}, -skip_unless_signals { - $out = "" ; - $h->signal( "USR2" ) ; - pump $h ; - $h->signal( "USR1" ) ; - pump $h ; - $h->signal( "USR2" ) ; - pump $h ; - $h->signal( "USR1" ) ; - pump $h ; - ok $out, "USR2\nUSR1\nUSR2\nUSR1\n" ; -}, - -skip_unless_signals { - $h->signal( "TERM" ) ; - finish $h ; - ok( 1 ) ; -}, - -) ; - -plan tests => scalar @tests ; - -$_->() for ( @tests ) ; |